{"id":5029,"date":"2025-12-09T15:39:08","date_gmt":"2025-12-09T15:39:08","guid":{"rendered":"https:\/\/testgrid.io\/blog\/?p=5029"},"modified":"2025-12-09T15:40:22","modified_gmt":"2025-12-09T15:40:22","slug":"xpath-in-chrome-for-selenium","status":"publish","type":"post","link":"https:\/\/testgrid.io\/blog\/xpath-in-chrome-for-selenium\/","title":{"rendered":"What is XPath in Selenium and How to Find in Chrome"},"content":{"rendered":"\n<p>If you are searching for how to find XPath in Chrome for Selenium, you have landed on the correct article.<\/p>\n\n\n\n<p>XPath is one of the most powerful and flexible ways to locate web elements in Selenium, especially when other locators (ID, name, class, CSS) fall short. Whether you&#8217;re automating a complex UI, handling dynamic elements, or validating large DOM structures, the right XPath ensures reliable test automation.<\/p>\n\n\n\n<p>We propose that you practice finding XPath in the Chrome browser as much as possible because you will be required to locate XPath in the Chrome browser only when taking any company technical test.<\/p>\n\n\n\n<p>If the elements are not identified by the generic locators like id, class, name, and so on, XPath is used to find them on the web page in Selenium automation.<\/p>\n\n\n\n<p>And so, in this article, let&#8217;s discuss: <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>What is XPath?<\/strong><\/li>\n\n\n\n<li><strong>How to find XPath in Chrome for Selenium?<\/strong><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">What is XPath in Selenium?<\/h2>\n\n\n\n<p>XPath (XML Path Language) is a query language used to navigate through XML\/HTML documents. With XPath, Selenium can locate elements based on:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Node hierarchy<\/li>\n\n\n\n<li>Relationships between elements<\/li>\n\n\n\n<li>Attributes<\/li>\n\n\n\n<li>Text content<\/li>\n\n\n\n<li>Partial matches<\/li>\n\n\n\n<li>Dynamic patterns<\/li>\n<\/ul>\n\n\n\n<p>Compared to CSS selectors, XPath can traverse both forward and backward in the DOM, making it particularly useful for dynamic and deeply nested structures.<\/p>\n\n\n\n<p>In Selenium, the basic XPath format is: <\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>xpath=\/\/tagname&#91;@Attribute=\u2019Value\u2019]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Why Use XPath in Selenium?<\/h2>\n\n\n\n<p>XPath is useful when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>IDs are auto-generated or dynamic<\/li>\n\n\n\n<li>Elements don&#8217;t have stable attributes<\/li>\n\n\n\n<li>You need to locate elements relative to other elements<\/li>\n\n\n\n<li>Handling complex DOMs (iframes, custom components, shadow roots*)<\/li>\n\n\n\n<li>Working with text-based selections<\/li>\n<\/ul>\n\n\n\n<p>XPath isn\u2019t always the first choice, but it becomes the best choice when you need your tests to be flexible.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Types of XPath<\/h2>\n\n\n\n<p>XPath comes in two main forms:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Absolute XPath<\/h3>\n\n\n\n<p>Starts from the root (HTML) and traverses the entire DOM.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>html\/body\/div[2]\/div[1]\/ul\/li[3]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Pros:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Direct and straightforward<\/li>\n<\/ul>\n\n\n\n<p><strong>Cons:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Breaks easily if UI changes<\/li>\n\n\n\n<li>Too long and brittle<\/li>\n<\/ul>\n\n\n\n<p>Use only for debugging, not automation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Relative XPath<\/h3>\n\n\n\n<p>Starts from anywhere in the DOM.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\/\/input[@id=&#8217;username&#8217;]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Pros:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Shorter<\/li>\n\n\n\n<li>More stable<\/li>\n\n\n\n<li>Best practice for automation<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Static vs Dynamic XPath<\/h2>\n\n\n\n<p>Most of the UIs these days generate dynamic IDs that change in intervals or when there is a page refresh. In such scenarios, the Dynamic XPath in our test scripts ensures test robustness.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Static XPath<\/h3>\n\n\n\n<p>It uses fixed attribute values to locate the elements. <\/p>\n\n\n\n<p><strong>For example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\/\/button[@id=&#8217;loginBtn&#8217;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Dynamic XPath<\/h3>\n\n\n\n<p>It uses patterns, partial matches, and conditions to locate the elements on the web page. <\/p>\n\n\n\n<p><strong>For example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\/\/button[contains(@id, &#8216;login&#8217;)]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can use dynamic XPath in below scenarios:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>IDs include hashes (e.g., \u201cusername_123\u201d)<\/li>\n\n\n\n<li>React\/Angular\/Vue renders a dynamic DOM<\/li>\n\n\n\n<li>Elements change positions<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">XPath vs CSS Selector<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Feature<\/th><th class=\"has-text-align-left\" data-align=\"left\">XPath<\/th><th class=\"has-text-align-left\" data-align=\"left\">CSS<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">Navigate backward in the DOM<\/td><td class=\"has-text-align-left\" data-align=\"left\">Yes<\/td><td class=\"has-text-align-left\" data-align=\"left\">No<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Performance<\/td><td class=\"has-text-align-left\" data-align=\"left\">Slightly Slower<\/td><td class=\"has-text-align-left\" data-align=\"left\">Faster<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Select By Text<\/td><td class=\"has-text-align-left\" data-align=\"left\">Yes<\/td><td class=\"has-text-align-left\" data-align=\"left\">No<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Readability<\/td><td class=\"has-text-align-left\" data-align=\"left\">Medium<\/td><td class=\"has-text-align-left\" data-align=\"left\">High<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Best For<\/td><td class=\"has-text-align-left\" data-align=\"left\">Dynamic\/Complex DOM<\/td><td class=\"has-text-align-left\" data-align=\"left\">Stable, attribute-rich DOM<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to Find XPath in Chrome (Step-by-Step)<\/h2>\n\n\n\n<p>The steps below will guide you on inspecting an element and finding the XPath of an element on a web page in Chrome for a <a href=\"https:\/\/testgrid.io\/blog\/selenium-webdriver\/\" data-type=\"link\" data-id=\"https:\/\/testgrid.io\/blog\/selenium-webdriver\/\">Selenium WebDriver<\/a> script:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Launch the Chrome browser and navigate to the URL or webpage.<\/li>\n\n\n\n<li>Hover the mouse over the desired element (object) on the web page, right-click on the element you are looking for XPath, and select &#8220;Inspect.&#8221;<\/li>\n\n\n\n<li>The elements panel will now appear on the right-hand side of the screen. The HTML code of the element will be highlighted in blue in this frame.<\/li>\n\n\n\n<li>In the panel, press &#8216;ctrl+F&#8217; to enable DOM searching.<\/li>\n\n\n\n<li>In the panel, you can now use XPath to evaluate that element.<\/li>\n\n\n\n<li>If XPath matches any elements, they will be highlighted in yellow in the DOM.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Example &#8211; Writing XPath for Input Fields<\/h3>\n\n\n\n<p><strong>Step 1:<\/strong> Right-click on the element (First name) and select the Inspect option, as shown below.<\/p>\n\n\n\n<p><strong>Step 2:<\/strong> You should now be able to see the HTML code for the &#8220;First name&#8221; element in the blue strip. As shown below, to enable DOM searching in the panel, press &#8216;Ctrl+F&#8217;.<\/p>\n\n\n\n<p><strong>Step 3:<\/strong> Write the XPath of any element using the basic format. The XML path syntax determines the path of an element on a webpage. The following is the standard syntax for creating XPath:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>XPath = \/\/tagname&#91;@Attribute = 'Value']<\/code><\/pre>\n\n\n\n<p><strong>Here&nbsp;<\/strong><\/p>\n\n\n\n<p><strong>\/\/ <\/strong>\u27a8&nbsp; It is used to select the current node in the entire document.<\/p>\n\n\n\n<p>tag name \u27a8 It is the name of the tag of a particular node. For example, input.<\/p>\n\n\n\n<p>@ \u27a8 It selects attributes like id, name, className, etc.<\/p>\n\n\n\n<p>Attribute \u27a8 It is the node\u2019s attribute name. For example, type, class, name, id, etc.<\/p>\n\n\n\n<p>Value \u27a8 It is the value of an attribute.<\/p>\n\n\n\n<p>In the same way, we can write XPath for different elements. Let&#8217;s see more examples.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample XPath Examples<\/h3>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>1. XPath(Surname): \/\/input&#91;@name = \u2018lastname\u2019] (1 of 1 matched)\n2. XPath(New password): \/\/input&#91;@data-type = \u2018password\u2019] (1 of 1 matched)\n3. XPath(Female Radio button): \/\/input&#91;@id = \u2018u_0_8\u2019]\n4. XPath(Sign Up): \/\/button&#91;@name = \u2018websubmit\u2019]&nbsp;\n5. XPath(Facebook logo): \/\/img&#91;@class = \u2018fb_logo img sp_XWJdzZnoeA1 sx_ba923f\u2019]&nbsp;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Simple Steps to Find XPath in Microsoft Internet Explorer Browser:<\/h2>\n\n\n\n<p>Microsoft Internet Explorer, like Google Chrome, has an in-built feature for inspecting web page elements. <\/p>\n\n\n\n<p>To view the HTML code of a component on a web page in Internet Explorer, follow the given steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Pressing the F12 key will launch Developer Tools. The developer tools menu will be displayed.<\/li>\n\n\n\n<li>Click the pointer icon or press &#8216;Ctrl+Shift+C&#8217; and move the cursor over the desired element on the page&#8217;s HTML code to inspect the element.<\/li>\n\n\n\n<li>The developer tool will highlight elements&#8217; HTML code with a blue outline.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Advanced XPath Functions in Selenium<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Basic XPath:<\/strong> An essential XPath expression determines nodes or a list of nodes based on attributes, such as Name, Id, Classname, etc.<\/li>\n\n\n\n<li><strong>Contains():<\/strong> Contains() is an XPath expression method. It is used when the value of any attribute, such as login information, changes dynamically.<\/li>\n\n\n\n<li>The element with partial text can be found using the contains() feature.<\/li>\n\n\n\n<li><strong>Using OR(|) &amp; AND(and) Operator:<\/strong> These operators can be applied in an XPath expression when two conditions are used to determine if either of the conditions is true. At least one of the conditions must be met to find the element.<\/li>\n<\/ol>\n\n\n\n<p><em>&#8220;OR&#8221; is used when either of the conditions is true<\/em>.<\/p>\n\n\n\n<p><em>&#8220;AND&#8221; is used when both are true.<\/em><\/p>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li><strong>Xpath Starts-with():<\/strong> It is a function used to find the web element whose attribute value changes when the page or other dynamic operations occur. The text at the start of the attributes\u2019 value is matched in this method to find the element whose attribute value changes dynamically. You can also find elements with static attribute values.<\/li>\n<\/ol>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li><strong>Text() Function in XPath:<\/strong><br>The XPath text() function is a Selenium web driver built-in function used to locate elements based on the text of a web element. It aids in identifying specific text elements and the location of those elements within the set of text nodes. Therefore, the elements that need to be found should be in string form.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">What are the XPath Axes in Selenium?<\/h2>\n\n\n\n<p>In Selenium, XPath uses Absolute and Relative paths to locate web elements. Furthermore, all web elements in the XML DOM are linked to one another via a hierarchical structure.&nbsp;<\/p>\n\n\n\n<p>For example, XPath provides &#8220;XPath Axis&#8221; attributes, which use the relationship between various nodes to locate those nodes in the DOM structure.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ancestor Axis:<\/h3>\n\n\n\n<p>In XPath, the ancestor axis helps to select all of the current node&#8217;s parent elements. It is helpful in situations where we can identify the child element node but not its parent or grandparent nodes.&nbsp;<\/p>\n\n\n\n<p>In such cases, we can use the child node as a reference point and the &#8220;ancestor&#8221; axis to identify the parent node.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>Syntax\n\/\/tagname&#91;@attribute ='Attribute_Value']\/ancestor::parent_node<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Child Axis:<\/h3>\n\n\n\n<p>In XPath, the Child Axis is used to find all the child nodes of the current node. In contrast to the ancestor axis, the child axis helps locate elements if the parent element of the required node can be found.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>Syntax\n\/\/tagname&#91;@attribute ='Attribute_Value']\/child::child_node<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Descendant Axis:<\/h3>\n\n\n\n<p>The Descendant Axis lets you access all of the current node&#8217;s children and sub-children. The main difference between a child axis and a descendant axis is that the child axis locates only immediate child nodes. In contrast, the descendant axis can locate children and grandchildren nodes.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>Syntax\n\/\/tagname&#91;@attribute ='Attribute_Value']\/descendant::attribute<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Parent Axis:<\/h3>\n\n\n\n<p>The Parent Axis resembles the Ancestor Axis in appearance. It recognises the current node&#8217;s immediate parent.\u00a0<\/p>\n\n\n\n<p>The main distinction between parent and ancestor is that the ancestor axis will locate all upper hierarchical nodes, whereas the parent axis will only locate the immediate parent node.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>Syntax\n\/\/tagname&#91;@attribute ='Attribute_Value']\/ancestor::parent_node<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Following Axis:<\/h3>\n\n\n\n<p>The elements after the current node can be located with the following axis. It sets the current node as the base and searches the DOM for the required element after the current node.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>Syntax\n\/\/node&#91;@attribute='value of attribute']\/following::attribute<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Following-Sibling Axis:<\/h3>\n\n\n\n<p>The following-sibling axis is similar to the XPath following axis. Only sibling nodes, i.e., nodes on the same level as the current node, are recognised by the following sibling.\u00a0<\/p>\n\n\n\n<p>For example, in the image below, both the highlighted &#8220;divs&#8221; are on the same level, i.e., are siblings, whereas the &#8220;div&#8221; just above them is the parent.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"background-color:#373333\"><code>Syntax\n\/\/node&#91;@attribute='value_of_attribute']\/following-sibling::attribute<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong><strong>Read also: <\/strong><\/strong><a href=\"https:\/\/testgrid.io\/blog\/challenges-in-test-automation\/\" target=\"_blank\" rel=\"noreferrer noopener\">Challenges in Automation Testing<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Top 10 XPath Finder Chrome Extensions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. SelectorsHub<\/h3>\n\n\n\n<p>In less than 5 seconds, <strong>XPath in Chrome<\/strong> and a CSS selector could be returned. The selector&#8217;s hub auto-suggests all attributes, text, and everything for quickly completing selectors.&nbsp;<\/p>\n\n\n\n<p>We no longer need to copy and paste attribute values from the DOM when creating XPath and CSS selectors.&nbsp;<\/p>\n\n\n\n<p>It also supports ShadowDOM, iframe, and SVG elements. Finally, because it is the only tool that helps shadow dom selectors, it also provides a proper error message indicating what is wrong with the XPath and CSS selector.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. XPath Helper<\/h3>\n\n\n\n<p>Using the XPath helper on any web page, we can easily select, edit, and evaluate XPath queries.&nbsp;<\/p>\n\n\n\n<p>It&#8217;s easy to use and has a more extensive user base than the other plugins on this list. So, for example, to write or edit XPath, we must first open the console by clicking on the extension.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. ChroPath<\/h3>\n\n\n\n<p>This extension generates and validates unique selectors, such as relative XPath, absolute XPath, CSS selectors, link text, and partial link text, with just one click. It makes writing, editing, extracting, and evaluating XPath queries on any web page a breeze.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Scraper<\/h3>\n\n\n\n<p>It obtains information from web pages and into spreadsheets. It&#8217;s a simplified version of data mining that speeds up online analysis.&nbsp;<\/p>\n\n\n\n<p>It&#8217;s designed to be a simple tool for intermediate and advanced XPath users.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Relative XPath Helper<\/h3>\n\n\n\n<p>Two web elements&#8217; relative XPath expressions are defined using the relative XPath Helper. Then, simply right-click on the first and second elements to get the relative XPath.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. XPath Helper Wizard<\/h3>\n\n\n\n<p>XPath Helper Wizard creates short paths that don&#8217;t split as the website grows. For example, all XPaths linked to XPath are created if the XPath parent contains an XPath.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. XPath Finder<\/h3>\n\n\n\n<p>XPath Finder in Chrome DevTools locates XPath components. It highlights the corresponding elements with highlighted contours and context and records the XPath history.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8. XPather<\/h3>\n\n\n\n<p>This add-on only affects the current document. The XPath 2.0 standard is supported. It displays the result and all of the matched nodes in the sidebar. The matched node can be found on the page by clicking on the sidebar.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">9. Eskry<\/h3>\n\n\n\n<p>It aids in the creation of locators for HTML elements using the point and grabs method. By clicking on any web element on your Web page, you can create an XPath\/CSS Selector.<\/p>\n\n\n\n<p>You can also check out our ultimate guide on <a href=\"https:\/\/testgrid.io\/blog\/selenium-locators\/\">locators in Selenium<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">10. Firebug Lite for Google Chrome<\/h3>\n\n\n\n<p>Firebug Lite isn&#8217;t a replacement for Firebug or Chrome developer tools. Instead, it provides a comprehensive view of HTML, DOM, and Box model shading components. It even looks for HTML components with the mouse.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In Selenium, XPath is one of the simplest ways to find WebElement positions. In XPath expressions, you can include highly complex and delicate artefacts.&nbsp;<\/p>\n\n\n\n<p>You must first define the WebElements and their actions before automating any web program. We hope this tutorial has covered all of the essential aspects of finding XPath in Chrome.<\/p>\n\n\n\n<p>So now, click here to know more about <a href=\"http:\/\/testgrid.io\/\">TestGrid.io<\/a>, and also, to read more articles, <a href=\"https:\/\/testgrid.io\/blog\/\">head over to our blog section.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions (FAQs)<\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1650613797561\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>I want one web element of XPath through Chrome only. How can I find an XPath?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>To find the XPath of an Element, use Chrome&#8217;s built-in Developer Tools.<br \/>1. Right-click the web element in Chrome and select Inspect.<br \/>2. It will launch the Developer tool with highlighted Element\u2019s HTML code.<br \/>3. Copy Xpath by right-clicking the highlighted HTML.<br \/>4. Use the copied XPath to locate this Element in Chrome later.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1650613843991\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>How do I get an absolute XPath in Chrome?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>To get the absolute XPath in Chrome, follow these steps:<br \/>1. Open the Chrome browser on your PC.<br \/>2. Open the particular URL for which you want to get the absolute XPath.<br \/>3. Right-click on the logo and inspect it. It will highlight the HTML code of the web element.<br \/>4. Hover your mouse pointer on \u2018Copy.\u2019 Two options will appear:\u00a0<br \/>Copy selector: It will give you a CSS selector.\u00a0<br \/>Copy XPath: It will provide you with XPath.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1650613961589\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>What is the best XPath extension for Chrome?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>There are a ton of Chrome extensions available in the market today, like SelectorsHub, RexPath, XPath Finder, XPath Helper, Scraper, Firebug Lite for Chrome, TruePath, XPath Helper Wizard, and many more.<br \/>You may choose any one, as almost each of these Chrome extensions works the same way to serve individual purposes.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Searching for XPath In Chrome For Selenium? Get all your answers with a step-by-step explanation in this article, starting from the very basics.<\/p>\n","protected":false},"author":10,"featured_media":16402,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[88],"tags":[460,476],"class_list":["post-5029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","tag-xpath","tag-xpath-in-chrome"],"acf":[],"images":{"medium":"https:\/\/testgrid.io\/blog\/wp-content\/uploads\/2025\/06\/How_to_Find_XPath_in_Chrome_For_Selenium-300x169.webp","large":"https:\/\/testgrid.io\/blog\/wp-content\/uploads\/2025\/06\/How_to_Find_XPath_in_Chrome_For_Selenium-1024x576.webp"},"_links":{"self":[{"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/posts\/5029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/comments?post=5029"}],"version-history":[{"count":19,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/posts\/5029\/revisions"}],"predecessor-version":[{"id":16404,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/posts\/5029\/revisions\/16404"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/media\/16402"}],"wp:attachment":[{"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/media?parent=5029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/categories?post=5029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/testgrid.io\/blog\/wp-json\/wp\/v2\/tags?post=5029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}