

Now, if you hover over any web element on the page, it gets highlighted. Now, you can see the Dev Tools at the bottom of your page.

Using Inspector to get locatorsįirst, Navigate to the web page to be tested and launch the developer tool.Ĭonsider the facebook login page and select the Developer tools from Chrome settings or use the shortcut Ctrl+Shift+I Now, let’s see step by step how you can use the inspector in developer tool of your browser to get these locators.
#HTML INSPECTOR ERROR FINDER CODE#
Writing the XPath/CSS expressions are preferred at times because while copying the path using the developer tools if you are getting the absolute path, there are chances that your code might break if the structure of page changes later. For XPath and CSS, there is option to copy them using the inspector or you can also write XPath and CSS selector for the element by yourself and verify if it is correct in the Dev tool of the browser. The attribute based locators can be found by directly inspecting the web element in html code of the page. XPath and CSS are structure based locators which relies on the structure of page to find elements. The locators like ID, Name, ClassName, TagName, and LinkText are attribute based as it relies on the attributes of elements for locating elements. The locators used by Selenium can be classified broadly as attribute based locators and structure based locators. Steps are almost same in all the browsers.

#HTML INSPECTOR ERROR FINDER HOW TO#
In this article we would be covering, how to find the locators using web inspector. Hence we are skipping these add-ons in our article. The new version of Firefox does not support these add-ons, but has all the capabilities of these add-ons in its developer tool. But, from Nov’17 Firebug and Firepath tools have been retired. For this, we can use the built in browser inspectors of your browsers or add- ons like Firebug or Firepath for Firefox. This article, we will be seeing how we get the locator values from the html snippet of your web page. In our article on ‘Locators used in Selenium for Object Identification’, we saw the different locators that can be used to identify web elements on a web page and the use of findElement() method for the locators.
