passing xpath generated by firebug (firepath) to a javascript function

227 views
Skip to first unread message

Syed Adnan Kamili

unread,
Feb 11, 2014, 1:24:21 AM2/11/14
to fire...@googlegroups.com
I am doing some xpath related work, where a user should click any dom element and its xpath should get generated. Currently, I am using Firebug (firepath), but I need to remove the process of copy pasting the firepathg xpath (for automation purpose) and instead pass it to a javascript function when xpath is generated after the click. Is it possible at all, can someone guide me in the right direction on how to accomplish it.

Pierre Tholence

unread,
Feb 17, 2014, 10:30:40 PM2/17/14
to fire...@googlegroups.com
Hi Adnan,

I think your best option here is to attach a click listener on the document and then reuse the same function used by Firepath to generate the XPath from the element that was clicked. You can then pass the generated XPath to a javascript function.

You can find the function used by Firepath to generate the XPath in FirePathPanel.js (https://firepath.googlecode.com/svn/trunk/content/FirePathPanel.js). Search for:  getXPathFromNode.

Regards,
Pierre


On Tue, Feb 11, 2014 at 1:24 AM, Syed Adnan Kamili <adnan....@gmail.com> wrote:
I am doing some xpath related work, where a user should click any dom element and its xpath should get generated. Currently, I am using Firebug (firepath), but I need to remove the process of copy pasting the firepathg xpath (for automation purpose) and instead pass it to a javascript function when xpath is generated after the click. Is it possible at all, can someone guide me in the right direction on how to accomplish it.

--
You received this message because you are subscribed to the Google Groups "FirePath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firepath+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Syed Adnan Kamili

unread,
Feb 18, 2014, 1:08:38 AM2/18/14
to fire...@googlegroups.com


Thanks I did  the same at the end.

stopInspecting: function(inspectingNode, cancelled) {
this.inspecting = false;
        latestXpath = getXPathFromNode(inspectingNode);
       ... 

Dip Ranjan Chatterjee

unread,
Sep 13, 2015, 1:50:51 PM9/13/15
to FirePath
Hi,

I am totally new to this thing. I have the exact same problem that you had. I want to take the xpath of the clicked object and store it in js and maybe later write it to an excel. Can you please give me some more details of what you did to get it done.
Will copying the getXPathFromNode from the firepath code do? How did you get the xpath of the elements you clicked.

Sorry for asking so many questions, but I am a newbie and having difficulty replicating this. Any help will be appreciated.
Reply all
Reply to author
Forward
0 new messages