开发者

How to determine x-path of an element in Javascript?

开发者 https://www.devze.com 2022-12-12 06:17 出处:网络
I\'m adding some new functionality to a Firefox plugin that is recording actions user does in the browser. The problem is, the click handler is a little bit broken - it doesn\'t add anything to identi

I'm adding some new functionality to a Firefox plugin that is recording actions user does in the browser. The problem is, the click handler is a little bit broken - it doesn't add anything to identify a button if it has "image" type. I want to make it add a relieable piece of data to help identify the exact button user has clicked. To my knownledge, putting its XPath location is the only way to do so. So I'm looking for a way to get such value, hopefully without the need to iterate all over up to the root element.

Upd: I can't change t开发者_C百科he source code of the site


I think I know what you want now, and I guess you can see how xpather does it, but I am afraid it will do it by going through the tree to the root...

0

精彩评论

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

关注公众号