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']
Recommended
//button[normalize-space(.)='Create account']Attribute based
//button[@type='submit']//*[contains(@type, 'submit')]Context-aware
//main//button[normalize-space(.)='Create account']//button[contains(concat(" ", normalize-space(@class), " "), ' btn ') and normalize-space(.)='Create account']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.
<button>
The panel, part by part
<input>
//input[@name='email']
Test
1 match
Best Locator
//input[@id='email']
Recommended
//*[@id='email']//input[@id='email']Attribute based
//input[@id='email' and @name='email']//input[@name='email']Context-aware
//main//input[@name='email']Best Locator
//input[@id='email']
ID based
#emailinput#emailAttribute based
input[type="email"][name="email"]input[placeholder="you@company.com"]Context-aware
section.signup > input:first-of-typeBest Locator
//input[@id='email']
Role based
getByRole('textbox', { name: 'Work email', exact: true })Label
getByLabel('Work email', { exact: true })Attribute based
getByPlaceholder('you@company.com')Paste selectors, one per line. XPath, CSS or Playwright.
//input[@id='email']
#signup .btn-primary
//button[@id='j_idt12:submit']
getByLabel('Work email')
Verify All
//input[@id='email']Unique#signup .btn-primary2 matches//button[@id='j_idt12:submit']No matchgetByLabel('Work email')Unique
- input
//input[@id='email'] - input
//input[@name='company'] - button
//button[normalize-space(.)='Create account']
How it works
-
Click the icon, then point.
Whatever is under the cursor lights up, including elements inside iframes and open Shadow DOM.
-
Press Space for hover menus.
A click picks the element. Space or Enter picks it without moving the mouse, so the menu stays open.
-
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.
-
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.
Plans for every team
<a>
//a[normalize-space(.)='Sign out']
Test
1 match
Best Locator
//a[normalize-space(.)='Sign out']
Accessibility
getByRole('link', { name: 'Sign out', exact: true })//a[normalize-space(.)='Sign out']UniquegetByRole('button', { name: 'Create account' })Unique#nav .menu-item3 matches//button[@id='j_idt88:submit']No match
13 hard targets. 12 verified unique.
Add to ChromeThe 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
_ngcontentattributes 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
- 40One of three identical Edit buttons
//h3[normalize-space(text())='Invoice B']/following-sibling::button[1]Fragile, 1 match - 50A list item with no id, class or text
ul.dots > li:last-of-typeModerate, 1 match - 92One cell in a status table
//table[@id='report']//td[normalize-space(.)='Paused']Stable, 1 match - 90A bare input named only by its label
//input[@id='ship-addr']Stable, 1 match
- 90An icon-only button with an aria-label
getByRole('button', { name: 'Close dialog', exact: true })Stable, 1 match - 92A div with role="button" and no native hooks
//div[normalize-space(.)='Toggle sidebar']Stable, 1 match - 60Link text with both kinds of quote and an order number
//a[normalize-space(.)='Order #12345 — "Rush"']Moderate, 1 match
- 90A clean, human-written id
//button[@id='checkout-submit']Stable, 1 match - 95A plain div with a data-testid
//div[@data-testid='user-card']Stable, 1 match - 95A button inside an open Shadow DOM
getByTestId('buy')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.