-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*
  • 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. – Kshetra Mohan Prusty Jul 14 '18 at 9:06
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, privacy policy and cookie policy

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