如何在Chrome或Firefox中获取Absolute XPath? [英] How to get Absolute XPath in Chrome or Firefox?

查看:139
本文介绍了如何在Chrome或Firefox中获取Absolute XPath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如问题中所述,我需要绝对 Xpath,而不是相对的.

As written in the question I need the absolute Xpath and not the relative one.

我的意思是,我需要这样的东西:

I mean, I need something like this:

html/body/div[1]/section/div[1]/div/div/div/div[1]/div/div/div/div/div[3]/div[1]/div/h4[1]/b

而不是这样:

//*[@class='featured-box']//*[text()='Testing']

在两个浏览器上,当我检查代码并使用右键单击时,->复制XPath 我正在获取相对路径.

On both browsers when I inspect the code and I use right click -> copy XPath I am getting the relative Path.

请注意,我使用的是Firefox Quantum,不能使用firebug或firepath,因为它们不受支持.

Please note, I am using Firefox Quantum and I cannot use firebug or firepath because they are not supported.

推荐答案

下载此chrome扩展程序:

Download this chrome extension: https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl

然后,单击扩展名的图标,然后在选项卡窗口中出现两个框后,按住Shift键可在元素之间导航并查看xpath.

After that, click at icon of the extension and, after two boxes appers in the tab window, hold shift key to navigate between elements and see the xpath.

这篇关于如何在Chrome或Firefox中获取Absolute XPath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