mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 05:37:20 +03:00
api(dotnet): use jsonelement (#6749)
This commit is contained in:
parent
c60974d922
commit
792f3d41e9
@ -98,27 +98,8 @@ function findFocusedNode(node) {
|
||||
```
|
||||
|
||||
```csharp
|
||||
static AccessibilitySnapshotResult findFocusedNode(AccessibilitySnapshotResult root)
|
||||
{
|
||||
var nodes = new Stack<AccessibilitySnapshotResult>(new[] { root });
|
||||
while (nodes.Count > 0)
|
||||
{
|
||||
var node = nodes.Pop();
|
||||
if (node.Focused) return node;
|
||||
foreach (var innerNode in node.Children)
|
||||
{
|
||||
nodes.Push(innerNode);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var accessibilitySnapshot = await page.Accessibility.SnapshotAsync();
|
||||
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));
|
||||
var focusedNode = findFocusedNode(accessibilitySnapshot);
|
||||
if (focusedNode != null)
|
||||
Console.WriteLine(focusedNode.Name);
|
||||
```
|
||||
|
||||
```java
|
||||
|
@ -32,7 +32,7 @@ This method will throw if the response body is not parsable via `JSON.parse`.
|
||||
|
||||
## async method: Response.json
|
||||
* langs: csharp
|
||||
- returns: <[JsonDocument]>
|
||||
- returns: <[JsonElement?]>
|
||||
|
||||
Returns the JSON representation of response body.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
## method: Request.PostDataJSON
|
||||
* langs: csharp
|
||||
- returns: <[JsonDocument]>
|
||||
- returns: <[JsonElement?]>
|
||||
|
||||
Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user