Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: fix dotnet RegisterAsync/python jshandle example (#18408)

Max Schmitt445404abb705
diff --git a/docs/src/api/class-jshandle.md b/docs/src/api/class-jshandle.md
index ec321d27c1..37467beab0 100644
--- a/docs/src/api/class-jshandle.md
+++ b/docs/src/api/class-jshandle.md
@@ -140,7 +140,7 @@ handle.dispose();
```
```python async
-handle = await page.evaluate_handle("{window, document}")
+handle = await page.evaluate_handle("({window, document})")
properties = await handle.get_properties()
window_handle = properties.get("window")
document_handle = properties.get("document")
@@ -148,7 +148,7 @@ await handle.dispose()
```
```python sync
-handle = page.evaluate_handle("{window, document}")
+handle = page.evaluate_handle("({window, document})")
properties = handle.get_properties()
window_handle = properties.get("window")
document_handle = properties.get("document")
diff --git a/docs/src/api/class-selectors.md b/docs/src/api/class-selectors.md
index 9b4705e1d3..d6fe8381fd 100644
--- a/docs/src/api/class-selectors.md
+++ b/docs/src/api/class-selectors.md
@@ -145,18 +145,23 @@ with sync_playwright() as playwright:
```
```csharp
+using Microsoft.Playwright;
+
using var playwright = await Playwright.CreateAsync();
// Script that evaluates to a selector engine instance. The script is evaluated in the page context.
-await playwright.Selectors.RegisterAsync("tag", @"{
-// Returns the first element matching given selector in the root's subtree.
-query(root, selector) {
- return root.querySelector(selector);
- },
- // Returns all elements matching given selector in the root's subtree.
- queryAll(root, selector) {
- return Array.from(root.querySelectorAll(selector));
- }
-}");
+await playwright.Selectors.RegisterAsync("tag", new()
+{
+ Script = @"{
+ // Returns the first element matching given selector in the root's subtree.
+ query(root, selector) {
+ return root.querySelector(selector);
+ },
+ // Returns all elements matching given selector in the root's subtree.
+ queryAll(root, selector) {
+ return Array.from(root.querySelectorAll(selector));
+ }
+ }"
+});
await using var browser = await playwright.Chromium.LaunchAsync();
var page = await browser.NewPageAsync();