api(dotnet): use jsonelement (#6749)

This commit is contained in:
Pavel Feldman 2021-05-26 07:28:26 -07:00 committed by GitHub
parent c60974d922
commit 792f3d41e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 21 deletions

View File

@ -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

View File

@ -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.

View File

@ -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.