Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shot-scraper accessibility URL command for dumping accessibility tree #22

Closed
simonw opened this issue Mar 10, 2022 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Mar 10, 2022

Via Twitter I found out that Playwright has a utility function for dumping out the accessibility tree for a page: https://playwright.dev/python/docs/api/class-accessibility

I'm going to add this as a feature of shot-scraper.

@simonw simonw added the enhancement New feature or request label Mar 10, 2022
@simonw simonw closed this as completed in f7f3d73 Mar 10, 2022
@simonw
Copy link
Owner Author

simonw commented Mar 10, 2022

I added this to the automated tests:

shot-scraper accessibility https://datasette.io/ > examples/datasette-accessibility.json

Here's the output from the most recent actions test run: https://gist.github.com/simonw/431e9075441463236850bab042b9d20d

I think this justifies the inclusion of this in a tool called shot-scraper - there's something potentially interesting about scraping the accessibility tree and storing it in a GitHub repository, since then you can use diffs to track changes made to that accessibility tree over time.

simonw added a commit that referenced this issue Mar 10, 2022
@simonw
Copy link
Owner Author

simonw commented Mar 10, 2022

Here's a fun trick:

shot-scraper accessibility https://datasette.io \
    | jq .children | sqlite-utils insert \
    /tmp/accessibility.db nodes - --alter
open /tmp/accessibility.db

A screenshot of Datasette Desktop showing the nodes table in my new accessibility.db database, which has 298 rows - it is faceted by role and level - the roles include text, link, heading, button and textbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant