playwright-ruby-client 0.0.7 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -3
  3. data/docs/api_coverage.md +89 -84
  4. data/lib/playwright.rb +4 -2
  5. data/lib/playwright/android_input_impl.rb +23 -0
  6. data/lib/playwright/api_implementation.rb +18 -0
  7. data/lib/playwright/channel.rb +7 -0
  8. data/lib/playwright/channel_owner.rb +3 -5
  9. data/lib/playwright/channel_owners/android.rb +1 -1
  10. data/lib/playwright/channel_owners/android_device.rb +83 -13
  11. data/lib/playwright/channel_owners/browser.rb +1 -1
  12. data/lib/playwright/channel_owners/browser_context.rb +10 -2
  13. data/lib/playwright/channel_owners/download.rb +27 -0
  14. data/lib/playwright/channel_owners/element_handle.rb +15 -4
  15. data/lib/playwright/channel_owners/frame.rb +228 -19
  16. data/lib/playwright/channel_owners/js_handle.rb +1 -1
  17. data/lib/playwright/channel_owners/page.rb +350 -27
  18. data/lib/playwright/channel_owners/request.rb +9 -1
  19. data/lib/playwright/errors.rb +1 -1
  20. data/lib/playwright/event_emitter.rb +8 -1
  21. data/lib/playwright/event_emitter_proxy.rb +49 -0
  22. data/lib/playwright/file_chooser_impl.rb +23 -0
  23. data/lib/playwright/http_headers.rb +20 -0
  24. data/lib/playwright/input_files.rb +1 -1
  25. data/lib/playwright/javascript/expression.rb +15 -0
  26. data/lib/playwright/javascript/function.rb +15 -0
  27. data/lib/playwright/javascript/value_parser.rb +1 -1
  28. data/lib/playwright/javascript/value_serializer.rb +1 -1
  29. data/lib/playwright/{input_types/keyboard.rb → keyboard_impl.rb} +5 -1
  30. data/lib/playwright/mouse_impl.rb +7 -0
  31. data/lib/playwright/playwright_api.rb +59 -20
  32. data/lib/playwright/select_option_values.rb +14 -4
  33. data/lib/playwright/timeout_settings.rb +1 -1
  34. data/lib/playwright/touchscreen_impl.rb +7 -0
  35. data/lib/playwright/utils.rb +3 -3
  36. data/lib/playwright/version.rb +1 -1
  37. data/lib/playwright/wait_helper.rb +1 -1
  38. data/lib/playwright_api/android.rb +9 -10
  39. data/lib/playwright_api/android_device.rb +43 -14
  40. data/lib/playwright_api/android_input.rb +25 -0
  41. data/lib/playwright_api/binding_call.rb +10 -6
  42. data/lib/playwright_api/browser.rb +20 -21
  43. data/lib/playwright_api/browser_context.rb +29 -20
  44. data/lib/playwright_api/browser_type.rb +16 -56
  45. data/lib/playwright_api/chromium_browser_context.rb +10 -8
  46. data/lib/playwright_api/console_message.rb +10 -6
  47. data/lib/playwright_api/dialog.rb +5 -1
  48. data/lib/playwright_api/download.rb +28 -11
  49. data/lib/playwright_api/element_handle.rb +107 -96
  50. data/lib/playwright_api/file_chooser.rb +17 -9
  51. data/lib/playwright_api/frame.rb +136 -132
  52. data/lib/playwright_api/js_handle.rb +18 -20
  53. data/lib/playwright_api/keyboard.rb +5 -5
  54. data/lib/playwright_api/page.rb +204 -149
  55. data/lib/playwright_api/playwright.rb +32 -44
  56. data/lib/playwright_api/request.rb +7 -8
  57. data/lib/playwright_api/response.rb +10 -6
  58. data/lib/playwright_api/selectors.rb +13 -9
  59. data/lib/playwright_api/web_socket.rb +10 -1
  60. data/lib/playwright_api/worker.rb +13 -13
  61. metadata +12 -6
  62. data/lib/playwright/input_type.rb +0 -19
  63. data/lib/playwright/input_types/mouse.rb +0 -4
  64. data/lib/playwright/input_types/touchscreen.rb +0 -4
