简体   繁体   English

哪些插件用于在Google Chrome浏览器中查找定位器?

[英]Which plug-ins used to find locators in Google Chrome Browser?

Hi i am new to Selenium WebDriver. 嗨,我是Selenium WebDriver的新手。 i have some small doubts. 我有一些小疑问。 (1). (1)。 In Firefox Browser we used to find locators by Firebug plug-ins. 在Firefox浏览器中,我们曾经使用Firebug插件来查找定位器。 Likewise is there any options for Google Chrome Browser. 同样,Google Chrome浏览器也有任何选项。 (2). (2)。 Which locator is much fast while executing the scripts. 执行脚本时,哪个定位器速度更快。

As mentioned in comments, hit F12 for Developer tools. 如评论中所述,为开发人员工具点击F12。

$x("//div[@id='myId']")

If content is in an iFrame, first find the iframe element and pass that as a second parameter: 如果内容在iFrame中,请首先找到iframe元素并将其作为第二个参数传递:

myframe = document.getElementsByTagName("iframe")[0].contentWindow.document.body;
$x("//div[@id='myId']", myframe)

CSS selectors can also be checked by using: CSS选择器也可以通过以下方式检查:

$$("#mycssSelector")

Credit to this answer which I have bookmarked and use regularly: How to search DOM elements using XPath or CSS selectors in Chrome Developer Tools? 归功于我已为该书签添加书签并经常使用的答案: 如何在Chrome开发者工具中使用XPath或CSS选择器搜索DOM元素?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM