How to find Xpath using Firebug

Author: William Ramirez
Date Of Creation: 22 September 2021
Update Date: 1 July 2024
Anonim
Find XPATH using FireBug and FirePath
Video: Find XPATH using FireBug and FirePath

Content

XPath path to site elements can be found in most browsers using developer tools. Firebug for Firefox will copy the XPath directly to the clipboard. In most other browsers, the XPath path to the element can be found using the developer tools, but you will have to format it manually.

Steps

Method 1 of 4: Using Firebug in Firefox

  1. 1 Install Firebug for Firefox. Firebug is a web inspector for Firefox.
    • Click the Firefox menu button (☰) and choose Add-ons.
    • Click "Get Add-ons" - "See More Add-ons".
    • Find the Firebug extension and click Add to Firefox.
    • Confirm that you want to install Firebug and then restart Firefox (upon request).
  2. 2 Open the website you want. Firebug can be used to find an XPath path to any element in a site.
  3. 3 Click the Firebug button. It is located in the upper right corner of the browser window. The Firebug panel will open at the bottom of the Firefox window.
  4. 4 Click the item inspector button. It's in the top row of buttons in the Firebug panel (to the right of the Firebug Options button). The icon of this button looks like a rectangle with a cursor.
  5. 5 Click on the required element of the web page. As you move the cursor around the web page, the Firebug panel will highlight various elements. Stop at the element you want to know the XPath path to.
  6. 6 Right click on the highlighted code in the Firebug panel. When you click on the desired element of the web page, the corresponding code is highlighted in the Firebug panel. Right click on the highlighted code.
  7. 7 Select Copy XPath from the menu. The XPath path is copied to the clipboard.
    • If you select Copy Mini XPath from the menu, only the short XPath path is copied.
  8. 8 Paste the copied XPath where you want. The copied path can be pasted anywhere; to do this, right-click and select "Paste" from the menu.

Method 2 of 4: Using Chrome

  1. 1 Open the website you want. Chrome doesn't need any extensions to find the XPath path to any element in a website.
  2. 2 Click on F12to open the web inspector. It will appear on the right side of the window.
  3. 3 Click the item inspector button. It's in the upper left corner of the web inspector panel. The icon of this button looks like a rectangle with a cursor.
  4. 4 Click on the required element of the web page. As you move the cursor over the web page, the various elements are highlighted in the web inspector pane.
  5. 5 In the web inspector pane, right-click on the highlighted code. When you click on the desired element of the web page, the corresponding code is highlighted in the web inspector pane. Right click on the highlighted code.
  6. 6 From the menu, select Copy - Copy XPath. The XPath path of the selected item is copied to the clipboard.
    • Note that the short XPath will be copied. The extended path can be copied using the Firebug extension for the Firefox browser.
  7. 7 Paste the copied XPath path. The copied path can be pasted like any other information; to do this, right-click and select "Paste" from the menu.

Method 3 of 4: Using Safari

  1. 1 Open the Safari menu and choose Preferences. To access the web inspector, you need to activate the Develop function.
  2. 2 Click on the "Advanced" tab. Safari's advanced preferences will open.
  3. 3 Check the "Show development menu in menu bar" option. The Develop menu appears on the menu bar.
  4. 4 Open the website you want. Close Safari preferences and go to the desired website.
  5. 5 Open the Develop menu and select Show Web Inspector. The web inspector panel will open at the bottom of the window.
  6. 6 Click Start Search Item. This button has a cross-hair icon and is in the top row of buttons in the web inspector panel.
  7. 7 Click on the desired website element. The item code will be highlighted in the web inspector pane.
  8. 8 At the top of the web inspector pane, notice the XPath path. You cannot copy the XPath path, but the extended path appears above the code in the web inspector pane. Each tab is a path formula.

Method 4 of 4: Using Internet Explorer (IE)

  1. 1 Open the website you want. IE does not need any extensions to find the XPath path to any element on a website. First, open the website you want.
  2. 2 Click on F12to open developer tools. The developer toolbar appears at the bottom of the browser window.
  3. 3 Click Select Item. It's in the upper left corner of the developer toolbar.
  4. 4 Click on the required element of the web page. The element and its code are highlighted (in the developer toolbar).
  5. 5 At the bottom of the panel, notice the XPath path. Each tab (displayed at the bottom of the panel) is a formula for the path to the selected item. You cannot copy the XPath path (this can be done using the Firebug extension for the Firefox browser).