-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[docs]: add docs for page.snapshot()
#1589
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
Greptile SummaryDocumented the new The documentation includes:
The documentation follows the existing patterns in the file and provides clear, actionable examples for developers. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Stagehand
participant Page
participant captureHybridSnapshot
participant DOM
User->>Stagehand: new Stagehand()
User->>Stagehand: await init()
User->>Stagehand: stagehand.context.pages()[0]
Stagehand-->>User: page
User->>Page: await page.goto("https://example.com")
Page->>DOM: Navigate to URL
DOM-->>Page: Page loaded
User->>Page: await page.snapshot()
Page->>captureHybridSnapshot: captureHybridSnapshot(page, { pierceShadow: true })
captureHybridSnapshot->>DOM: Extract accessibility tree
DOM-->>captureHybridSnapshot: Accessibility tree data
captureHybridSnapshot-->>Page: { combinedTree, combinedXpathMap, combinedUrlMap }
Page-->>User: { formattedTree, xpathMap, urlMap }
User->>User: console.log(formattedTree)
User->>User: Use xpathMap["0-8"] to get XPath
User->>User: Use urlMap["0-8"] to get URL
|
# why New public method `page.snapshot()` # what changed Add documentation for the new page.snapshot() method in the v3 reference docs: - Method signature and description - Example output showing the formatted accessibility tree - Usage example with formattedTree, xpathMap, and urlMap - SnapshotResult type definition with field descriptions - Code example in the tabs section # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Documented the new page.snapshot() API in the v3 reference. Shows how to capture the accessibility tree and get XPath/URL mappings for debugging and automation. - **New Features** - Added method signature and return type. - Included example output and usage with formattedTree, xpathMap, and urlMap. - Defined SnapshotResult and added a tabbed code sample. <sup>Written for commit 39e0d29. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> Co-authored-by: Chromie Bot <chromie@browserbase.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Update snapshot() method documentation to include the new optional PageSnapshotOptions parameter with includeIframes option. Changes: - Update method signature to show optional options parameter - Add ParamField for includeIframes option (defaults to true) - Add PageSnapshotOptions type definition in Types section - Add example showing iframe exclusion in code examples # why # what changed # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Update page.snapshot() docs to show the new optional PageSnapshotOptions, including the includeIframes flag (default true) to control iframe content. Adds the options parameter in the signature, documents includeIframes, defines PageSnapshotOptions in Types, and includes an example excluding iframe content. <sup>Written for commit 3bffc93. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: Chromie Bot <chromie@browserbase.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2bbaee0 to
012e5ce
Compare
page.snapshot() (#1579)page.snapshot()
why
New public method
page.snapshot()what changed
Add documentation for the new page.snapshot() method in the v3 reference docs:
test plan
Summary by cubic
Documented the new page.snapshot() API in the v3 reference. Shows how to capture the accessibility tree and get XPath/URL mappings for debugging and automation.
Written for commit 012e5ce. Summary will update on new commits. Review in cubic
why
what changed
test plan