playwright-ruby-client 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/docs/api_coverage.md +10 -1
  4. data/lib/playwright/channel_owner.rb +3 -0
  5. data/lib/playwright/channel_owners/browser.rb +27 -2
  6. data/lib/playwright/channel_owners/browser_context.rb +52 -1
  7. data/lib/playwright/channel_owners/browser_type.rb +8 -1
  8. data/lib/playwright/channel_owners/element_handle.rb +15 -6
  9. data/lib/playwright/channel_owners/frame.rb +23 -6
  10. data/lib/playwright/channel_owners/page.rb +25 -44
  11. data/lib/playwright/download.rb +3 -2
  12. data/lib/playwright/events.rb +4 -0
  13. data/lib/playwright/playwright_api.rb +1 -5
  14. data/lib/playwright/tracing_impl.rb +31 -0
  15. data/lib/playwright/version.rb +2 -1
  16. data/lib/playwright_api/accessibility.rb +8 -7
  17. data/lib/playwright_api/android.rb +7 -7
  18. data/lib/playwright_api/android_device.rb +6 -6
  19. data/lib/playwright_api/browser.rb +49 -6
  20. data/lib/playwright_api/browser_context.rb +205 -9
  21. data/lib/playwright_api/browser_type.rb +48 -9
  22. data/lib/playwright_api/console_message.rb +8 -6
  23. data/lib/playwright_api/dialog.rb +29 -6
  24. data/lib/playwright_api/element_handle.rb +130 -26
  25. data/lib/playwright_api/file_chooser.rb +7 -0
  26. data/lib/playwright_api/frame.rb +200 -27
  27. data/lib/playwright_api/js_handle.rb +23 -6
  28. data/lib/playwright_api/keyboard.rb +48 -0
  29. data/lib/playwright_api/page.rb +514 -44
  30. data/lib/playwright_api/playwright.rb +24 -6
  31. data/lib/playwright_api/request.rb +34 -6
  32. data/lib/playwright_api/response.rb +8 -8
  33. data/lib/playwright_api/route.rb +28 -8
  34. data/lib/playwright_api/selectors.rb +31 -6
  35. data/lib/playwright_api/tracing.rb +99 -0
  36. data/lib/playwright_api/worker.rb +2 -2
  37. data/playwright.gemspec +2 -2
  38. metadata +6 -18
@@ -64,8 +64,46 @@ module Playwright
64
64
  # with sync_playwright() as playwright:
65
65
  # run(playwright)
66
66
  # ```
67
+ #
68
+ # ```csharp
69
+ # using Microsoft.Playwright;
70
+ # using System.Threading.Tasks;
71
+ #
72
+ # class BrowserTypeExamples
73
+ # {
74
+ # public static async Task Run()
75
+ # {
76
+ # using var playwright = await Playwright.CreateAsync();
77
+ # var chromium = playwright.Chromium;
78
+ # var browser = await chromium.LaunchAsync();
79
+ # var page = await browser.NewPageAsync();
80
+ # await page.GoToAsync("https://www.bing.com");
81
+ # // other actions
82
+ # await browser.CloseAsync();
83
+ # }
84
+ # }
85
+ # ```
67
86
  class BrowserType < PlaywrightApi
68
87
 
88
+ # This methods attaches Playwright to an existing browser instance.
89
+ def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
90
+ raise NotImplementedError.new('connect is not implemented yet.')
91
+ end
92
+
93
+ # This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
94
+ #
95
+ # The default browser context is accessible via [`method: Browser.contexts`].
96
+ #
97
+ # > NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
98
+ def connect_over_cdp(
99
+ endpointURL,
100
+ headers: nil,
101
+ slowMo: nil,
102
+ timeout: nil,
103
+ &block)
104
+ wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
105
+ end
106
+
69
107
  # A path where Playwright expects to find a bundled browser executable.
70
108
  def executable_path
71
109
  wrap_impl(@impl.executable_path)
@@ -100,6 +138,10 @@ module Playwright
100
138
  # )
101
139
  # ```
102
140
  #
141
+ # ```csharp
142
+ # var browser = await playwright.Chromium.LaunchAsync(ignoreDefaultArgs: new[] { "--mute-audio" })
143
+ # ```
144
+ #
103
145
  # > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
104
146
  # best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use