@@ -75,87 +75,11 @@ module Playwright
75
75
  # ```
76
76
  class Frame < PlaywrightApi
77
77
 
78
- # Returns the ElementHandle pointing to the frame element.
79
- #
80
- # The method finds an element matching the specified selector within the frame. See
81
- # [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
82
- # returns `null`.
83
- def query_selector(selector)
84
- wrap_impl(@impl.query_selector(unwrap_impl(selector)))
85
- end
86
-
87
- # Returns the ElementHandles pointing to the frame elements.
88
- #
89
- # The method finds all elements matching the specified selector within the frame. See
90
- # [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
91
- # returns empty array.
92
- def query_selector_all(selector)
93
- wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
94
- end
95
-
96
- # Returns the return value of `pageFunction`
97
- #
98
- # The method finds an element matching the specified selector within the frame and passes it as a first argument to
99
- # `pageFunction`. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements
100
- # match the selector, the method throws an error.
101
- #
102
- # If `pageFunction` returns a [Promise], then `frame.$eval` would wait for the promise to resolve and return its value.
103
- #
104
- # Examples:
105
- #
106
- #
107
- # ```js
108
- # const searchValue = await frame.$eval('#search', el => el.value);
109
- # const preloadHref = await frame.$eval('link[rel=preload]', el => el.href);
110
- # const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
111
- # ```
112
- #
113
- # ```python async
114
- # search_value = await frame.eval_on_selector("#search", "el => el.value")
115
- # preload_href = await frame.eval_on_selector("link[rel=preload]", "el => el.href")
116
- # html = await frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
117
- # ```
118
- #
119
- # ```python sync
120
- # search_value = frame.eval_on_selector("#search", "el => el.value")
121
- # preload_href = frame.eval_on_selector("link[rel=preload]", "el => el.href")
122
- # html = frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
123
- # ```
124
- def eval_on_selector(selector, pageFunction, arg: nil)
125
- wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
126
- end
127
-
128
- # Returns the return value of `pageFunction`
129
- #
130
- # The method finds all elements matching the specified selector within the frame and passes an array of matched elements
131
- # as a first argument to `pageFunction`. See [Working with selectors](./selectors.md#working-with-selectors) for more
132
- # details.
133
- #
134
- # If `pageFunction` returns a [Promise], then `frame.$$eval` would wait for the promise to resolve and return its value.
135
- #
136
- # Examples:
137
- #
138
- #
139
- # ```js
140
- # const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);
141
- # ```
142
- #
143
- # ```python async
144
- # divs_counts = await frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
145
- # ```
146
- #
147
- # ```python sync
148
- # divs_counts = frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
149
- # ```
150
- def eval_on_selector_all(selector, pageFunction, arg: nil)
151
- wrap_impl(@impl.eval_on_selector_all(unwrap_impl(selector), unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
152
- end
153
-
154
78
  # Returns the added tag when the script's onload fires or when the script content was injected into frame.
155
79
  #
156
80
  # Adds a `<script>` tag into the page with the desired url or content.
157
81
  def add_script_tag(content: nil, path: nil, type: nil, url: nil)
158
- raise NotImplementedError.new('add_script_tag is not implemented yet.')
82
+ wrap_impl(@impl.add_script_tag(content: unwrap_impl(content), path: unwrap_impl(path), type: unwrap_impl(type), url: unwrap_impl(url)))
159
83
  end
160
84
 
161
85
  # Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
@@ -163,7 +87,7 @@ module Playwright
163
87
  # Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the
164
88
  # content.
165
89
  def add_style_tag(content: nil, path: nil, url: nil)
166
- raise NotImplementedError.new('add_style_tag is not implemented yet.')
90
+ wrap_impl(@impl.add_style_tag(content: unwrap_impl(content), path: unwrap_impl(path), url: unwrap_impl(url)))
167
91
  end
168
92
 
169
93
  # This method checks an element matching `selector` by performing the following steps:
@@ -180,7 +104,7 @@ module Playwright
180
104
  # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
181
105
  # Passing zero timeout disables this.
182
106
  def check(selector, force: nil, noWaitAfter: nil, timeout: nil)
183
- raise NotImplementedError.new('check is not implemented yet.')
107
+ wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
184
108
  end
185
109
 
186
110
  def child_frames
@@ -290,17 +214,76 @@ module Playwright
290
214
  # frame.dispatch_event("#source", "dragstart", { "dataTransfer": data_transfer })
291
215
  # ```
292
216
  def dispatch_event(selector, type, eventInit: nil, timeout: nil)
293
- raise NotImplementedError.new('dispatch_event is not implemented yet.')
217
+ wrap_impl(@impl.dispatch_event(unwrap_impl(selector), unwrap_impl(type), eventInit: unwrap_impl(eventInit), timeout: unwrap_impl(timeout)))
218
+ end
219
+
220
+ # Returns the return value of `expression`.
221
+ #
222
+ # The method finds an element matching the specified selector within the frame and passes it as a first argument to
223
+ # `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, the
224
+ # method throws an error.
225
+ #
226
+ # If `expression` returns a [Promise], then [`method: Frame.evalOnSelector`] would wait for the promise to resolve and
227
+ # return its value.
228
+ #
229
+ # Examples:
230
+ #
231
+ #
232
+ # ```js
233
+ # const searchValue = await frame.$eval('#search', el => el.value);
234
+ # const preloadHref = await frame.$eval('link[rel=preload]', el => el.href);
235
+ # const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
236
+ # ```
237
+ #
238
+ # ```python async
239
+ # search_value = await frame.eval_on_selector("#search", "el => el.value")
240
+ # preload_href = await frame.eval_on_selector("link[rel=preload]", "el => el.href")
241
+ # html = await frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
242
+ # ```
243
+ #
244
+ # ```python sync
245
+ # search_value = frame.eval_on_selector("#search", "el => el.value")
246
+ # preload_href = frame.eval_on_selector("link[rel=preload]", "el => el.href")
247
+ # html = frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
248
+ # ```
249
+ def eval_on_selector(selector, expression, arg: nil)
250
+ wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg)))
251
+ end
252
+
253
+ # Returns the return value of `expression`.
254
+ #
255
+ # The method finds all elements matching the specified selector within the frame and passes an array of matched elements
256
+ # as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details.
257
+ #
258
+ # If `expression` returns a [Promise], then [`method: Frame.evalOnSelectorAll`] would wait for the promise to resolve and
259
+ # return its value.
260
+ #
261
+ # Examples:
262
+ #
263
+ #
264
+ # ```js
265
+ # const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);
266
+ # ```
267
+ #
268
+ # ```python async
269
+ # divs_counts = await frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
270
+ # ```
271
+ #
272
+ # ```python sync
273
+ # divs_counts = frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
274
+ # ```
275
+ def eval_on_selector_all(selector, expression, arg: nil)
276
+ wrap_impl(@impl.eval_on_selector_all(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg)))
294
277
  end
