xpath in firebug

223 views
Skip to first unread message

Ambika Rajagopalan

unread,
Aug 16, 2011, 11:07:26 AM8/16/11
to seleniu...@googlegroups.com
in Firebug I am able to find absolute xpath which starts from //html.. which is not healthy to use in general. Is there any other xpath and how to find that in firebug?

Leo Laskin

unread,
Aug 16, 2011, 11:11:52 AM8/16/11
to seleniu...@googlegroups.com
Ambika,
There are multiple tools like Firefinder and Firepath that can help you, also you can figure it out yourself.

for example

//html/body/div[@id='blah]  can also be specified by //div[@id='blah'] or as just driver.findelement(:id => 'blah')

On Tue, Aug 16, 2011 at 11:07 AM, Ambika Rajagopalan <amb...@gmail.com> wrote:
in Firebug I am able to find absolute xpath which starts from //html.. which is not healthy to use in general. Is there any other xpath and how to find that in firebug?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Murali K

unread,
Aug 16, 2011, 11:16:32 AM8/16/11
to seleniu...@googlegroups.com
Ambika,

Xpath doesn't need to start with the first tag which is Html. 
In general, every element has a unique id, you can start writing xpath pointing to that ID.
If any element doesn't have the ID, then write xpath pointing to the nearest element which has the ID.

Also do explore how to use css, which will be much faster than xpath.

Thanks
Murali

On Tue, Aug 16, 2011 at 8:37 PM, Ambika Rajagopalan <amb...@gmail.com> wrote:
in Firebug I am able to find absolute xpath which starts from //html.. which is not healthy to use in general. Is there any other xpath and how to find that in firebug?

--

Deepanshu Kaushik

unread,
Aug 16, 2011, 11:20:15 AM8/16/11
to Selenium Users
You can use xpath finder, which is available as an add-on for firefox.

Mike

unread,
Aug 16, 2011, 12:04:11 PM8/16/11
to Selenium Users
Unfortunately xpath finder does not support Firefox 5. The other two
mentioned here support 5 and higher though.

Mike

On Aug 16, 8:20 am, Deepanshu Kaushik <deepanshukaush...@gmail.com>
wrote:

Paul Hammant

unread,
Aug 16, 2011, 12:39:27 PM8/16/11
to seleniu...@googlegroups.com
XPathChecker (by Brian Slesinsky) is good too.

Reply all
Reply to author
Forward
0 new messages