pyagentbrowser 0.32.3__tar.gz → 0.33.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/Cargo.lock +2 -2
  2. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/NOTICE +11 -0
  3. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/PKG-INFO +4 -1
  4. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/agent-browser-adapter/Cargo.toml +1 -1
  5. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/agent-browser-adapter/build.rs +1 -0
  6. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/agent-browser-adapter/tests/smoke.rs +8 -0
  7. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/pyagentbrowser/Cargo.toml +1 -1
  8. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/docs/api.md +29 -4
  9. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/docs/guides.md +34 -2
  10. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/pyproject.toml +8 -1
  11. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/__init__.py +12 -0
  12. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/_allowlist.py +1 -0
  13. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/_browser_common.py +6 -1
  14. pyagentbrowser-0.33.0/src/agentbrowser/_upstream.json +4 -0
  15. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/_version.py +1 -1
  16. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/browser.py +91 -7
  17. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/browser_async.py +91 -7
  18. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/command_params.py +23 -0
  19. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/domains.py +35 -9
  20. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/domains_async.py +35 -9
  21. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/models.py +202 -5
  22. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/Cargo.toml +1 -1
  23. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/commands.rs +169 -25
  24. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/mcp.rs +96 -4
  25. pyagentbrowser-0.33.0/third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core-THIRD-PARTY.txt +66 -0
  26. pyagentbrowser-0.33.0/third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core.txt +362 -0
  27. pyagentbrowser-0.33.0/third_party/agent-browser/cli/src/native/a11y/axe.min.js +12 -0
  28. pyagentbrowser-0.33.0/third_party/agent-browser/cli/src/native/a11y/mod.rs +885 -0
  29. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/actions.rs +1095 -87
  30. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/browser.rs +702 -30
  31. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cdp/client.rs +48 -2
  32. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/e2e_tests.rs +826 -0
  33. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/mod.rs +2 -0
  34. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/parity_tests.rs +2 -0
  35. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/backend.rs +3 -0
  36. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/client.rs +66 -7
  37. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/SKILL.md +22 -2
  38. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/commands.md +19 -2
  39. pyagentbrowser-0.32.3/src/agentbrowser/_upstream.json +0 -4
  40. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/Cargo.toml +0 -0
  41. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/LICENSE +0 -0
  42. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/README.md +0 -0
  43. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/agent-browser-adapter/src/lib.rs +0 -0
  44. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/pyagentbrowser/build.rs +0 -0
  45. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/crates/pyagentbrowser/src/lib.rs +0 -0
  46. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/docs/getting-started.md +0 -0
  47. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/examples/async_usage.py +0 -0
  48. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/examples/basic_navigation.py +0 -0
  49. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/examples/cdp_frame_eval.py +0 -0
  50. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/examples/confirmation_policy.py +0 -0
  51. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/examples/restore_session.py +0 -0
  52. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/examples/screenshot_capture.py +0 -0
  53. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/rust-toolchain.toml +0 -0
  54. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/_native.pyi +0 -0
  55. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/agent.py +0 -0
  56. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/agent_async.py +0 -0
  57. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/__init__.py +0 -0
  58. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/_protocol.py +0 -0
  59. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/_resolution.py +0 -0
  60. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/client.py +0 -0
  61. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/controller.py +0 -0
  62. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/errors.py +0 -0
  63. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/models.py +0 -0
  64. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/page.py +0 -0
  65. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/target.py +0 -0
  66. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/cdp/transport.py +0 -0
  67. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/install.py +0 -0
  68. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/launch.py +0 -0
  69. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/py.typed +0 -0
  70. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/query.py +0 -0
  71. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/query_async.py +0 -0
  72. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/session.py +0 -0
  73. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/session_async.py +0 -0
  74. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/session_id.py +0 -0
  75. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/src/agentbrowser/skills.py +0 -0
  76. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/LICENSE +0 -0
  77. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/cdp-protocol/browser_protocol.json +0 -0
  78. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/cdp-protocol/js_protocol.json +0 -0
  79. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/color.rs +0 -0
  80. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/connection.rs +0 -0
  81. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/flags.rs +0 -0
  82. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/install.rs +0 -0
  83. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/auth.rs +0 -0
  84. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cdp/chrome.rs +0 -0
  85. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cdp/discovery.rs +0 -0
  86. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cdp/lightpanda.rs +0 -0
  87. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cdp/mod.rs +0 -0
  88. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cdp/types.rs +0 -0
  89. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/cookies.rs +0 -0
  90. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/daemon.rs +0 -0
  91. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/diff.rs +0 -0
  92. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/element.rs +0 -0
  93. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/inspect_server.rs +0 -0
  94. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/interaction.rs +0 -0
  95. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/network.rs +0 -0
  96. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/policy.rs +0 -0
  97. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/providers.rs +0 -0
  98. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/react/installHook.js +0 -0
  99. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/react/mod.rs +0 -0
  100. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/react/renders.rs +0 -0
  101. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/react/scripts.rs +0 -0
  102. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/react/suspense.rs +0 -0
  103. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/react/tree.rs +0 -0
  104. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/recording.rs +0 -0
  105. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/screenshot.rs +0 -0
  106. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/snapshot.rs +0 -0
  107. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/state.rs +0 -0
  108. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/storage.rs +0 -0
  109. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/cdp_loop.rs +0 -0
  110. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/chat.rs +0 -0
  111. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/dashboard.rs +0 -0
  112. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/discovery.rs +0 -0
  113. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/http.rs +0 -0
  114. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/mod.rs +0 -0
  115. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/stream/websocket.rs +0 -0
  116. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/test_fixtures/drag_probe.html +0 -0
  117. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/test_fixtures/html5_drag_probe.html +0 -0
  118. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/test_fixtures/pointer_capture_probe.html +0 -0
  119. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/test_fixtures/upload_probe.html +0 -0
  120. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/tracing.rs +0 -0
  121. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/appium.rs +0 -0
  122. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/ios.rs +0 -0
  123. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/mod.rs +0 -0
  124. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/safari.rs +0 -0
  125. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/native/webdriver/types.rs +0 -0
  126. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/plugins.rs +0 -0
  127. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/read.rs +0 -0
  128. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/test_utils.rs +0 -0
  129. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/cli/src/validation.rs +0 -0
  130. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/agentcore/SKILL.md +0 -0
  131. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/authentication.md +0 -0
  132. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/profiling.md +0 -0
  133. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/proxy-support.md +0 -0
  134. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/session-management.md +0 -0
  135. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/snapshot-refs.md +0 -0
  136. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/trust-boundaries.md +0 -0
  137. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/video-recording.md +0 -0
  138. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/references/webgpu.md +0 -0
  139. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/templates/authenticated-session.sh +0 -0
  140. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/templates/capture-workflow.sh +0 -0
  141. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/core/templates/form-automation.sh +0 -0
  142. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/derive-client/SKILL.md +0 -0
  143. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/dogfood/SKILL.md +0 -0
  144. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/dogfood/references/issue-taxonomy.md +0 -0
  145. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/dogfood/templates/dogfood-report-template.md +0 -0
  146. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/electron/SKILL.md +0 -0
  147. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/slack/SKILL.md +0 -0
  148. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/slack/references/slack-tasks.md +0 -0
  149. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/slack/templates/slack-report-template.md +0 -0
  150. {pyagentbrowser-0.32.3 → pyagentbrowser-0.33.0}/third_party/agent-browser/skill-data/vercel-sandbox/SKILL.md +0 -0
