In general, when I want to test the validity of a locator to be used in Selenium, I test it using the Firebug console.
i.e开发者_StackOverflow., I write: $$("a#someLink")
in the Firebug console and the corresponding link becomes highlighted in Firefox.
However, if I test in Firebug for a locator like:
table#someTable tr:nth-of-type(2) td:nth-of-type(2)
Firebug doesn't show anything... Even though the locator works fine from Selenium...
I guess Selenium uses some 'hacks' for CSS locators, which Firebug does not understand...
Is there any way around it? Would using Xpath locators allow me to test for those kinds of locators?
Thank you very much
Firebug has an extension called FireFinder, which allows you to test xpath or css locators and it shows all the matches on the page. Here's a link.
精彩评论