From 786a0f22c362bf453b26b553b983e4083d1910b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 28 Dec 2025 20:17:39 +0000 Subject: [PATCH 1/3] Fix accessibility command for Playwright 1.57+ Playwright 1.57.0 removed `page.accessibility.snapshot()` after 3 years of deprecation. This updates the accessibility command to use the new `locator.aria_snapshot()` API instead. Note: The output format has changed due to the new API returning a different accessibility tree structure (using semantic landmark roles like banner, main, contentinfo, navigation). --- shot_scraper/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shot_scraper/cli.py b/shot_scraper/cli.py index dbedac2..c7dca8a 100644 --- a/shot_scraper/cli.py +++ b/shot_scraper/cli.py @@ -702,9 +702,10 @@ def accessibility( skip_or_fail(response, skip, fail) if javascript: _evaluate_js(page, javascript) - snapshot = page.accessibility.snapshot() + snapshot = page.locator("body").aria_snapshot() browser_obj.close() - output.write(json.dumps(snapshot, indent=4)) + # aria_snapshot() returns YAML, parse it for JSON output + output.write(json.dumps(yaml.safe_load(snapshot), indent=4)) output.write("\n") From b2bc4fa7404b62a7bcec3e22c08699305612f71b Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 28 Dec 2025 12:41:24 -0800 Subject: [PATCH 2/3] -3.9, +3.14 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 794aa89..77347c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From bee2aa0312557b0be93978020570b567ea6a2aab Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 28 Dec 2025 20:29:00 -0800 Subject: [PATCH 3/3] Enable accessibilty tests again Refs https://github.com/simonw/shot-scraper/pull/186#issuecomment-3695374594 --- tests/run_examples.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/run_examples.sh b/tests/run_examples.sh index 2b56d2d..d9123e3 100755 --- a/tests/run_examples.sh +++ b/tests/run_examples.sh @@ -45,15 +45,15 @@ shot-scraper 'https://www.owlsnearme.com/?place=127871' \ -o examples/owlsnearme-wait.jpg \ --wait-for "!!document.querySelector('section.secondary')" # Accessibility -# #shot-scraper accessibility https://datasette.io/ \ -# > examples/datasette-accessibility.json -# shot-scraper accessibility https://simonwillison.net \ -# --javascript "document.getElementById('wrapper').style.display='none'" \ -# > examples/simonwillison-accessibility-javascript.json -# shot-scraper accessibility https://simonwillison.net \ -# --javascript "document.getElementById('wrapper').style.display='none'" \ -# --output examples/simonwillison-accessibility-javascript-and-dash-output.json -# shot-scraper accessibility examples/local.html -o examples/local-accessibility.json +shot-scraper accessibility https://datasette.io/ \ + > examples/datasette-accessibility.json +shot-scraper accessibility https://simonwillison.net \ + --javascript "document.getElementById('wrapper').style.display='none'" \ + > examples/simonwillison-accessibility-javascript.json +shot-scraper accessibility https://simonwillison.net \ + --javascript "document.getElementById('wrapper').style.display='none'" \ + --output examples/simonwillison-accessibility-javascript-and-dash-output.json +shot-scraper accessibility examples/local.html -o examples/local-accessibility.json # PDF (cd examples && shot-scraper pdf https://datasette.io/tools) shot-scraper pdf https://datasette.io \