开发者

Testing for CSS Selenium locators from the browser

开发者 https://www.devze.com 2023-03-25 08:23 出处:网络
In general, when I want to test the validity of a locator to be used in Selenium, I test it using the Firebug console.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号