Alex, can you remind me how to use console to verify the web element. For example: The code: <span class="items_showing_count"> 1 - 25 of 2276 items </span> The locater: By.className("items_showing_count"); The console verification: $x( )
$x("//*[class='items_showing_count'") or $x("//span[class='items_showing_count'")
or if you dont want XPath but use CSS :
$$(".items_showing_count") or $$("span.items_showing_count")
Thanks Oleg, but if I don't like neither xPath nor CSS. I need just check how many elements the code has with the same name.
You are stuck with either CSS or XPath selectors in the console. There are other ways to check stuff like that, but those are way longer and less convenient
if you want to check that a locator works, especially for xpath or css locators, you have to test them in the Chrome Inspector, in the Console tab.
just use xpath for now to keep things simpler.
between the following 2 expressions, the second one is better:
$x("//*[@class='items_showing_count']")
$x("//span[@class='items_showing_count']")
because it uses the element tag (span) instead of *.
each xpath selector should be as specific as possible.
Thanks guys.
Anytime :)