XPath Forte

Locators that survive deploys

XPath Forte is a free Chrome extension. Click any element to get its XPath, CSS and Playwright locators, scored 0–100, best first.

Start your free trial

Work email

you@company.com

Company

 

Create account

XPath Forte <button>

Best Locator

//button[normalize-space(.)='Create account']
1 matchStableXPathCopy

Recommended

//button[normalize-space(.)='Create account']
1 matchStable

Attribute based

//button[@type='submit']
1 matchStable
//*[contains(@type, 'submit')]
1 matchStable

Context-aware

//main//button[normalize-space(.)='Create account']
1 matchModerate
//button[contains(concat(" ", normalize-space(@class), " "), ' btn ') and normalize-space(.)='Create account']
1 matchModerate

Ship a new build. See what holds.

This form runs the real XPath Forte engine in your browser. Edit its markup, or ship a build the way your framework does: new generated ids, reshuffled classes, an extra wrapper.

Build 1. Click any part of the form.

XPath Forte <button>

The panel, part by part

XPath Forte <input>
//input[@name='email'] Test

1 match

Best Locator

//input[@id='email']
1 matchStableXPath

Recommended

//*[@id='email']
1 matchStable
//input[@id='email']
1 matchStable

Attribute based

//input[@id='email' and @name='email']
1 matchStable
//input[@name='email']
1 matchStable

Context-aware

//main//input[@name='email']
1 matchStable
XPath Forteby Sam

How it works

  1. Click the icon, then point.

    Whatever is under the cursor lights up, including elements inside iframes and open Shadow DOM.

  2. Press Space for hover menus.

    A click picks the element. Space or Enter picks it without moving the mouse, so the menu stays open.

  3. Copy the one on top.

    Copying keeps the panel open and drops the locator into the test box, so you can check it on the spot.

  4. After a deploy, check them all.

    Paste your suite’s selectors into Heal, or the page object itself, and verify them in one go. Broken ones get a suggested fix. Scan lists every control on the page with its best locator.

DocsPricingAccount

Plans for every team

StarterTeamScale
DocsPricingAccount
Space
XPath Forte <a>
//a[normalize-space(.)='Sign out'] Test

1 match

Best Locator

//a[normalize-space(.)='Sign out']
1 matchStableXPathCopied

Accessibility

getByRole('link', { name: 'Sign out', exact: true })
1 matchStable
XPath Forte
Verify All
  • //a[normalize-space(.)='Sign out']Unique
  • getByRole('button', { name: 'Create account' })Unique
  • #nav .menu-item3 matches
  • //button[@id='j_idt88:submit']No match

13 hard targets. 12 verified unique.

Add to Chrome

The scorecard runs the generator functions the panel uses against markup built to trip locator tools. Each row is the locator it recommends and the score it gives. The thirteenth target sits in Shadow DOM, where no runner can push an XPath through, so it recommends a Playwright locator instead.

  • 92Its only id is a JSF artifact, j_idt88:email//input[@name='email']Stable, 1 match
  • 92Angular _ngcontent attributes and no id//button[normalize-space(.)='Save changes']Stable, 1 match
  • 92Eight utility classes that reorder every build//button[normalize-space(.)='Subscribe now']Stable, 1 match

Paste them into SeleniumPlaywrightWebdriverIOCypressPuppeteerRobot Framework

Questions

Yes. It’s free on the Chrome Web Store, with no account to create.

No. Locators are generated inside the tab you’re inspecting. There are no analytics, no tracking and no account.

activeTab, scripting, contextMenus and alarms. There are no host permissions, so it only touches a page after you click the icon or the menu item.

Tabs that were open before you installed it need one reload to load the extension. After that it works on every page you open.

Yes. Elements in nested frames are picked inside their own frame, and the panel shows the frame chain to switch into; Playwright locators come wrapped in frameLocator(). Frames from other sites work once you allow them in Settings. In Shadow DOM, open or closed, it recommends Playwright or piercing CSS with >>>, never an XPath a runner can’t push through the shadow root.

Hover it, then press Space or Enter. You never move the mouse to click, so the menu stays open while it’s picked.

That’s the Heal tab. Paste them one per line, or paste your test code as it is (By.xpath(…), @FindBy, page.getByRole(…), cy.get(…)), and press Verify All. For any that broke, Suggest fix shows the element it most likely meant and a fresh locator for it.

Chrome, and other Chromium browsers that install extensions from the Chrome Web Store.

Install it, open your flakiest page, and click the element that keeps breaking.