有没有办法在不使用 firebug 或 xpath 的情况下学习 xpath,因为 firefox 不支持插件? [英] Is there a way to learn xpath without using firebug or xpath as firefox is not supporting the addons?

查看:25
本文介绍了有没有办法在不使用 firebug 或 xpath 的情况下学习 xpath,因为 firefox 不支持插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试广泛学习 xpath 我需要一些实用的方法,youtube 上的每个教程都建议安装 firebug,xpath checkers 在 mozilla firefox 中添加,但不幸的是 ff 作为初学者不支持它,请建议我方法动手学习.

I am trying to learn xpath extensively i need to have bit of practical approach, every tutorials on youtube suggests to install firebug, xpath checkers add ons in mozilla firefox but unfortunately ff is not supporting it as a beginner please suggest me the way to learn this hands on.

尝试下载旧版本仍然没有可用的插件或插件

tried downloading older versions still there is no addons or plugins available

推荐答案

这是适用于所有浏览器的简单方法.

Here is the simple approach that will work in all browsers.

使用控制台:适用于所有浏览器

您可以在浏览器控制台中使用$x"执行任何 xpath,如下所示.这是一般符号$x("xpath go here"),这将返回数组,所以如果你想获得第一个匹配的元素,那么你必须做这样的事情 $x(xpath 在这里")[0] 如下图所示.

You can execute any xpath using "$x" in the browser console as shown below. Here is the general notation $x("xpath goes here"), this will return the array so if you want to get the first matching element then you have to do something like this $x("xpath goes here")[0] as shown in the below image.

在 Chrome 中使用开发者工具:

如果您想使用 chrome,那么除了控制台之外,您还可以使用开发人员工具 > 元素选项卡进行 xpath 和 css 验证.

If you want to use chrome then you can use the developer tools > elements tab for xpath and css validation besides console.

在 Chrome 中按F12"打开开发人员工具,然后选择Eelements"选项卡.现在按 'Ctrl+F' 并在底部的搜索框中输入 xpath,您将在搜索框的右端看到匹配元素的数量,如屏幕截图所示.

Press 'F12' when you are in chrome to open the developer tools, then select "Eelements" tab. Now press 'Ctrl+F' and enter the xpath in the search box at the bottom, you will see the number of matching elements count at the right end of the search box as shown in the screenshot.

初学者:

正如@BillHillerman 在下面的评论中所建议的:如果您是初学者,不知道该由谁编写 xpath,那么您可以在 chrome 浏览器提供的 xpath 上进行中继.右键单击您感兴趣的元素,然后单击 Inspect.现在右键单击元素 Copy > 的 html 代码.复制 Xpath.现在您在剪贴板中有了 xpath.

As suggested by @BillHillerman in a comment below: If you are beginner does not know who to write the xpath then you can relay on the xpath that will be provided by chrome browser. Right click on element that you are interested in then click on Inspect. Now right click on the html code of the element Copy > Copy Xpath. Now you have the xpath in the clipboard for you.

Chrome 提供了 xpath:

Chrome provided xpath:

这篇关于有没有办法在不使用 firebug 或 xpath 的情况下学习 xpath,因为 firefox 不支持插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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