HTML:

...<div ="ArticleCount__articleCount___lQ5f1">
< class="ArticleCount_____1c2Rn">Showing</>
9
< class="ArticleCount__text___1c2Rn">of</>
23
< class="ArticleCount__text___1c2Rn">articles</>
</div>

Can you please help me with to get the value 9 and 23; I tried with below options:

List<WebElement> list1 = driver.findElements( By.xpath( "//div[starts-
with(@class,'ArticleCount__articleCount')]//span" ) );
     for (int i = 0; 1<list1.size() ; i++)
     {
            System.out.println("Text from String list is::"+list1.get(i).getText());
     }

Output:

Text from String list is :: Showing
Text from String list is :: of
Text from String list is :: articles*



Source link https://sqa.stackexchange.com/questions/34754/how-to--xpath-to--text-between-span-class

LEAVE A REPLY

Please enter your comment!
Please enter your name here