Hi all,
I released a small, dependency-free library for a recurring pain in cross-platform
testing: maintaining the same locator for Android, iOS, iPadOS and Windows.
You define a selector once per platform, and crosslocator resolves the right one
at runtime:
from crosslocator import Locator
LOGIN = Locator(
android="accessibility_id=login",
ios="accessibility_id=login",
windows='//Button[@Name="Log in"]',
default="id=login",
)
LOGIN.resolve() # the right selector for the current platform
It works with pure Python (Appium) and Robot Framework (a small library exposing
Set Current Platform / Resolve Locator keywords). It can also auto-detect the
platform from the active Appium session. iPad falls back to iOS selectors, and a
shared default covers the rest.
- Install: pip install crosslocator
- Source: GitHub - julien-becheny/crosslocator: Define a UI selector once, resolve it on every platform (Android, iOS, iPadOS, Windows, web). For Appium, Robot Framework, or pure Python. · GitHub
It’s an early release (v0.2). Feedback and issues are very welcome — especially on
the Robot Framework integration and the locator formats you’d like supported.
Thanks!