105
147
  # `executablePath` option with extreme caution.
@@ -131,8 +173,9 @@ module Playwright
131
173
  proxy: nil,
132
174
  slowMo: nil,
133
175
  timeout: nil,
176
+ traceDir: nil,
134
177
  &block)
135
- wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
178
+ wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), traceDir: unwrap_impl(traceDir), &wrap_block_call(block)))
136
179
  end
137
180
 
138
181
  # Returns the persistent browser context instance.
@@ -177,6 +220,7 @@ module Playwright
177
220
  slowMo: nil,
178
221
  timeout: nil,
179
222
  timezoneId: nil,
223
+ traceDir: nil,
180
224
  userAgent: nil,
181
225
  viewport: nil)
182
226
  raise NotImplementedError.new('launch_persistent_context is not implemented yet.')
@@ -187,9 +231,10 @@ module Playwright
187
231
  wrap_impl(@impl.name)
188
232
  end
189
233
 
234
+ # -- inherited from EventEmitter --
190
235
  # @nodoc
191
- def connect_over_cdp(endpointURL, slowMo: nil, timeout: nil, &block)
192
- wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
236
+ def off(event, callback)
237
+ event_emitter_proxy.off(event, callback)
193
238
  end
194
239
 
195
240
  # -- inherited from EventEmitter --
@@ -204,12 +249,6 @@ module Playwright
204
249
  event_emitter_proxy.on(event, callback)
205
250
  end
206
251
 
207
- # -- inherited from EventEmitter --
208
- # @nodoc
209
- def off(event, callback)
210
- event_emitter_proxy.off(event, callback)
211
- end
212
-
213
252
  private def event_emitter_proxy
214
253
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
215
254
  end
@@ -2,6 +2,7 @@ module Playwright
2
2
  # `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.
3
3
  class ConsoleMessage < PlaywrightApi
4
4
 
5
+ # List of arguments passed to a `console` function call. See also [`event: Page.console`].
5
6
  def args
6
7
  wrap_impl(@impl.args)
7
8
  end
@@ -10,6 +11,7 @@ module Playwright
10
11
  wrap_impl(@impl.location)
11
12
  end
12
13
 
14
+ # The text of the console message.
13
15
  def text
14
16
  wrap_impl(@impl.text)
15
17
  end
@@ -23,20 +25,20 @@ module Playwright
23
25
 
24
26
  # -- inherited from EventEmitter --
25
27
  # @nodoc
26
- def once(event, callback)
27
- event_emitter_proxy.once(event, callback)
28
+ def off(event, callback)
29
+ event_emitter_proxy.off(event, callback)
28
30
  end
29
31
 
30
32
  # -- inherited from EventEmitter --
31
33
  # @nodoc
32
- def on(event, callback)
33
- event_emitter_proxy.on(event, callback)
34
+ def once(event, callback)
35
+ event_emitter_proxy.once(event, callback)
34
36
  end
35
37
 
36
38
  # -- inherited from EventEmitter --
37
39
  # @nodoc
38
- def off(event, callback)
39
- event_emitter_proxy.off(event, callback)
40
+ def on(event, callback)
41
+ event_emitter_proxy.on(event, callback)
40
42
  end
41
43
 
42
44
  private def event_emitter_proxy
@@ -80,6 +80,29 @@ module Playwright
80
80
  # run(playwright)
81
81
  # ```
82
82
  #
83
+ # ```csharp
84
+ # using Microsoft.Playwright;
85
+ # using System.Threading.Tasks;
86
+ #
87
+ # class DialogExample
88
+ # {
89
+ # public static async Task Run()
90
+ # {
91
+ # using var playwright = await Playwright.CreateAsync();
92
+ # await using var browser = await playwright.Chromium.LaunchAsync();
93
+ # var page = await browser.NewPageAsync();
94
+ #
95
+ # page.Dialog += async (_, dialog) =>
96
+ # {
97
+ # System.Console.WriteLine(dialog.Message);
98
+ # await dialog.DismissAsync();
99
+ # };
100
+ #
101
+ # await page.EvaluateAsync("alert('1');");
102
+ # }
103
+ # }
104
+ # ```
105
+ #
83
106
  # > NOTE: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener. When listener is
84
107
  # present, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will
85
108
  # [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and
@@ -118,20 +141,20 @@ module Playwright
118
141
 
