I am creating an automatic test for some webs and I'm using WebDriver, TestNG and code that is written in Java. On the page is shown register of categories, in parentheses is number of auctions and i need to get this number as variable, but i don't know, how.
I use the following code:
WebElement number1_1_vse = (driver.findElement(By.linkText("Vše")));
String text_vse1_1 = number1_1_vse.getText();
but output is only: "Vše" without (number of auctions)
screenshot -> image with the number
can anyone advise me please?
With linktext you are finding the nested a which text is
Vše
only. You need to find the li containing the textVše (949)
Use the following css selector to identify the element