docs: fixing example code in accessibility API docs (#12664)
Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
This commit is contained in:
parent
04e9d2ec08
commit
ab39cfcb18
|
|
@ -91,7 +91,8 @@ function findFocusedNode(node) {
|
|||
return node;
|
||||
for (const child of node.children || []) {
|
||||
const foundNode = findFocusedNode(child);
|
||||
return foundNode;
|
||||
if (foundNode)
|
||||
return foundNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -113,7 +114,8 @@ def find_focused_node(node):
|
|||
return node
|
||||
for child in (node.get("children") or []):
|
||||
found_node = find_focused_node(child)
|
||||
return found_node
|
||||
if (found_node)
|
||||
return found_node
|
||||
return None
|
||||
|
||||
snapshot = await page.accessibility.snapshot()
|
||||
|
|
@ -128,7 +130,8 @@ def find_focused_node(node):
|
|||
return node
|
||||
for child in (node.get("children") or []):
|
||||
found_node = find_focused_node(child)
|
||||
return found_node
|
||||
if (found_node)
|
||||
return found_node
|
||||
return None
|
||||
|
||||
snapshot = page.accessibility.snapshot()
|
||||
|
|
@ -153,4 +156,4 @@ Prune uninteresting nodes from the tree. Defaults to `true`.
|
|||
### option: Accessibility.snapshot.root
|
||||
- `root` <[ElementHandle]>
|
||||
|
||||
The root DOM element for the snapshot. Defaults to the whole page.
|
||||
The root DOM element for the snapshot. Defaults to the whole page.
|
||||
|
|
|
|||
3
packages/playwright-core/types/types.d.ts
vendored
3
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -10661,7 +10661,8 @@ export interface Accessibility {
|
|||
* return node;
|
||||
* for (const child of node.children || []) {
|
||||
* const foundNode = findFocusedNode(child);
|
||||
* return foundNode;
|
||||
* if (foundNode)
|
||||
* return foundNode;
|
||||
* }
|
||||
* return null;
|
||||
* }
|
||||
|
|
|
|||
Loading…
Reference in a new issue