119
142
  # -- inherited from EventEmitter --
120
143
  # @nodoc
121
- def once(event, callback)
122
- event_emitter_proxy.once(event, callback)
144
+ def off(event, callback)
145
+ event_emitter_proxy.off(event, callback)
123
146
  end
124
147
 
125
148
  # -- inherited from EventEmitter --
126
149
  # @nodoc
127
- def on(event, callback)
128
- event_emitter_proxy.on(event, callback)
150
+ def once(event, callback)
151
+ event_emitter_proxy.once(event, callback)
129
152
  end
130
153
 
131
154
  # -- inherited from EventEmitter --
132
155
  # @nodoc
133
- def off(event, callback)
134
- event_emitter_proxy.off(event, callback)
156
+ def on(event, callback)
157
+ event_emitter_proxy.on(event, callback)
135
158
  end
136
159
 
137
160
  private def event_emitter_proxy
@@ -73,6 +73,24 @@ module Playwright
73
73
  # run(playwright)
74
74
  # ```
75
75
  #
76
+ # ```csharp
77
+ # using Microsoft.Playwright;
78
+ # using System.Threading.Tasks;
79
+ #
80
+ # class HandleExamples
81
+ # {
82
+ # public static async Task Run()
83
+ # {
84
+ # using var playwright = await Playwright.CreateAsync();
85
+ # var browser = await playwright.Chromium.LaunchAsync(headless: false);
86
+ # var page = await browser.NewPageAsync();
87
+ # await page.GotoAsync("https://www.bing.com");
88
+ # var handle = await page.QuerySelectorAsync("a");
89
+ # await handle.ClickAsync();
90
+ # }
91
+ # }
92
+ # ```
93
+ #
76
94
  # ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
77
95
  # [`method: JSHandle.dispose`]. ElementHandles are auto-disposed when their origin frame gets navigated.
78
96
  #
@@ -113,6 +131,11 @@ module Playwright
113
131
  # box = element_handle.bounding_box()
114
132
  # page.mouse.click(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2)
115
133
  # ```
134
+ #
135
+ # ```csharp
136
+ # var box = await elementHandle.BoundingBoxAsync();
137
+ # await page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2);
138
+ # ```
116
139
  def bounding_box
117
140
  wrap_impl(@impl.bounding_box)
118
141
  end
@@ -130,8 +153,13 @@ module Playwright
130
153
  #
131
154
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
132
155
  # zero timeout disables this.
133
- def check(force: nil, noWaitAfter: nil, position: nil, timeout: nil)
134
- wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
156
+ def check(
157
+ force: nil,
158
+ noWaitAfter: nil,
159
+ position: nil,
160
+ timeout: nil,
161
+ trial: nil)
162
+ wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
135
163
  end
136
164
 
137
165
  # This method clicks the element by performing the following steps:
@@ -152,8 +180,9 @@ module Playwright
152
180
  modifiers: nil,
153
181
  noWaitAfter: nil,
154
182
  position: nil,
155
- timeout: nil)
156
- wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
183
+ timeout: nil,
184
+ trial: nil)
185
+ wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
157
186
  end
158
187
 
159
188
  # Returns the content frame for element handles referencing iframe nodes, or `null` otherwise
@@ -181,8 +210,9 @@ module Playwright
181
210
  modifiers: nil,
182
211
  noWaitAfter: nil,
183
212
  position: nil,
184
- timeout: nil)
185
- wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
213
+ timeout: nil,
214
+ trial: nil)
215
+ wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
186
216
  end
187
217
 
188
218
  # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
@@ -206,6 +236,10 @@ module Playwright
206
236
  # element_handle.dispatch_event("click")
207
237
  # ```
208
238
  #
239
+ # ```csharp
240
+ # await elementHandle.DispatchEventAsync("click");
241
+ # ```
242
+ #
209
243
  # Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties
210
244
  # and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.
211
245
  #
@@ -246,6 +280,14 @@ module Playwright
246
280
  # data_transfer = page.evaluate_handle("new DataTransfer()")
247
281
  # element_handle.dispatch_event("#source", "dragstart", {"dataTransfer": data_transfer})
248
282
  # ```