@@ -45,7 +45,7 @@ dependencies = [
45
45
 
46
46
  [[package]]
47
47
  name = "agent-browser"
48
- version = "0.32.3"
48
+ version = "0.33.0"
49
49
  dependencies = [
50
50
  "aes-gcm",
51
51
  "async-trait",
@@ -1461,7 +1461,7 @@ checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"
1461
1461
 
1462
1462
  [[package]]
1463
1463
  name = "pyagentbrowser"
1464
- version = "0.32.3"
1464
+ version = "0.33.0"
1465
1465
  dependencies = [
1466
1466
  "agent-browser",
1467
1467
  "pyo3",
@@ -7,5 +7,16 @@ agent-browser project.
7
7
  Upstream project: https://github.com/vercel-labs/agent-browser
8
8
  Upstream license: third_party/agent-browser/LICENSE
9
9
 
10
+ The embedded native engine includes axe-core 4.12.1 for accessibility audits.
11
+
12
+ axe-core license:
13
+ third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core.txt
14
+
15
+ axe-core bundled dependency notices:
16
+ third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core-THIRD-PARTY.txt
17
+
18
+ axe-core source:
19
+ https://github.com/dequelabs/axe-core/tree/v4.12.1
20
+
10
21
  pyagentbrowser is an independent project. It is not affiliated with, endorsed
11
22
  by, or sponsored by Vercel Inc. or Vercel Labs.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyagentbrowser
3
- Version: 0.32.3
3
+ Version: 0.33.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -21,6 +21,9 @@ Provides-Extra: cdp
21
21
  Provides-Extra: images
22
22
  License-File: LICENSE
23
23
  License-File: NOTICE
24
+ License-File: third_party/agent-browser/LICENSE
25
+ License-File: third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core.txt
26
+ License-File: third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core-THIRD-PARTY.txt
24
27
  Summary: Python SDK for controlling the native agent-browser engine in-process
25
28
  Keywords: agent-browser,browser automation,evidence,refs,snapshots
26
29
  Author-email: Péter Ferenc Gyarmati <dev.petergy@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "agent-browser"
3
- version = "0.32.3"
3
+ version = "0.33.0"
4
4
  edition = "2021"
5
5
  description = "Library adapter for the agent-browser upstream submodule"
6
6
  license = "Apache-2.0"
@@ -18,6 +18,7 @@ const ROOT_MODULES: &[(&str, &str)] = &[
18
18
  ];
19
19
 
20
20
  const NATIVE_MODULES: &[(&str, &str)] = &[
21
+ ("a11y", "a11y/mod.rs"),
21
22
  ("actions", "actions.rs"),
22
23
  ("auth", "auth.rs"),
23
24
  ("browser", "browser.rs"),
@@ -36,6 +36,14 @@ fn assert_error_contains(response: &Value, expected: &str) {
36
36
  );
37
37
  }
38
38
 
39
+ #[test]
40
+ fn accessibility_audit_engine_is_embedded() {
41
+ let source = agent_browser::native::a11y::AXE_JS;
42
+
43
+ assert!(source.len() > 100_000);
44
+ assert!(source.contains("axe.version="));
45
+ }
46
+
39
47
  struct EnvVarGuard {
40
48
  key: &'static str,
41
49
  previous: Option<OsString>,
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pyagentbrowser"
3
- version = "0.32.3"
3
+ version = "0.33.0"
4
4
  edition.workspace = true
5
5
  description = "Python bindings for agent-browser's native Rust browser automation engine"
6
6
  license = "Apache-2.0"
@@ -271,8 +271,15 @@ It can inspect a lazy session before Chrome launches.
271
271
  | `list() -> tuple[TabInfo, ...]` | Returns open tabs. |
272
272
  | `new(url=None, *, label=None) -> TabInfo` | Creates a tab with an optional URL and label. |
273
273
  | `open(url, *, label=None, reuse=True, wait_until="load") -> TabInfo` | Opens a URL and reuses a matching label when requested. |
274
- | `switch(*, id=None, label=None, index=None) -> None` | Switches by exactly one id, label, or zero-based index. |
275
- | `close(*, id=None, label=None, index=None) -> None` | Closes the selected tab or the active tab. |
274
+ | `switch(*, id=None, label=None, index=None) -> TabSwitchResult` | Switches by exactly one id, label, or zero-based index and returns the observed renderer state. |
275
+ | `close(*, id=None, label=None, index=None) -> TabCloseResult` | Closes the selected tab or the active tab and reports successor reactivation when observed. |
276
+
277
+ `TabSwitchResult.revived=True` means switching reactivated the renderer, so the
278
+ page may have reloaded. `dialog_blocked=True` means a JavaScript dialog paused
279
+ the renderer. Its URL and title contain the last-known tab metadata.
280
+ `TabCloseResult.active_tab_revived=True` means closing reactivated the successor
281
+ renderer. Use it as a positive signal. Tab closure commits before successor
282
+ recovery, and recovery errors are suppressed.
276
283
 
277
284
  ### `browser.cookies`
278
285
 
@@ -349,12 +356,22 @@ bodies.
349
356
  | `diagnostics.console(*, clear=False) -> tuple[ConsoleMessage, ...]` | Returns captured console messages. |
350
357
  | `diagnostics.errors() -> Mapping` | Returns page errors. |
351
358
  | `diagnostics.vitals() -> Mapping` | Returns page vitals. |
359
+ | `diagnostics.accessibility(url=None, *, tags=(), selector=None) -> AccessibilityAudit` | Runs an axe-core audit for the active page or an optional URL. |
352
360
  | `diagnostics.react_tree(*, selector=None) -> Mapping` | Returns React tree diagnostics. |
353
361
  | `active_frame.select(*, selector=None, name=None, url=None) -> None` | Selects one native frame. |
354
362
  | `active_frame.main() -> None` | Restores the main native frame. |
355
363
 
356
364
  Script and style methods accept exactly one inline source or URL or path. Invalid source combinations raise `ValueError`.
357
365
 
366
+ Accessibility audits run the embedded axe-core engine in a CDP browser.
367
+ `tags` accepts axe rule tags such as `("wcag2a", "wcag2aa")`. `selector`
368
+ scopes the audit to one matching subtree. Passing `url` navigates before the
369
+ audit. It invalidates cached direct CDP page handles after the navigation
370
+ attempt, including when the audit then fails. A current-page audit keeps
371
+ existing handles valid. Safari and iOS WebDriver sessions reject this
372
+ operation. Each issue includes up to 10 node records and keeps the complete
373
+ affected count in `node_count`.
374
+
358
375
  ## CDP
359
376
 
360
377
  The `cdp` extra supplies WebSocket transport for CDP operations.
@@ -367,7 +384,9 @@ The `cdp` extra supplies WebSocket transport for CDP operations.
367
384
  | `browser.cdp.evaluate(script, *, frame=None, extension_id=None, context=None, await_promise=True, return_by_value=True)` | Evaluates JavaScript in a selected CDP realm. |
368
385
  | `browser.cdp.send(method, params=None, *, session_id=None)` | Sends one raw CDP command and returns its result mapping. |
369
386
 
370
- Navigation, tab changes, and browser relaunch invalidate cached CDP handles. Resolve handles again after those lifecycle events.
387
+ Navigation, URL accessibility audits, tab changes, and browser relaunch
388
+ invalidate cached CDP handles. Resolve handles again after those lifecycle
389
+ events.
371
390
 
372
391
  ## Native protocol
373
392
 
@@ -379,7 +398,7 @@ Executes one native action and returns its complete response envelope. An unsucc
379
398
 
380
399
  Executes one native action and returns successful response data. `expect="object"` requires a mapping. `expect="any"` accepts every JSON value. Native failures raise `BrowserError`.
381
400
 
382
- Domain allowlists, policy confirmation, and browser or CDP lifecycle tracking apply to both methods. See the [`agent-browser` command reference at the embedded commit](https://github.com/vercel-labs/agent-browser/blob/81c336c1c20b80ac648e0416a7b6e0c0ae7878bb/README.md#commands) for native action names and parameters.
401
+ Domain allowlists, policy confirmation, and browser or CDP lifecycle tracking apply to both methods. See the [`agent-browser` command reference at the embedded commit](https://github.com/vercel-labs/agent-browser/blob/1ed371f3af472cc0d6cd8fdaea75d1a085ff7534/README.md#commands) for native action names and parameters.
383
402
 
384
403
  ## Confirmation
385
404
 
@@ -391,12 +410,18 @@ Typed operations raise `ConfirmationRequired` when the native policy pauses an a
391
410
 
392
411
  | Model | Contract |
393
412
  | --- | --- |
413
+ | `AccessibilityAudit` | Audited URL, axe-core version, counts, violations, incomplete checks, and raw data. |
414
+ | `AccessibilityCounts` | Violation, incomplete, pass, and inapplicable rule counts. |
415
+ | `AccessibilityIssue` | Rule id, impact, guidance, tags, affected node count, and sampled nodes. |
416
+ | `AccessibilityNode` | Nested selector target, HTML excerpt, failure summary, and raw data. |
394
417
  | `BrowserResponse` | Complete native response envelope. |
395
418
  | `CloseResult` | Terminal browser close and restore-save result. |
396
419
  | `ReadResult` | URL, final URL, status, content type, source, truncation state, content, and raw data. |
397
420
  | `Screenshot` | Screenshot path, format, annotations, and image helpers. |
398
421
  | `SnapshotDiff` | Text diff, line counts for additions, removals, and unchanged content, plus a changed flag. |
399
422
  | `TabInfo` | Tab id, URL, title, label, and active state. |
423
+ | `TabSwitchResult` | Selected tab metadata plus renderer reactivation and blocking-dialog signals observed during the switch. |
424
+ | `TabCloseResult` | Closed tab id and label plus an observed successor reactivation signal. |
400
425
  | `Cookie` | Cookie value and browser metadata. |
401
426
  | `NetworkRequest` | Captured request summary. |
402
427
  | `RequestDetail` | Request, response, headers, status, and body details. |
@@ -98,11 +98,19 @@ with Browser.launch() as browser:
98
98
  browser.tabs.open("https://example.com/report", label="report")
99
99
  browser.tabs.open("https://example.com/settings", label="settings")
100
100
 
101
- browser.tabs.switch(label="report")
101
+ selected = browser.tabs.switch(label="report")
102
+ print(selected.revived, selected.dialog_blocked)
102
103
  print(browser.tabs.list())
103
104
  ```
104
105
 
105
- Pass `reuse=False` to create a new tab when the label already exists. `tabs.switch()` and `tabs.close()` accept one id, label, or zero-based index.
106
+ Pass `reuse=False` to create a new tab when the label already exists.
107
+ `tabs.switch()` and `tabs.close()` accept one id, label, or zero-based index.
108
+ A switch can reactivate a discarded renderer. `TabSwitchResult.revived=True`
109
+ means the page may have reloaded, so refresh workflow state derived from the
110
+ page. `TabSwitchResult.dialog_blocked=True` means a JavaScript dialog paused
111
+ the renderer and the result contains last-known URL and title metadata.
112
+ `TabCloseResult.active_tab_revived=True` reports a reactivated successor after
113
+ the selected tab closes.
106
114
 
107
115
  ## Save and restore browser state
108
116
 
@@ -151,6 +159,30 @@ include base64-encoded binary bodies or `"none"` to record metadata. One
151
159
  recording can embed up to 64 MiB. Treat the HAR as sensitive when the page uses
152
160
  cookies, authorization headers, or account data.
153
161
 
162
+ ## Audit page accessibility
163
+
164
+ [`browser.diagnostics.accessibility()`](api.md#browserscripts-browserdiagnostics-and-browseractive_frame)
165
+ runs the embedded axe-core engine and returns typed violations, incomplete
166
+ checks, and rule counts:
167
+
168
+ ```python
169
+ from agentbrowser import Browser
170
+
171
+ with Browser.launch() as browser:
172
+ audit = browser.diagnostics.accessibility(
173
+ "https://example.com",
174
+ tags=("wcag2a", "wcag2aa"),
175
+ selector="main",
176
+ )
177
+
178
+ for issue in audit.violations:
179
+ print(issue.id, issue.impact, issue.node_count)
180
+ ```
181
+
182
+ Pass a URL to navigate before the audit or omit it to inspect the active page.
183
+ Each `AccessibilityNode.target` preserves axe selector paths as nested tuples
184
+ across frames and shadow roots. Audits require a CDP browser.
185
+
154
186
  ## Restrict domains and confirm actions
155
187
 
156
188
  [`SessionOptions.allowed_domains`](api.md#sessionoptions) checks navigation,
@@ -1,12 +1,19 @@
1
1
  [project]
2
2
  name = "pyagentbrowser"
3
- version = "0.32.3"
3
+ version = "0.33.0"
4
4
  description = "Python SDK for controlling the native agent-browser engine in-process"
5
5
  readme = "README.md"
6
6
  authors = [
7
7
  { name = "Péter Ferenc Gyarmati", email = "dev.petergy@gmail.com" }
8
8
  ]
9
9
  license = "Apache-2.0"
10
+ license-files = [
11
+ "LICENSE",
12
+ "NOTICE",
13
+ "third_party/agent-browser/LICENSE",
14
+ "third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core.txt",
15
+ "third_party/agent-browser/cli/src/native/a11y/LICENSE-axe-core-THIRD-PARTY.txt",
16
+ ]
10
17
  requires-python = ">=3.11,<3.15"
11
18
  classifiers = [
12
19
  "Development Status :: 3 - Alpha",
@@ -15,6 +15,10 @@ from agentbrowser.launch import (
15
15
  SessionOptions,
16
16
  )
17
17
  from agentbrowser.models import (
18
+ AccessibilityAudit,
19
+ AccessibilityCounts,
20
+ AccessibilityIssue,
21
+ AccessibilityNode,
18
22
  ActionResult,
19
23
  ActionTransitionError,
20
24
  AgentBrowserError,
@@ -40,7 +44,9 @@ from agentbrowser.models import (
40
44
  SessionStatus,
41
45
  SnapshotDiff,
42
46
  SnapshotSpec,
47
+ TabCloseResult,
43
48
  TabInfo,
49
+ TabSwitchResult,
44
50
  Wait,
45
51
  )
46
52
  from agentbrowser.query import Query
@@ -56,6 +62,10 @@ __agent_browser_version__ = __upstream_version__
56
62
  __agent_browser_commit__ = UPSTREAM_COMMIT
57
63
 
58
64
  __all__ = [
65
+ "AccessibilityAudit",
66
+ "AccessibilityCounts",
67
+ "AccessibilityIssue",
68
+ "AccessibilityNode",
59
69
  "ActionResult",
60
70
  "ActionTransitionError",
61
71
  "AgentBrowserError",
@@ -98,7 +108,9 @@ __all__ = [
98
108
  "SnapshotDiff",
99
109
  "SnapshotSpec",
100
110
  "StaleRefError",
111
+ "TabCloseResult",
101
112
  "TabInfo",
113
+ "TabSwitchResult",
102
114
  "Wait",
103
115
  "ensure_installed",
104
116
  "session_id",
@@ -12,6 +12,7 @@ from agentbrowser.models import BrowserError, JSONObject, JSONValue
12
12
 
13
13
  DENIED_CODE = "allowed_domains"
14
14
  URL_TARGET_FIELDS: dict[str, tuple[str, ...]] = {
15
+ "a11y": ("url",),
15
16
  "addscript": ("url",),
16
17
  "addstyle": ("url",),
17
18
  "auth_save": ("url",),
@@ -101,7 +101,12 @@ def action_clears_pending_confirmation(action: str) -> bool:
101
101
  return action in {"close", "confirm", "deny", INTERNAL_SHUTDOWN_ACTION}
102
102
 
103
103
 
104
- def action_invalidates_cdp(action: str) -> bool:
104
+ def action_invalidates_cdp(
105
+ action: str,
106
+ params: Mapping[str, Any] | None = None,
107
+ ) -> bool:
108
+ if action == "a11y":
109
+ return params is not None and isinstance(params.get("url"), str)
105
110
  return action in CDP_INVALIDATING_ACTIONS
106
111
 
107
112
 
@@ -0,0 +1,4 @@
1
+ {
2
+ "commit": "1ed371f3af472cc0d6cd8fdaea75d1a085ff7534",
3
+ "version": "0.33.0"
4
+ }
@@ -4,7 +4,7 @@ import json
4
4
  from pathlib import Path
5
5
 
6
6
  PACKAGE_NAME = "pyagentbrowser"
7
- PACKAGE_VERSION = "0.32.3"
7
+ PACKAGE_VERSION = "0.33.0"
8
8
 
9
9
  _UPSTREAM = json.loads(Path(__file__).with_name("_upstream.json").read_text())
10
10
  UPSTREAM_VERSION = str(_UPSTREAM["version"])
@@ -454,6 +454,7 @@ class Browser:
454
454
  self._close_result: CloseResult | None = None
455
455
  self._close_error: BaseException | None = None
456
456
  self._cdp_controller: CDPController | None = None
457
+ self._pending_cdp_invalidations: set[str] = set()
457
458
 
458
459
  command_target = cast(CommandTarget, weak_proxy(self))
459
460
  browser_proxy = cast(Browser, weak_proxy(self))
@@ -687,16 +688,37 @@ class Browser:
687
688
  if expect not in {"object", "any"}:
688
689
  raise ValueError('expect must be "object" or "any"')
689
690
  self._prepare_install_for_action(action, params)
691
+ pending_id, compound_invalidation = self._cdp_invalidation_context(action, params)
692
+ confirmation_consumed = False
690
693
  try:
691
- response = _checked_response(action, self._session.execute(action, **params))
694
+ raw_response = self._session.execute(action, **params)
695
+ confirmation_consumed = action == "confirm" and raw_response.success
696
+ response = _checked_response(action, raw_response)
692
697
  except ConfirmationRequired as err:
698
+ self._continue_cdp_invalidation(
699
+ pending_id,
700
+ err.confirmation_id,
701
+ compound_invalidation,
702
+ )
693
703
  if err.confirmation_id is not None:
694
704
  err.pending = self._pending_action(
695
705
  err,
696
706
  expect=cast(Literal["object", "any"], expect),
697
707
  )
698
708
  raise
699
- self._record_successful_action(response)
709
+ except BaseException:
710
+ if compound_invalidation:
711
+ self._invalidate_cdp()
712
+ if pending_id is not None and confirmation_consumed:
713
+ self._pending_cdp_invalidations.discard(pending_id)
714
+ raise
715
+ if pending_id is not None and (action == "deny" or confirmation_consumed):
716
+ self._pending_cdp_invalidations.discard(pending_id)
717
+ self._record_successful_action(
718
+ response,
719
+ params=params,
720
+ force_cdp_invalidation=compound_invalidation,
721
+ )
700
722
  if expect == "any":
701
723
  return response.data
702
724
  return _require_response_data_mapping(response)
@@ -704,19 +726,46 @@ class Browser:
704
726
  def _native_execute(self, action: str, **params: Any) -> BrowserResponse:
705
727
  self._ensure_open()
706
728
  self._prepare_install_for_action(action, params)
707
- response = self._session.execute(action, **params)
729
+ pending_id, compound_invalidation = self._cdp_invalidation_context(action, params)
730
+ try:
731
+ response = self._session.execute(action, **params)
732
+ except BaseException:
733
+ if compound_invalidation:
734
+ self._invalidate_cdp()
735
+ raise
708
736
  confirmation_consumed = action == "confirm" and response.success
709
737
  if confirmation_consumed:
710
738
  response = _try_unwrap_confirmed_response(response)
711
739
  data = response_data_mapping(response)
712
740
  if data is not None and bool(data.get("confirmation_required")):
741
+ self._continue_cdp_invalidation(
742
+ pending_id,
743
+ response_confirmation_id(response),
744
+ compound_invalidation,
745
+ )
713
746
  return response
747
+ if pending_id is not None and (
748
+ (action == "deny" and response.success) or confirmation_consumed
749
+ ):
750
+ self._pending_cdp_invalidations.discard(pending_id)
714
751
  if confirmation_consumed:
715
752
  if response.success:
716
- self._record_successful_action(response)
753
+ self._record_successful_action(
754
+ response,
755
+ params=params,
756
+ force_cdp_invalidation=compound_invalidation,
757
+ )
758
+ elif compound_invalidation:
759
+ self._invalidate_cdp()
717
760
  return response
718
761
  if response.success:
719
- self._record_successful_action(response)
762
+ self._record_successful_action(
763
+ response,
764
+ params=params,
765
+ force_cdp_invalidation=compound_invalidation,
766
+ )
767
+ elif compound_invalidation and action == "a11y":
768
+ self._invalidate_cdp()
720
769
  return response
721
770
 
722
771
  def _pending_action(
@@ -750,7 +799,40 @@ class Browser:
750
799
  _expect=expect,
751
800
  )
752
801
 
753
- def _record_successful_action(self, response: BrowserResponse) -> None:
802
+ def _cdp_invalidation_context(
803
+ self,
804
+ action: str,
805
+ params: Mapping[str, Any],
806
+ ) -> tuple[str | None, bool]:
807
+ confirmation_value = (
808
+ params.get("confirmation_id") if action in {"confirm", "deny"} else None
809
+ )
810
+ pending_id = str(confirmation_value) if confirmation_value is not None else None
811
+ # URL audits navigate before axe runs. Preserve that lifecycle fact
812
+ # across confirmation because the confirmed response omits the URL.
813
+ compound_invalidation = action == "a11y" and action_invalidates_cdp(action, params)
814
+ if action == "confirm" and pending_id in self._pending_cdp_invalidations:
815
+ compound_invalidation = True
816
+ return pending_id, compound_invalidation
817
+
818
+ def _continue_cdp_invalidation(
819
+ self,
820
+ previous_id: str | None,
821
+ next_id: str | None,
822
+ enabled: bool,
823
+ ) -> None:
824
+ if previous_id is not None:
825
+ self._pending_cdp_invalidations.discard(previous_id)
826
+ if enabled and next_id is not None:
827
+ self._pending_cdp_invalidations.add(next_id)
828
+
829
+ def _record_successful_action(
830
+ self,
831
+ response: BrowserResponse,
832
+ *,
833
+ params: Mapping[str, Any] | None = None,
834
+ force_cdp_invalidation: bool = False,
835
+ ) -> None:
754
836
  action = response.action
755
837
  browser_launched = response_browser_launched(response)
756
838
  if browser_launched is not None:
@@ -759,9 +841,11 @@ class Browser:
759
841
  self._launched = True
760
842
  elif action_clears_pending_confirmation(action) and action_closes_browser(action):
761
843
  self._launched = False
844
+ if action_closes_browser(action):
845
+ self._pending_cdp_invalidations.clear()
762
846
  if action_resets_cdp(action):
763
847
  self._reset_cdp()
764
- elif action_invalidates_cdp(action):
848
+ elif force_cdp_invalidation or action_invalidates_cdp(action, params):
765
849
  self._invalidate_cdp()
766
850
 
767
851
  def _cdp(self) -> CDPController:
@@ -433,6 +433,7 @@ class AsyncBrowser:
433
433
  self._launched = False
434
434
  self._close_task: asyncio.Task[CloseResult] | None = None
435
435
  self._cdp_controller: AsyncCDPController | None = None
436
+ self._pending_cdp_invalidations: set[str] = set()
436
437
 
437
438
  command_target = cast(AsyncCommandTarget, weak_proxy(self))
438
439
  browser_proxy = cast(AsyncBrowser, weak_proxy(self))
@@ -658,35 +659,83 @@ class AsyncBrowser:
658
659
  if expect not in {"object", "any"}:
659
660
  raise ValueError('expect must be "object" or "any"')
660
661
  await self._prepare_install_for_action(action, params)
662
+ pending_id, compound_invalidation = self._cdp_invalidation_context(action, params)
663
+ confirmation_consumed = False
661
664
  try:
662
- response = _checked_response(action, await self._session.execute(action, **params))
665
+ raw_response = await self._session.execute(action, **params)
666
+ confirmation_consumed = action == "confirm" and raw_response.success
667
+ response = _checked_response(action, raw_response)
663
668
  except ConfirmationRequired as err:
669
+ self._continue_cdp_invalidation(
670
+ pending_id,
671
+ err.confirmation_id,
672
+ compound_invalidation,
673
+ )
664
674
  if err.confirmation_id is not None:
665
675
  err.pending = self._pending_action(
666
676
  err,
667
677
  expect=cast(Literal["object", "any"], expect),
668
678
  )
669
679
  raise
670
- await self._record_successful_action(response)
680
+ except BaseException:
681
+ if compound_invalidation:
682
+ self._invalidate_cdp()
683
+ if pending_id is not None and confirmation_consumed:
684
+ self._pending_cdp_invalidations.discard(pending_id)
685
+ raise
686
+ if pending_id is not None and (action == "deny" or confirmation_consumed):
687
+ self._pending_cdp_invalidations.discard(pending_id)
688
+ await self._record_successful_action(
689
+ response,
690
+ params=params,
691
+ force_cdp_invalidation=compound_invalidation,
692
+ )
671
693
  if expect == "any":
672
694
  return response.data
673
695
  return _require_response_data_mapping(response)
674
696
 
675
697
  async def _native_execute(self, action: str, **params: Any) -> BrowserResponse:
676
698
  await self._prepare_install_for_action(action, params)
677
- response = await self._session.execute(action, **params)
699
+ pending_id, compound_invalidation = self._cdp_invalidation_context(action, params)
700
+ try:
701
+ response = await self._session.execute(action, **params)
702
+ except BaseException:
703
+ if compound_invalidation:
704
+ self._invalidate_cdp()
705
+ raise
678
706
  confirmation_consumed = action == "confirm" and response.success
679
707
  if confirmation_consumed:
680
708
  response = _try_unwrap_confirmed_response(response)
681
709
  data = response_data_mapping(response)
682
710
  if data is not None and bool(data.get("confirmation_required")):
711
+ self._continue_cdp_invalidation(
712
+ pending_id,
713
+ response_confirmation_id(response),
714
+ compound_invalidation,
715
+ )
683
716
  return response
717
+ if pending_id is not None and (
718
+ (action == "deny" and response.success) or confirmation_consumed
719
+ ):
720
+ self._pending_cdp_invalidations.discard(pending_id)
684
721
  if confirmation_consumed:
685
722
  if response.success:
686
- await self._record_successful_action(response)
723
+ await self._record_successful_action(
724
+ response,
725
+ params=params,
726
+ force_cdp_invalidation=compound_invalidation,
727
+ )
728
+ elif compound_invalidation:
729
+ self._invalidate_cdp()
687
730
  return response
688
731
  if response.success:
689
- await self._record_successful_action(response)
732
+ await self._record_successful_action(
733
+ response,
734
+ params=params,
735
+ force_cdp_invalidation=compound_invalidation,
736
+ )
737
+ elif compound_invalidation and action == "a11y":
738
+ self._invalidate_cdp()
690
739
  return response
691
740
 
692
741
  def _pending_action(
@@ -720,7 +769,40 @@ class AsyncBrowser:
720
769
  _expect=expect,
721
770
  )
722
771
 
723
- async def _record_successful_action(self, response: BrowserResponse) -> None:
772
+ def _cdp_invalidation_context(
773
+ self,
774
+ action: str,
775
+ params: Mapping[str, Any],
776
+ ) -> tuple[str | None, bool]:
777
+ confirmation_value = (
778
+ params.get("confirmation_id") if action in {"confirm", "deny"} else None
779
+ )
780
+ pending_id = str(confirmation_value) if confirmation_value is not None else None
781
+ # URL audits navigate before axe runs. Preserve that lifecycle fact
782
+ # across confirmation because the confirmed response omits the URL.
783
+ compound_invalidation = action == "a11y" and action_invalidates_cdp(action, params)
784
+ if action == "confirm" and pending_id in self._pending_cdp_invalidations:
785
+ compound_invalidation = True
786
+ return pending_id, compound_invalidation
787
+
788
+ def _continue_cdp_invalidation(
789
+ self,
790
+ previous_id: str | None,
791
+ next_id: str | None,
792
+ enabled: bool,
793
+ ) -> None:
794
+ if previous_id is not None:
795
+ self._pending_cdp_invalidations.discard(previous_id)
796
+ if enabled and next_id is not None:
797
+ self._pending_cdp_invalidations.add(next_id)
798
+
799
+ async def _record_successful_action(
800
+ self,
801
+ response: BrowserResponse,
802
+ *,
803
+ params: Mapping[str, Any] | None = None,
804
+ force_cdp_invalidation: bool = False,
805
+ ) -> None:
724
806
  action = response.action
725
807
  browser_launched = response_browser_launched(response)
726
808
  if browser_launched is not None:
@@ -729,9 +811,11 @@ class AsyncBrowser:
729
811
  self._launched = True
730
812
  elif action_clears_pending_confirmation(action) and action_closes_browser(action):
731
813
  self._launched = False
814
+ if action_closes_browser(action):
815
+ self._pending_cdp_invalidations.clear()
732
816
  if action_resets_cdp(action):
733
817
  await self._reset_cdp()
734
- elif action_invalidates_cdp(action):
818
+ elif force_cdp_invalidation or action_invalidates_cdp(action, params):
735
819
  self._invalidate_cdp()
736
820
 
737
821
  def _cdp(self) -> AsyncCDPController:
@@ -148,6 +148,29 @@ def read_params(
148
148
  }
149
149
 
150
150
 
151
+ def accessibility_audit_params(
152
+ url: str | None = None,
153
+ *,
154
+ tags: Sequence[str] = (),
155
+ selector: str | None = None,
156
+ ) -> dict[str, Any]:
157
+ if isinstance(tags, (str, bytes)):
158
+ raise TypeError("tags must be a sequence of strings")
159
+ normalized_tags: list[str] = []
160
+ for tag in tags:
161
+ if not isinstance(tag, str):
162
+ raise TypeError("tags must contain strings")
163
+ normalized = tag.strip()
164
+ if not normalized or "," in normalized:
165
+ raise ValueError("tags must contain non-empty axe tag names")
166
+ normalized_tags.append(normalized)
167
+ return {
168
+ "url": optional(url),
169
+ "tags": optional(",".join(normalized_tags) or None),
170
+ "selector": optional(selector),
171
+ }
172
+
173
+
151
174
  def har_start_params(content: HarContentMode = "text") -> dict[str, HarContentMode]:
152
175
  if not isinstance(content, str) or content not in HAR_CONTENT_MODES:
153
176
  raise ValueError("content must be 'all', 'text', or 'none'")