Closed njucckevin closed 5 months ago
@oootttyyy can you share the script you used?
Hi @njucckevin You can convert web pages to their accessibility tree forms with this script:
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("file:///path/to/your/example.html")
cdp_client = page.context.new_cdp_session(page)
obs_handler = ObservationHandler(
"text",
"accessibility_tree",
"",
False,
{"width": 1280, "height": 1080},
)
cdp_client.send(
"Accessibility.enable", {}
)
obs = obs_handler.get_observation(page, cdp_client)
obs_metadata = obs_handler.get_observation_metadata()
Where obs
would be the accessibility tree
Hi! The WebArena has a very clean and simplified observation space of the accessibility tree. I would like to know for real websites, are there scripts for converting web pages to structured text like this? thanks for your help~