283
+ #
284
+ # ```csharp
285
+ # var handle = await page.EvaluateHandleAsync("() => new DataTransfer()");
286
+ # await handle.AsElement.DispatchEventAsync("dragstart", new Dictionary<string, object>
287
+ # {
288
+ # { "dataTransfer", dataTransfer }
289
+ # });
290
+ # ```
249
291
  def dispatch_event(type, eventInit: nil)
250
292
  wrap_impl(@impl.dispatch_event(unwrap_impl(type), eventInit: unwrap_impl(eventInit)))
251
293
  end
@@ -285,6 +327,12 @@ module Playwright
285
327
  # assert tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
286
328
  # assert tweet_handle.eval_on_selector(".retweets", "node => node.innerText") = "10"
287
329
  # ```
330
+ #
331
+ # ```csharp
332
+ # var tweetHandle = await page.QuerySelectorAsync(".tweet");
333
+ # Assert.Equals("100", await tweetHandle.EvalOnSelectorAsync(".like", "node => node.innerText"));
334
+ # Assert.Equals("10", await tweetHandle.EvalOnSelectorAsync(".retweets", "node => node.innerText"));
335
+ # ```
288
336
  def eval_on_selector(selector, expression, arg: nil)
289
337
  wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg)))
290
338
  end
@@ -326,15 +374,24 @@ module Playwright
326
374
  # feed_handle = page.query_selector(".feed")
327
375
  # assert feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
328
376
  # ```
377
+ #
378
+ # ```csharp
379
+ # var feedHandle = await page.QuerySelectorAsync(".feed");
380
+ # Assert.Equals(new [] { "Hello!", "Hi!" }, await feedHandle.EvalOnSelectorAllAsync<string[]>(".tweet", "nodes => nodes.map(n => n.innerText)"));
381
+ # ```
329
382
  def eval_on_selector_all(selector, expression, arg: nil)
330
383
  wrap_impl(@impl.eval_on_selector_all(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg)))
331
384
  end
332
385
 
333
386
  # This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input`
334
- # event after filling. If the element is inside the `<label>` element that has associated
335
- # [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), that control will be filled
336
- # instead. If the element to be filled is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method
337
- # throws an error. Note that you can pass an empty string to clear the input field.
387
+ # event after filling. Note that you can pass an empty string to clear the input field.
388
+ #
389
+ # If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
390
+ # However, if the element is inside the `<label>` element that has an associated
391
+ # [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
392
+ # instead.
393
+ #
394
+ # To send fine-grained keyboard events, use [`method: ElementHandle.type`].
338
395
  def fill(value, noWaitAfter: nil, timeout: nil)
