由于FF 56不再是FireBug,如何检查Selenium v​​3.6的元素? [英] How to inspect element for Selenium v3.6 as FireBug is not an option any more for FF 56?

查看:98
本文介绍了由于FF 56不再是FireBug,如何检查Selenium v​​3.6的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种将FireBug用于FF的方法.不幸的是,selenium v3.6不支持它.如果我必须定位元素怎么办,检查"元素就足够了吗?

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?

推荐答案

如果您访问GitHub页面 "nofollow noreferrer> FirePath ,它明确提到:

If you visit the GitHub Page of FirePath, it clearly mentions that :

FirePath是Firebug扩展,它添加了一个开发工具来编辑,检查和生成XPath表达式和CSS3选择器

FirePath is a Firebug extension that adds a development tool to edit, inspect and generate XPath expressions and CSS3 Selectors

现在,如果您访问 FireBug 主页,它显然会提到:

Now if you visit the Home Page of FireBug, it clearly mentions that :

不再开发或维护Firebug扩展.我们邀请您使用Firefox DevTools,它随Firebug一起提供.

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.

因此明确的方向是,我们必须使用与Mozilla Firefox 56.x +发行版及更高版本集成的开发工具.

So the direction is clear that, we have to use Development Tools which comes integrated with the Mozilla Firefox 56.x + release onwards.

现在,让我们假设我们必须识别 Google主页上搜索框 xpath cssSelector em> https://www.google.com/.

Now, let us assume we have to identify the xpath or cssSelector of the Search Box on Google Home Page https://www.google.com/.

  1. 打开 Mozilla Firefox Google Chrome 浏览器,然后浏览到URL https://www.google.co.in
  2. F12 Ctrl + Shift + I 打开开发人员工具
  3. 开发人员工具控制台中,在元素选项卡中,单击 Inspector 鼠标悬停 em>搜索框和与搜索框有关的 WebElement
  1. Open Mozilla Firefox or Google Chrome browser and browse to the url https://www.google.co.in
  2. Press F12 or Ctrl+Shift+I to open the Developer Tools
  3. 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.

  1. HTML DOM 中,您可以右键单击,然后将鼠标悬停在Copy项上的鼠标上上,您可以单击以下子菜单项之一:

  1. 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:要复制 CssSelector (绝对)
  • Copy XPath:复制 XPath (绝对)
  • Copy selector: To copy the CssSelector (absolute)
  • Copy XPath: To copy the XPath (absolute)

快照:

引用复制的 CssSelector XPath ,您还可以构造逻辑上唯一的 XPath CssSelector .

Referring the copied CssSelector or XPath you can also construct a logical unique XPath or a CssSelector.

要测试自己编写的 XPath ,请在 Developer Tools 控制台中单击Console选项卡,然后在编辑器中粘贴逻辑唯一的 xpath ,您已采用以下格式构建并点击 Enter Return :

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']")

示例:

要测试自己编写的 CssSelector ,请在 Developer Tools 控制台中单击Console选项卡,然后在编辑器中粘贴逻辑唯一的 cssSelector ,您已采用以下格式构建并点击 Enter Return :

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']")

示例:

这篇关于由于FF 56不再是FireBug,如何检查Selenium v​​3.6的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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