Please post your Web Driver questions in official Web Driver forum

Tuesday, March 30, 2010

Testing XPath in Firebug

Given the lack of testing hooks in web applications, many a times Selenium Users use XPath to work on UI Objects. So far I used to use Selenium IDE to test XPath in Firefox. I read a blog post here and got to know that Firebug itself can be used to test XPath. This is accomplished using $x function in Firefox.









Consider that highlighted text box does not have a constant identifier hence following XPath is to be used > $x("//input[@name='search']")
Write this XPath on Console of Firebug and hit enter -



















Keep mouse pointer on 'input' in console and it would highlight the text box in page.
Using Firebug Lite Firebug can be used for other browsers as well and in turn to test XPath on other browsers.......
Fork me on GitHub