339
396
  wrap_impl(@impl.fill(unwrap_impl(value), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
340
397
  end
@@ -360,8 +417,13 @@ module Playwright
360
417
  #
361
418
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
362
419
  # zero timeout disables this.
363
- def hover(force: nil, modifiers: nil, position: nil, timeout: nil)
364
- wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
420
+ def hover(
421
+ force: nil,
422
+ modifiers: nil,
423
+ position: nil,
424
+ timeout: nil,
425
+ trial: nil)
426
+ wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
365
427
  end
366
428
 
367
429
  # Returns the `element.innerHTML`.
@@ -466,12 +528,16 @@ module Playwright
466
528
  wrap_impl(@impl.scroll_into_view_if_needed(timeout: unwrap_impl(timeout)))
467
529
  end
468
530
 
469
- # Returns the array of option values that have been successfully selected.
531
+ # This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the
532
+ # `<select>` element and selects these options.
533
+ #
534
+ # If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
535
+ # `<label>` element that has an associated
536
+ # [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
470
537
  #
471
- # Triggers a `change` and `input` event once all the provided options have been selected. If element is not a `<select>`
472
- # element, the method throws an error.
538
+ # Returns the array of option values that have been successfully selected.
473
539
  #
474
- # Will wait until all specified options are present in the `<select>` element.
540
+ # Triggers a `change` and `input` event once all the provided options have been selected.
475
541
  #
476
542
  #
477
543
  # ```js
@@ -522,6 +588,20 @@ module Playwright
522
588
  # # multiple selection for blue, red and second option
523
589
  # handle.select_option(value="blue", { index: 2 }, "red")
524
590
  # ```
591
+ #
592
+ # ```csharp
593
+ # // single selection matching the value
594
+ # await handle.SelectOptionAsync(new[] { "blue" });
595
+ # // single selection matching the label
596
+ # await handle.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });
597
+ # // multiple selection
598
+ # await handle.SelectOptionAsync(new[] { "red", "green", "blue" });
599
+ # // multiple selection for blue, red and second option
600
+ # await handle.SelectOptionAsync(new[] {
601
+ # new SelectOptionValue() { Label = "blue" },
602
+ # new SelectOptionValue() { Index = 2 },
603
+ # new SelectOptionValue() { Value = "red" }});
604
+ # ```
525
605
  def select_option(
526
606
  element: nil,
527
607
  index: nil,
@@ -565,8 +645,9 @@ module Playwright
565
645
  modifiers: nil,
566
646
  noWaitAfter: nil,
567
647
  position: nil,
568
- timeout: nil)
569
- wrap_impl(@impl.tap_point(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
648
+ timeout: nil,
649
+ trial: nil)
650
+ wrap_impl(@impl.tap_point(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
570
651
  end
571
652
 
572
653
  # Returns the `node.textContent`.
@@ -599,6 +680,11 @@ module Playwright
599
680
  # element_handle.type("world", delay=100) # types slower, like a user
600
681
  # ```
601
682
  #
683
+ # ```csharp
684
+ # await elementHandle.TypeAsync("Hello"); // Types instantly
685
+ # await elementHandle.TypeAsync("World", delay: 100); // Types slower, like a user
686
+ # ```
687
+ #
602
688
  # An example of typing into a text field and then submitting the form:
603
689
  #
604
690
  #
@@ -625,6 +711,12 @@ module Playwright
625
711
  # element_handle.type("some text")
626
712
  # element_handle.press("Enter")
627
713
  # ```
714
+ #
715
+ # ```csharp
716
+ # var elementHandle = await page.QuerySelectorAsync("input");
717
+ # await elementHandle.TypeAsync("some text");
718
+ # await elementHandle.PressAsync("Enter");
719
+ # ```
628
720
  def type(text, delay: nil, noWaitAfter: nil, timeout: nil)
629
721
  wrap_impl(@impl.type(unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
630
722
  end
@@ -642,8 +734,13 @@ module Playwright
642
734
  #
643
735
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
644
736
  # zero timeout disables this.
645
- def uncheck(force: nil, noWaitAfter: nil, position: nil, timeout: nil)
646
- wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
737
+ def uncheck(
738
+ force: nil,
739
+ noWaitAfter: nil,
740
+ position: nil,
741
+ timeout: nil,
742
+ trial: nil)
743
+ wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
647
744
  end
648
745
 
649
746
  # Returns when the element satisfies the `state`.
@@ -702,6 +799,13 @@ module Playwright
702
799
  # span = div.wait_for_selector("span", state="attached")
703
800
  # ```
704
801
  #
802
+ # ```csharp
803
+ # await page.SetContentAsync("<div><span></span></div>");
804
+ # var div = await page.QuerySelectorAsync("div");
805
+ # // Waiting for the "span" selector relative to the div.
806
+ # var span = await page.WaitForSelectorAsync("span", WaitForSelectorState.Attached);
807
+ # ```
808
+ #
705
809
  # > NOTE: This method does not work across navigations, use [`method: Page.waitForSelector`] instead.
706
810
  def wait_for_selector(selector, state: nil, timeout: nil)
707
811
  wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
@@ -709,20 +813,20 @@ module Playwright
709
813
 
710
814
  # -- inherited from EventEmitter --
711
815
  # @nodoc
712
- def once(event, callback)
713
- event_emitter_proxy.once(event, callback)
816
+ def off(event, callback)
817
+ event_emitter_proxy.off(event, callback)
714
818
  end
715
819
 
716
820
  # -- inherited from EventEmitter --
717
821
  # @nodoc
718
- def on(event, callback)
719
- event_emitter_proxy.on(event, callback)
822
+ def once(event, callback)
823
+ event_emitter_proxy.once(event, callback)
720
824
  end
721
825
 
722
826
  # -- inherited from EventEmitter --
723
827
  # @nodoc
724
- def off(event, callback)
725
- event_emitter_proxy.off(event, callback)
828
+ def on(event, callback)
829
+ event_emitter_proxy.on(event, callback)
726
830
  end
727
831
 
728
832
  private def event_emitter_proxy