295
278
 
296
- # Returns the return value of `pageFunction`
279
+ # Returns the return value of `expression`.
297
280
  #
298
281
  # If the function passed to the [`method: Frame.evaluate`] returns a [Promise], then [`method: Frame.evaluate`] would wait
299
282
  # for the promise to resolve and return its value.
300
283
  #
301
- # If the function passed to the [`method: Frame.evaluate`] returns a non-[Serializable] value,
302
- # then[ method: `Frame.evaluate`] returns `undefined`. DevTools Protocol also supports transferring some additional values
303
- # that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.
284
+ # If the function passed to the [`method: Frame.evaluate`] returns a non-[Serializable] value, then
285
+ # [`method: Frame.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are
286
+ # not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
304
287
  #
305
288
  #
306
289
  # ```js
@@ -359,17 +342,17 @@ module Playwright
359
342
  # html = frame.evaluate("([body, suffix]) => body.innerHTML + suffix", [body_handle, "hello"])
360
343
  # body_handle.dispose()
361
344
  # ```
362
- def evaluate(pageFunction, arg: nil)
363
- wrap_impl(@impl.evaluate(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
345
+ def evaluate(expression, arg: nil)
346
+ wrap_impl(@impl.evaluate(unwrap_impl(expression), arg: unwrap_impl(arg)))
364
347
  end
365
348
 
366
- # Returns the return value of `pageFunction` as in-page object (JSHandle).
349
+ # Returns the return value of `expression` as a `JSHandle`.
367
350
  #
368
- # The only difference between [`method: Frame.evaluate`] and [`method: Frame.evaluateHandle`] is
369
- # that[ method: Fframe.evaluateHandle`] returns in-page object (JSHandle).
351
+ # The only difference between [`method: Frame.evaluate`] and [`method: Frame.evaluateHandle`] is that
352
+ # [method: Frame.evaluateHandle`] returns `JSHandle`.
370
353
  #
371
- # If the function, passed to the [`method: Frame.evaluateHandle`], returns a [Promise],
372
- # then[ method: Fframe.evaluateHandle`] would wait for the promise to resolve and return its value.
354
+ # If the function, passed to the [`method: Frame.evaluateHandle`], returns a [Promise], then
355
+ # [`method: Frame.evaluateHandle`] would wait for the promise to resolve and return its value.
373
356
  #
374
357
  #
375
358
  # ```js
@@ -378,7 +361,6 @@ module Playwright
378
361
  # ```
379
362
  #
380
363
  # ```python async
381
- # # FIXME
382
364
  # a_window_handle = await frame.evaluate_handle("Promise.resolve(window)")
383
365
  # a_window_handle # handle for the window object.
384
366
  # ```
@@ -426,14 +408,15 @@ module Playwright
426
408
  # print(result_handle.json_value())
427
409
  # result_handle.dispose()
428
410
  # ```
429
- def evaluate_handle(pageFunction, arg: nil)
430
- wrap_impl(@impl.evaluate_handle(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
411
+ def evaluate_handle(expression, arg: nil)
412
+ wrap_impl(@impl.evaluate_handle(unwrap_impl(expression), arg: unwrap_impl(arg)))
431
413
  end
432
414
 
433
415
  # This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the
434
- # element, fills it and triggers an `input` event after filling. If the element matching `selector` is not an `<input>`,
435
- # `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to
436
- # clear the input field.
416
+ # element, fills it and triggers an `input` event after filling. If the element is inside the `<label>` element that has
417
+ # associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), that control will be
418
+ # filled instead. If the element to be filled is not an `<input>`, `<textarea>` or `[contenteditable]` element, this
419
+ # method throws an error. Note that you can pass an empty string to clear the input field.
437
420
  #
438
421
  # To send fine-grained keyboard events, use [`method: Frame.type`].
439
422
  def fill(selector, value, noWaitAfter: nil, timeout: nil)
@@ -477,9 +460,8 @@ module Playwright
477
460
 
478
461
  # Returns element attribute value.
479
462
  def get_attribute(selector, name, timeout: nil)
480
- raise NotImplementedError.new('get_attribute is not implemented yet.')
463
+ wrap_impl(@impl.get_attribute(unwrap_impl(selector), unwrap_impl(name), timeout: unwrap_impl(timeout)))
481
464
  end
482
- alias_method :[], :get_attribute
483
465
 
484
466
  # Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
485
467
  # last redirect.
@@ -519,52 +501,52 @@ module Playwright
519
501
  modifiers: nil,
520
502
  position: nil,
521
503
  timeout: nil)
522
- raise NotImplementedError.new('hover is not implemented yet.')
504
+ wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
523
505
  end
524
506
 
525
507
  # Returns `element.innerHTML`.
526
508
  def inner_html(selector, timeout: nil)
527
- raise NotImplementedError.new('inner_html is not implemented yet.')
509
+ wrap_impl(@impl.inner_html(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
528
510
  end
529
511
 
530
512
  # Returns `element.innerText`.
531
513
  def inner_text(selector, timeout: nil)
532
- raise NotImplementedError.new('inner_text is not implemented yet.')
514
+ wrap_impl(@impl.inner_text(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
533
515
  end
534
516
 
535
517
  # Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
536
518
  def checked?(selector, timeout: nil)
537
- raise NotImplementedError.new('checked? is not implemented yet.')
519
+ wrap_impl(@impl.checked?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
538
520
  end
539
521
 
540
522
  # Returns `true` if the frame has been detached, or `false` otherwise.
541
523
  def detached?
542
- raise NotImplementedError.new('detached? is not implemented yet.')
524
+ wrap_impl(@impl.detached?)
543
525
  end
544
526
 
545
527
  # Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
546
528
  def disabled?(selector, timeout: nil)
547
- raise NotImplementedError.new('disabled? is not implemented yet.')
529
+ wrap_impl(@impl.disabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
548
530
  end
549
531
 
550
532
  # Returns whether the element is [editable](./actionability.md#editable).
551
533
  def editable?(selector, timeout: nil)
552
- raise NotImplementedError.new('editable? is not implemented yet.')
534
+ wrap_impl(@impl.editable?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
553
535
  end
554
536
 
555
537
  # Returns whether the element is [enabled](./actionability.md#enabled).
556
538
  def enabled?(selector, timeout: nil)
557
- raise NotImplementedError.new('enabled? is not implemented yet.')
539
+ wrap_impl(@impl.enabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
558
540
  end
559
541
 
560
542
  # Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
561
543
  def hidden?(selector, timeout: nil)
562
- raise NotImplementedError.new('hidden? is not implemented yet.')
544
+ wrap_impl(@impl.hidden?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
563
545
  end
564
546
 
565
547
  # Returns whether the element is [visible](./actionability.md#visible).
566
548
  def visible?(selector, timeout: nil)
567
- raise NotImplementedError.new('visible? is not implemented yet.')
549
+ wrap_impl(@impl.visible?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
568
550
  end
569
551
 
570
552
  # Returns frame's name attribute as specified in the tag.
@@ -611,6 +593,22 @@ module Playwright
611
593
  wrap_impl(@impl.press(unwrap_impl(selector), unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
612
594
  end
613
595
 
596
+ # Returns the ElementHandle pointing to the frame element.
597
+ #
598
+ # The method finds an element matching the specified selector within the frame. See
599
+ # [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`.
600
+ def query_selector(selector)
601
+ wrap_impl(@impl.query_selector(unwrap_impl(selector)))
602
+ end
603
+
604
+ # Returns the ElementHandles pointing to the frame elements.
605
+ #
606
+ # The method finds all elements matching the specified selector within the frame. See
607
+ # [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array.
608
+ def query_selector_all(selector)
609
+ wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
610
+ end
611
+
614
612
  # Returns the array of option values that have been successfully selected.
615
613
  #
616
614
  # Triggers a `change` and `input` event once all the provided options have been selected. If there's no `<select>` element
@@ -647,8 +645,15 @@ module Playwright
647
645
  # # multiple selection
648
646
  # frame.select_option("select#colors", value=["red", "green", "blue"])
649
647
  # ```
650
- def select_option(selector, values, noWaitAfter: nil, timeout: nil)
651
- raise NotImplementedError.new('select_option is not implemented yet.')
648
+ def select_option(
649
+ selector,
650
+ element: nil,
651
+ index: nil,
652
+ value: nil,
653
+ label: nil,
654
+ noWaitAfter: nil,
655
+ timeout: nil)
656
+ wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
652
657
  end
653
658
 
654
659
  def set_content(html, timeout: nil, waitUntil: nil)
@@ -662,7 +667,7 @@ module Playwright
662
667
  # Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
663
668
  # are resolved relative to the the current working directory. For empty array, clears the selected files.
664
669
  def set_input_files(selector, files, noWaitAfter: nil, timeout: nil)
665
- raise NotImplementedError.new('set_input_files is not implemented yet.')
670
+ wrap_impl(@impl.set_input_files(unwrap_impl(selector), unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
666
671
  end
667
672
 
668
673
  # This method taps an element matching `selector` by performing the following steps:
@@ -684,12 +689,12 @@ module Playwright
684
689
  noWaitAfter: nil,
685
690
  position: nil,
686
691
  timeout: nil)
687
- raise NotImplementedError.new('tap_point is not implemented yet.')
692
+ wrap_impl(@impl.tap_point(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
688
693
  end
689
694
 
690
695
  # Returns `element.textContent`.
691
696
  def text_content(selector, timeout: nil)
692
- raise NotImplementedError.new('text_content is not implemented yet.')
697
+ wrap_impl(@impl.text_content(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
693
698
  end
694
699
 
695
700
  # Returns the page title.
@@ -740,7 +745,7 @@ module Playwright
740
745
  # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
741
746
  # Passing zero timeout disables this.
742
747
  def uncheck(selector, force: nil, noWaitAfter: nil, timeout: nil)
743
- raise NotImplementedError.new('uncheck is not implemented yet.')
748
+ wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
744
749
  end
745
750
 
746
751
  # Returns frame's url.
@@ -748,9 +753,9 @@ module Playwright
748
753
  wrap_impl(@impl.url)
749
754
  end
750
755
 
751
- # Returns when the `pageFunction` returns a truthy value, returns that value.
756
+ # Returns when the `expression` returns a truthy value, returns that value.
752
757
  #
753
- # The `waitForFunction` can be used to observe viewport size change:
758
+ # The [`method: Frame.waitForFunction`] can be used to observe viewport size change:
754
759
  #
755
760
  #
756
761
  # ```js
@@ -774,7 +779,7 @@ module Playwright
774
779
  # webkit = playwright.webkit
775
780
  # browser = await webkit.launch()
776
781
  # page = await browser.new_page()
777
- # await page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);", force_expr=True)
782
+ # await page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
778
783
  # await page.main_frame.wait_for_function("() => window.x > 0")
779
784
  # await browser.close()
780
785
  #
@@ -791,7 +796,7 @@ module Playwright
791
796
  # webkit = playwright.webkit
792
797
  # browser = webkit.launch()
793
798
  # page = browser.new_page()
794
- # page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);", force_expr=True)
799
+ # page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
795
800
  # page.main_frame.wait_for_function("() => window.x > 0")
796
801
  # browser.close()
797
802
  #
@@ -816,8 +821,8 @@ module Playwright
816
821
  # selector = ".foo"
817
822
  # frame.wait_for_function("selector => !!document.querySelector(selector)", selector)
818
823
  # ```
819
- def wait_for_function(pageFunction, arg: nil, polling: nil, timeout: nil)
820
- raise NotImplementedError.new('wait_for_function is not implemented yet.')
824
+ def wait_for_function(expression, arg: nil, polling: nil, timeout: nil)
825
+ wrap_impl(@impl.wait_for_function(unwrap_impl(expression), arg: unwrap_impl(arg), polling: unwrap_impl(polling), timeout: unwrap_impl(timeout)))
821
826
  end
822
827
 
823
828
  # Waits for the required load state to be reached.
@@ -939,7 +944,7 @@ module Playwright
939
944
  # run(playwright)
940
945
  # ```
941
946
  def wait_for_selector(selector, state: nil, timeout: nil)
942
- raise NotImplementedError.new('wait_for_selector is not implemented yet.')
947
+ wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
943
948
  end
944
949
 
945
950
  # Waits for the given `timeout` in milliseconds.
@@ -951,31 +956,30 @@ module Playwright
951
956
  end
952
957
 
953
958
  # @nodoc
954
- def after_initialize
955
- wrap_impl(@impl.after_initialize)
959
+ def detached=(req)
960
+ wrap_impl(@impl.detached=(unwrap_impl(req)))
956
961
  end
957
962
 
963
+ # -- inherited from EventEmitter --
958
964
  # @nodoc
959
- def detached=(req)
960
- wrap_impl(@impl.detached=(unwrap_impl(req)))
965
+ def once(event, callback)
966
+ event_emitter_proxy.once(event, callback)
961
967
  end
962
968
 
963
969
  # -- inherited from EventEmitter --
964
970
  # @nodoc
965
971
  def on(event, callback)
966
- wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
972
+ event_emitter_proxy.on(event, callback)
967
973
  end
968
974
 
969
975
  # -- inherited from EventEmitter --
970
976
  # @nodoc
971
977
  def off(event, callback)
972
- wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
978
+ event_emitter_proxy.off(event, callback)
973
979
  end
974
980
 
975
- # -- inherited from EventEmitter --
976
- # @nodoc
977
- def once(event, callback)
978
- wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
981
+ private def event_emitter_proxy
982
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
979
983
  end
980
984
  end
981
985
  end