Allwright Inspector: find locators by pointing
A new allwright inspector command shows your running app next to its accessibility tree and writes the locator for you in five languages.
Writing a test for a native app usually stalls on one question: what do I click? You guess a label, run the test, watch it fail, and guess again.
As of v0.1.34, allwright ships an answer. allwright inspector opens a local
page that shows your running app next to its accessibility tree. Click an
element and it hands you the locator, ready to paste into your test.
What it does
- Shows the live app as a screenshot, with the full accessibility hierarchy beside it.
- Highlights the element you select, whether you click it in the screenshot or in the tree.
- Lists its properties: role, name, accessibility id, class, enabled state, and bounds.
- Writes the locator in TypeScript, Python, Java, Go, and Rust at the same time, with a copy button on each.
An element with an accessibility id gets getByTestId. Anything else gets
getByRole with its accessible name. For example, in TypeScript:
app.getByTestId("login-button")
app.getByRole("button", { name: "Sign Up", exact: true })These are the same locators the client libraries already use, so what you copy works as is.
Start it, surface by surface
You need the allwright CLI. If you don't have it, follow the install steps in
the repo README, or run
allwright update to move an existing install to v0.1.34. Then install the
plugin for the surface you want to inspect and start the inspector with your
app as the target.
Android
You need adb and a running emulator or a connected device.
allwright plugin install mobile-android
allwright inspector mobile-android ./sample.apk
allwright inspector mobile-android https://allwright.dev/sample.apk --device emulator-5554The target is a local APK or a download URL. allwright installs and launches
it. --device takes an ADB serial or a configured name; leave it off to use
the default connected device.
iOS
You need a Mac with Xcode and either an iOS Simulator runtime or a registered iPhone.
allwright plugin install mobile-ios
allwright inspector mobile-ios ./Flights-simulator.ipa
allwright inspector mobile-ios https://allwright.dev/Flights-simulator.ipa --device "iPhone 17 Pro"The target is a .app, .zip, .ipa, or a URL. --device takes a Simulator
name or UDID, or a physical device UDID; leave it off for the default available
Simulator.
macOS
You need macOS 14 or newer, Xcode, and UI automation (Accessibility) permission for your terminal.
allwright plugin install desktop-mac
allwright inspector desktop-mac com.apple.TextEdit
allwright inspector desktop-mac com.apple.Safari --url https://allwright.devThe target is the app's bundle identifier. It must already be installed.
--url opens a URL in the app.
Windows
You need Windows x64. There is nothing else to install.
allwright plugin install desktop-windows
allwright inspector desktop-windows "C:\Windows\System32\notepad.exe"
allwright inspector desktop-windows "https://allwright.dev"The target is an executable path, a command such as notepad.exe, or a
packaged-app ID. A URL inspects the foreground browser window.
Once it's running
The inspector prints its address and opens http://127.0.0.1:9227 in your
browser. Pass --no-open to only print the address. It listens on loopback
only and refuses any other address. Press Ctrl+C in the terminal to stop it.
Inspect and Interact
The inspector has two modes.
Inspect captures the hierarchy and lets you select elements without touching the app. This is where you hunt for locators.
Interact switches the canvas to a live screen feed. Click or tap, double-click, drag to swipe, scroll with the wheel, type, press special keys, and paste. Everything is forwarded straight to the app, so you can get to the screen you want to inspect: log in, open a menu, dismiss a dialog. Switch back to Inspect and the hierarchy refreshes.
A selected element also has its own controls: click, double-click, scroll up or down, fill with text, and press a key. That lets you confirm a locator resolves to the right element before it goes into a test.
A typical session
- Start the inspector against your app.
- Switch to Interact and navigate to the screen under test.
- Switch back to Inspect and click the element you need.
- Check it with the Click / tap button.
- Copy the locator for your language into the test.
What it doesn't do yet
- Web pages. The inspector covers Android, iOS, macOS, and Windows. Web
already has
getByRole,getByText, and friends, but there is no visual picker for it yet. - It suggests one locator per element, based on role and name or accessibility id. If your app has duplicate labels, you will want to narrow the locator by hand.
- It needs the usual prerequisites for each surface: Xcode for iOS and
macOS (plus Accessibility permission on macOS), and
adbwith an emulator or device for Android.
The Availability page tracks this alongside everything else.
Try it
Run allwright update to get v0.1.34, then point the inspector at an app.
The Changelog lists everything in v0.1.28 to v0.1.34, and the
repo README has the full
inspector reference. If a locator comes out wrong, open an issue and tell us
which element it was.
Try it in your own project
Scaffold a project with one command and run your first test, or keep reading the rest of the blog.