Skip to main content

robotframework-maestrolibrary

Robot Framework keywords for mobile apps, driven by Maestro. If you know AppiumLibrary, you already know the keyword names, the arguments and the strategy=value locators. There's no Appium server and no capabilities to manage. Maestro waits for the UI on every action.

Requirements

  • Maestro CLI on PATH (maestro --version) and Java 17+
  • A running emulator/simulator or a connected device
  • Android: adb (platform-tools) on PATH. Open Application uses it to wait for the app's window, and Execute Adb Shell needs it. Without it, Open Application warns and returns as soon as Maestro does.

Install

pip install robotframework-maestrolibrary

For development: pip install -e .

A version tag (v0.2.0, matching __version__) builds the package in CI and uploads it to the project's registry, and to PyPI when the PYPI_TOKEN CI variable is set. MIT: see LICENSE.

Example

*** Settings ***
Library    MaestroLibrary    timeout=10s

*** Test Cases ***
Search Settings
    Open Application    com.android.settings
    Click Text    Search settings    exact_match=True
    Input Text    id=com.google.android.settings.intelligence:id/open_search_view_edit_text    wifi
    Wait Until Page Contains    Wi-Fi
    [Teardown]    Close All Applications

Locators

text=, accessibility_id=, id= (literal, whole value), regex=, id_regex= (Maestro regular expressions), point=50%,50%. A bare value means text. Flutter apps get ids from Semantics(identifier: ...). xpath, class, android, ios, predicate, chain, css, name and identifier fail with a clear message.

Coming from AppiumLibrary

Same names and arguments: Close/Activate/Terminate Application, Close All Applications, Go Back, Go To Url, Get Source, Log Source, Execute Adb Shell, Click Element, Click Text, Input Text, Input Password, Input Text Into Current Element, Clear Text, Hide Keyboard, Page Should (Not) Contain Text/Element, Element Should Be Visible/Enabled/Disabled, Text Should Be Visible, Element Text Should Be, Element Should (Not) Contain Text, Get Text, Get Element Attribute, Scroll Element Into View, Expect Element, Expect Text, the five Wait Until keywords, Swipe, Swipe By Percent, Scroll Down/Up, Tap, Long Press, Press Keycode, Capture Page Screenshot, Register Keyword To Run On Failure, Set Location, Landscape, Portrait.

Differences:

  • Open Application <app id> clear_state=False stop_app=True: no remote URL or capabilities. Like Appium, it returns once the app has window focus.
  • Set/Get Appium Timeout become Set/Get Maestro Timeout.
  • Press Keycode supports the keycodes that Maestro can send. Press Key takes Maestro key names.
  • Should/Get keywords check the settled screen once. Wait/Expect keywords and every action wait.
  • Screenshots are JPEG (maestro-screenshot-<n>.jpg, or EMBED).
  • Swipe duration takes a time (300ms); a bare number is milliseconds, as in AppiumLibrary.
  • speed=0.5s (import argument) pauses before every Maestro command, like SeleniumLibrary's speed. Use it when a slow or overloaded emulator stops responding.
  • Start Screen Recording takes time_limit (AppiumLibrary: timeLimit), 3 minutes by default. Stop Screen Recording saves filename as given (AppiumLibrary appends .mp4). Both are Android only (adb screenrecord): Maestro ends its own recording with each flow, and every keyword is its own flow. Put Stop in a teardown.
  • Set Location ignores altitude.

Maestro-only keywords:

  • Run Flow: a YAML file, inline commands, or a directory of flows with include_tags / exclude_tags, plus env variables.
  • App state: Clear Application State, Kill Application (the system killing a background app), Set Application Permissions (camera=deny, all=allow), Open Application permissions=....
  • Device: Travel (move the location along points), Set Orientation, Set Airplane Mode, Set Dark Mode, Add Media (put images or videos in the gallery).
  • Visual: Capture Element Screenshot (PNG), Screenshot Should Match (compare with a reference PNG, whole screen or one element, with a threshold).
  • Wait For Animation To End, Is Keyboard Shown.

Not ported: webview contexts, xpath, multiple app aliases, touch id, WebElement keywords, Drag And Drop, Flick, sleep-between-wait-loop settings.

Maestro CLI coverage

The library talks to maestro mcp. What the other maestro subcommands do, and where it lives here:

maestro Here
test (flows, tags, -e) Run Flow
print-hierarchy, query Get Source, Get Text, Get Element Attribute, the Should keywords
list-devices the device import argument; the first connected device by default
record Start/Stop Screen Recording
check-syntax Run Flow fails with Maestro's parse error and its line
start-device not a test step: boot the emulator before the run, e.g. maestro start-device --platform android in CI
studio, chat, driver, cloud, login, ... interactive or Maestro Cloud tools, not used

Flow commands without a keyword, still reachable with Run Flow: the AI assertions (need a Maestro Cloud key), inputRandom*, clipboard commands (the copied text stays inside one flow), repeat/retry (use Robot's FOR and Wait Until Keyword Succeeds), runScript/evalScript, toggleAirplaneMode, assertDarkMode/assertLightMode, clearKeychain (iOS), doubleTapOn.

Each maestro mcp process reinstalls Maestro's driver app on the device once, when it first connects (Maestro hard-codes it). The library keeps one process for the whole run.

Development

python -m unittest discover -s utest                        # no device needed
robot --pythonpath src -d results atest                     # needs a running Android emulator
python -m robot.libdoc --pythonpath src MaestroLibrary results/MaestroLibrary.html

Metadata

Release files for robotframework-maestrolibrary 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-maestrolibrary 0.2.0
File Size Uploaded
robotframework_maestrolibrary-0.2.0.tar.gz 24.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-maestrolibrary 0.2.0
File Interpreter ABI Platform
robotframework_maestrolibrary-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.3 kB

Release files / robotframework_maestrolibrary-0.2.0.tar.gz

Download URL robotframework_maestrolibrary-0.2.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4dcb3ef14c47c07fdb07366a8d92a5a4a2090d51cb8ad529b249ae44ee11c887
BLAKE2b-256 checksum
How to use checksums
fd525601339682756898bf9650ab35974114aceedb71ebb73492d7ae656c4b19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / robotframework_maestrolibrary-0.2.0-py3-none-any.whl

Download URL robotframework_maestrolibrary-0.2.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d940d7d16ea2054f4303a97a65b2139a5141958b665936658b608436fe7bcbb4
BLAKE2b-256 checksum
How to use checksums
5ee00af33ad7f859321a0be4e9ae76e0175410fc87d84ccbf1c9392fecd97fa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release history Release notifications | RSS feed

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page