如何检查 Selenium v3.6 的元素,因为 FireBug 不再是 FF 56 的选项? [英] How to inspect element for Selenium v3.6 as FireBug is not an option any more for FF 56?
问题描述
我正在尝试找到一种将 FireBug 用于 FF 的方法.不幸的是,selenium v3.6
不支持它.如果我必须找到元素,可以做些什么,检查"元素就足够了吗?
如果我减少 selenium 的版本,会有帮助吗?
如果你访问 中,您可以右键单击 并在 鼠标悬停 上 Copy
项上,您可以单击以下任一子菜单项:
复制选择器
:复制CssSelector(绝对)Copy XPath
:复制XPath(绝对)
快照:
其他步骤
引用复制的CssSelector或XPath你也可以构造一个逻辑唯一的XPath或一个CssSelector.
<小时>测试您自己的 XPath
要测试您自己编写的 XPath,请在 Developer Tools 控制台中单击 Console
选项卡,然后在编辑器中粘贴逻辑唯一性xpath 您已按照以下格式构建并点击 Enter 或 Return:
$x("//*[@name='q']")
例子:
<小时>测试你自己的 CssSelector
要测试您自己编写的 CssSelector,请在 Developer Tools 控制台中单击 Console
选项卡,然后在编辑器中粘贴逻辑唯一性cssSelector 您已按以下格式构建并按 Enter 或 Return:
$$("[name='q']")
例子:
I am trying to find a way to use FireBug for FF. Unfortunately it's not supported for selenium v3.6
. What can be done if I have to locate the elements, will "Inspect" element will be sufficient?
If I get down to less version of selenium, will that help?
If you visit the GitHub Page of FirePath, it clearly mentions that :
FirePath is a Firebug extension that adds a development tool to edit, inspect and generate XPath expressions and CSS3 Selectors
Now if you visit the Home Page of FireBug, it clearly mentions that :
The Firebug extension isn't being developed or maintained any longer. We invite you to use the Firefox DevTools instead, which ship with Firebug next.
So the direction is clear that, we have to use Development Tools which comes integrated with the Mozilla Firefox 56.x + release onwards.
Example Usage :
Now, let us assume we have to identify the xpath or cssSelector of the Search Box on Google Home Page https://www.google.com/
.
- Open Mozilla Firefox or Google Chrome browser and browse to the url
https://www.google.co.in
- Press F12 or Ctrl+Shift+I to open the Developer Tools
- Within the Developer Tools console, with in the Elements tab, once you click on the Inspector and mouse hover the Search Box and the WebElement pertaining to the Search Box gets highlighted within the DOM Tree.
Within the HTML DOM you can right click and on mouse hover over
Copy
item you can clck on either of the following sub menu item:Copy selector
: To copy the CssSelector (absolute)Copy XPath
: To copy the XPath (absolute)
Snapshot:
Additional Steps
Referring the copied CssSelector or XPath you can also construct a logical unique XPath or a CssSelector.
Testing your own XPath
To test your own written XPath, within the Developer Tools console, click on the Console
tab and within the editor paste the logical unique xpath you have constructed in the following format and hit Enter or Return:
$x("//*[@name='q']")
Example:
Testing your own CssSelector
To test your own written CssSelector, within the Developer Tools console, click on the Console
tab and within the editor paste the logical unique cssSelector you have constructed in the following format and hit Enter or Return:
$$("[name='q']")
Example:
这篇关于如何检查 Selenium v3.6 的元素,因为 FireBug 不再是 FF 56 的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!