Help build Optics See the ideas

Create it your way. Run it forever.

Optics is open-source test automation for Android, iOS, web, TV and desktop. Write a test by hand, record it, describe it in plain English or hand it to your AI agent, then run that same suite on every build and every device.

$ curl -fsSL https://optics-framework.org/install | sh

Apache 2.0. Needs Python 3.12 or newer. Also installs on Windows and with pip, or by your agent. Read the docs.

A simulation of optics live next to a phone that shows Birch, a demo shop app. It does not run Optics. Type a keyword in the field, or select an element on the phone to type its keyword. Each step runs on the phone and shows how Optics found the element. Type /save to write the steps that passed into modules.csv and elements.csv, then open the optics execute tab to replay them.

In optics live you type a step and it runs on the device at once. /save writes the steps that worked into your suite.

Run real Optics in your browser

Every test has two lives.

The day you create it

Someone turns a user flow into steps a machine can repeat. Optics lets that person work the way they already think: in a spreadsheet, on the device, in a sentence, or through an AI agent.

Every day after that

The test has one job: run the same way on every build, every device and every release, and fail only when the app is actually broken.

Four ways to create a test

Click a bracket of the logo or pick from the list.

Write it

Elements, modules and test cases are plain CSV or YAML that anyone on the team can read and review. Prefer code? The same keywords are a Python library and a Robot Framework library.

modules/modules.csv
module_name,module_step,param_1,param_2
Sign In,Enter Text,${email_field},[email protected]
Sign In,Enter Text,${password_field},${password}
Sign In,Press Element,${sign_in}
Add To Cart,Enter Text,${search_bar},trail runner
Add To Cart,Press Element,Add to cart

Every way ends in plain text

Reviewed like code

A recording in Optics isn't a binary blob or a row in someone else's cloud. /save writes the same rows you would have typed, and an agent working through optics mcp writes them too. They live in your repo, next to the app they test.

So changing a test is a pull request. When a redesign moves the sign-in button, the diff shows the one locator that changed and the text fallback added beside it, and CI runs exactly what was merged.

test_data/elements.csv
 Element_Name,Element_ID
 email_field,//*[@resource-id='email']
-sign_in,//*[@text='Sign in']
+sign_in,//*[@resource-id='login']
+sign_in,Sign in
 search_bar,//*[@resource-id='search']

CSV or YAML

Write in whichever your team reads best. CSV opens in any spreadsheet and keeps one step per row. YAML keeps a whole flow in one indented file. /save writes either, and one project can hold both.

Optics tells files apart by what is inside them, not where they sit, so the folder layout is yours. Both formats load into the same suite, and each file holds one of three things.

Test cases
Which flows run, and in what order.
Modules
The steps, one keyword each, reused by every test case that names them.
Elements
Every name mapped to the ways to find it on screen. The only place a locator lives, so a redesign is an edit here and not in every test.

Explain a suite reads one row by row and shows what optics dry_run would report.

checkout/
test_cases/test_cases.csv
test_case,test_step
Checkout,Sign In
Checkout,Add To Cart

modules/modules.csv
module_name,module_step,param_1,param_2
Sign In,Enter Text,${email_field},[email protected]
Sign In,Press Element,${sign_in}
Add To Cart,Enter Text,${search_bar},trail runner
Add To Cart,Press Element,Add to cart

test_data/elements.csv
Element_Name,Element_ID
email_field,//*[@resource-id='email']
sign_in,//*[@resource-id='login']
sign_in,Sign in
search_bar,//*[@resource-id='search']

Run a suite

optics execute replays the suite step by step. Check it first without a device using optics dry_run, which checks every keyword and its parameters, and every element and module reference.

Birch is a real web app. Open it, then see how its last two releases ended when Optics ran the Birch suite.

junit_output.xml
Written once when the run ends, also when you stop the run.
Screenshots
The screen before each step that finds an element, and the same screen with a box around what Optics found.
Detected errors
Crash dialogs and messages like “Session expired”, matched from error_definitions.csv on the last screen, add a failure to the JUnit report even without an assertion.
The last screen of the Birch 2.1 run
Birch 2.1Run passed
  • 14 of 14 steps passed
exit 0
The last screen of the Birch 2.2 run, showing “Session expired”
Birch 2.2Run failed
  • 14 of 14 steps passed
  • “Session expired” on the last screen
exit 1

Step through the run

How Optics finds an element

Most frameworks give an element one locator and fail when a redesign changes it. Optics gives every element several identities and tries them in order, cheapest first, so vision only costs you time when the UI tree can't help.

Two more fallbacks sit alongside the ladder. List several values for the same element name and each is tried in turn. Enable a second driver or element source and it takes over when the first one fails.

  1. 1
    XPathA native query through the accessibility tree.
  2. 2
    TextThe visible text, CSS or class in the page source.
  3. 3
    OCRReads the screenshot with Apple Vision, RapidOCR, EasyOCR, Tesseract or Google Vision.
  4. 4
    ImageMatches a reference picture of the element on screen.
  5. 5
    AI self-heal, if you switch it onAn LLM reads the screen and recovers with the same keywords, in optics live and optics execute.

Try to break it

One suite, every screen

The same modules.csv runs on a phone, in a browser, on a TV and on a locked production device. Only the driver changes.

A simulation that runs the same five-step suite on Android, iOS, the web, a TV and a production device driven over Bluetooth. It does not run Optics. Use the Device slider to pick a device. The suite plays again and again on that device, and the text next to it names the driver and tells how Press Element works there.

Locked phones, TVs, games and more

Where suites run

On every build

