Since selenium is open source code and API based automation (i.e. Selenium is not a software tool instead we write Selenium code in Eclipse IDE developers tool), it doesn't provide any built-in spy kind of tools to find out the locators. So different types of browsers use different methods to identify the locators.
Lets find out how the following browsers finds out the locators of the UI element:
Firefox Browser -
- Prerequisite - Install FireBug AddOn for FireFox Browser as explained in Post#3 Install FireBug Addon for Firefox
- Find out the locator say 'ID' using the FireBug option in the example explained in Post#4 How to use FireBug?
- Prerequisite - Install FirePath AddOn for FireFox Browser as explained in Post#5 Install FirePath AddOn for Firefox
- Find out the locator say 'XPath' using the FireBug and FirePath options in the example explained in Post#6 How to use Firepath?
Internet Explorer Browser -
- Do we have to install anything in Internet Explorer? The Answer is No. Starting from Internet Explorer 7 to the latest version of the browser, IE Developer Tools are inbuilt in the IE browser.
- Open www.google.com in any Internet Explorer Browser as shown in the screenshot
3. Press 'F12' key on your keyboard
4. Ensure that 'IE Developer Tools' are displayed in the IE browser window as shown below
5. At this point I would like to say that 'IE Developers Tools' shown above are used to identify the locators while using the IE Browser. I am not going to explain how to identify the locators using the 'IE Developers Tools' as in all the cases I use Firefox browser's FireBug and FirePath Tools to find out the locators.
Chrome Browser -
- Do we need to install anything in Chrome Browser? The Answer is No. 'Google Chrome Developer Tools' are inbuilt in the Chrome Browser
- Open www.google.com in the chrome browser
- Press 'F12' on your keyboard
- Ensure that 'Google Chrome Developer Tools' are displayed in the Chrome Browser as shown below
5. At this point I would like to say the 'Google Chrome Developer Tools' shown above are used to identify the locators while using the Chrome Browser. I am not going to explain how to identify the locators using the 'Google Chrome Developer Tools' as in all the cases I use Firefox browser's FireBug and FirePath Tools to find out the locators.
How to find out the different types of locators for the UI elements on the page using the Firefox Browser's 'FireBug' and 'FirePath' Tools will be explained in the upcoming posts.
Please comment below to feedback or ask questions.
How to locate the UI elements by ID will be explained in the next post.
Please comment below to feedback or ask questions.
How to locate the UI elements by ID will be explained in the next post.