Hi i am new to Selenium WebDriver. i have some small doubts. (1). In Firefox Browser we used to find locators by Firebug plug-ins. Likewise is there any options for Google Chrome Browser. (2). Which locator is much fast while executing the scripts.
Asked
Active
Viewed 1,062 times
0
-
You can use the Chrome Developer Tool by pressing F12. And here is useful plugin called Xpath Finder, which is helpful if you want to check the result of your Xpath expression. Plugin link: https://chrome.google.com/webstore/detail/xpath-finder/ijaobnmmgonppmablhldddpfmgpklbfh/reviews – peetya Apr 07 '15 at 11:26
1 Answers
2
As mentioned in comments, hit F12 for Developer tools.
$x("//div[@id='myId']")
If content is in an iFrame, first find the iframe element and pass that as a second parameter:
myframe = document.getElementsByTagName("iframe")[0].contentWindow.document.body;
$x("//div[@id='myId']", myframe)
CSS selectors can also be checked by using:
$$("#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?

Community
- 1
- 1

Steve Weaver Crawford
- 1,044
- 8
- 15