-1

HTML:

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

Can you please help me with xpath 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*
1
  • Please share the html DOM, stacktrace and your effort on the problem. This will help us getting to a solution. Your problem statement looks incomplete right now. Commented Jul 14, 2018 at 9:06

1 Answer 1

0

Try the below and let us know the outcome.

//div[starts-with(@class,'ArticleCount__articleCount')]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.