Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 2.18 KB

File metadata and controls

69 lines (48 loc) · 2.18 KB

Reading-order reporter (reading_order.py)

This small utility uses Playwright to capture the page accessibility snapshot and generate a human-readable HTML report that approximates the order a screen reader would encounter the page's accessible elements.

Installation

  1. Create and activate a Python virtual environment (recommended):

    python -m venv .venv; ..venv\Scripts\Activate.ps1

  2. Install the dependency and browsers:

    pip install -r requirements.txt python -m playwright install

Usage

Run the script with a URL and optional output path:

python reading_order.py https://example.com --output example_report.html

Use --headful to open a visible browser during capture for debugging.

GUI (Live View + keyboard order)

On Windows, the GUI uses QtWebEngine. The most reliable setup is a pip-based env with PySide6 wheels.

  1. Create or use an env that has QtWebEngine working (example: conda env named web-qt).

  2. Run the GUI:

    PowerShell:

    # Activate your env (example)
    conda activate web-qt
    
    # Launch the GUI
    python reading_order_gui.py
  3. Enter a URL and click Scan.

    • Live View shows the page and steps through focusable elements in true keyboard order.
    • If the page is empty/iframe-heavy, it will automatically run a Playwright scan and populate the list with a numbered screenshot.
    • Save Report runs a background scan and writes an HTML report.

Notes

  • Playwright's accessibility snapshot is an approximation. Different screen readers might still present a slightly different order depending on platform and heuristics.
  • If your environment blocks network access or browsers, run the script on an accessible site or provide a local HTML file via file:// URL.

Troubleshooting

  • If Live View says QWebEngineView unavailable, ensure PySide6 (pip wheels) is installed in the chosen env.

  • Corporate proxies/SSL interception may block page loads. The GUI sets Chromium flags to accept insecure certs by default.

  • If Playwright browsers were never installed in your env, run:

    python -m playwright install