This workflow runs a web suite on every push. optics execute exits with 1 when a test fails, which fails the job, and the JUnit report shows up as a check on the pull request.

On-screen error detection also flags a crash or sign-out screen left showing at the end of the run, even if no assertion would have caught it.

Run tests in CI has the same job for GitLab and for Android on an emulator.

.github/workflows/optics.yml
name: Optics
on: [push, pull_request]
permissions:
  contents: read
  checks: write
jobs:
  web:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-python@v7
        with:
          python-version: "3.12"
      - run: pip install "optics-framework[playwright]"
      - run: python -m playwright install --with-deps chromium
      - run: optics execute birch-tests
      - if: always()
        uses: mikepenz/action-junit-report@v6
        with:
          report_paths: birch-tests/execution_output/junit_output.xml

Before every release

Run the full regression on your own emulator or device, with annotated screenshots of every step to show exactly what the test saw.

On every device

Android, iOS, Android TV, Samsung Tizen, LG webOS and macOS, Linux and Windows desktop apps through Appium. Web through Selenium or Playwright. The keywords stay the same.

In production

Point the same suite at your live app on a schedule. Where debugging and screenshots are locked down, the BLE driver acts as a Bluetooth mouse and keyboard, paired with a camera.

Built in the open

Public numbers. Each one names its source and the date we read it.

9,411

downloads from PyPI by pip, uv and requests, since

75,218 downloads in all. Mirrors, browsers and clients with no name make up the other 87%.

  1. Apr 2025 from 18 Apr: 47
  2. May 2025: 35
  3. Jun 2025: 58
  4. Jul 2025: 763
  5. Aug 2025: 855
  6. Sept 2025: 765
  7. Oct 2025: 545
  8. Nov 2025: 384
  9. Dec 2025: 367
  10. Jan 2026: 606
  11. Feb 2026: 377
  12. Mar 2026: 566
  13. Apr 2026: 644
  14. May 2026: 684
  15. Jun 2026: 522
  16. Jul 2026: 359
  17. Aug 2026: 859
  18. Sept 2026: 276
  19. Oct 2026: 385
  20. Nov 2026 to 19 Nov: 314

PyPI download logsto

100

stars on GitHub, and 31 forks

GitHubread

13

releases in the 90 days to

GitHub releasesread

1.11.5 Latest,

Popups: write rules that close the popups that block a step.

All releases
Sources and method
  • pip, uv and requests 9,411 13%
  • Mirrors 37,030 49%
  • Browsers 10,663 14%
  • No name 18,114 24%
Downloads
Daily download counts for the optics-framework package from PyPI's public download logs, read through ClickPy. We count downloads by pip, uv, poetry, pdm, pipenv, pipx and requests, the tools that fetch a package to use it. We leave out mirrors (bandersnatch, Nexus, devpi, Artifactory), browsers and clients that send no name. One person can download many times, for example in CI, so downloads are not people.
Stars and forks
The counts on the GitHub repository on the day we read them.
Releases
Published GitHub releases. Each line is the title of a feature pull request from the release notes; dependency updates are not counted.
Updates
This page makes no requests to these sources. A script reads them and the result is committed with the site, so the numbers change only when the site is rebuilt.

Install

  1. 1Install Optics

    The installer keeps Optics in its own environment under ~/.optics, away from your system Python.

    $ curl -fsSL https://optics-framework.org/install | sh
  2. 2Set up a project

    Asks what you want to automate, installs the matching driver and OCR engine, scaffolds a project from a working sample and checks your setup. Add more engines any time with optics setup.

    $ optics quickstart
  3. 3Run it

    Then run it again on the next build, and every one after that.

    $ optics execute my_test_project

Or hand it to your agent

Paste one line into Claude Code, Codex, Cursor or any agent that runs commands. It follows agents.md and asks you only for what it cannot do.

Read agents.md

Paste into your agent

Read https://optics-framework.org/agents.md and follow it to set up Optics.

Your agent does

  1. Finds Optics, or installs it in ~/.optics
  2. Connects the optics MCP server to your client
  3. Opens a page in a headless browser to prove it works

It asks you for

  • A restart of your agent, the first time, so it loads the tools
  • A sudo command, on Linux only, if Chromium needs system libraries

Learn Optics

Guides from your first test to production monitoring, and a reference for every keyword, command and setting.

Quickstart

Five minutes. Install Optics and run a working test in a browser, no device needed.

Write your first test

Fifteen minutes. Sign in to a real online store and add to cart, one step at a time.

Create tests your way

Write a test, record it on the device, describe it in plain English, or hand it to your AI agent.

Every keyword and setting

Keywords, the CLI, config.yaml, file formats and error codes.

From the blog

Articles, videos and posts about Optics, from the community.

  • Self-heal broken locators with a 2B model on your own GPU

    I taught Qwen3.5-2B the Optics Framework self-heal job with a weight edit and with a LoRA. On a Pixel 4a with Optics Framework 1.11.3, the LoRA model healed 113 of 114 broken locators.

    Read the article

  • Your AI agent writes the test once. Optics runs it with no model.

    An AI agent drives a real browser through the Optics MCP server and writes a CSV test suite. Later runs replay that suite with no model, in about 3 seconds.

    Read the article

  • Your tests passed. Your app didn't.

    Error definitions catch crash dialogs, "Session expired" and other error screens that no step checked for. List the messages in one CSV file, and Optics looks for them on the last screen of every run.

    Read the article

  • Introducing Optics Framework: create a test your way, run it forever

    Optics is an open-source test automation framework for Android, iOS, web and TV apps. Tests are CSV or YAML files, and each element on screen can have several locators.

    Read the article

Transcript