playwright-ruby-client 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -2
  3. data/docs/api_coverage.md +354 -0
  4. data/lib/playwright.rb +2 -0
  5. data/lib/playwright/channel_owner.rb +3 -2
  6. data/lib/playwright/channel_owners/android.rb +10 -1
  7. data/lib/playwright/channel_owners/android_device.rb +93 -0
  8. data/lib/playwright/channel_owners/browser.rb +13 -13
  9. data/lib/playwright/channel_owners/element_handle.rb +232 -1
  10. data/lib/playwright/channel_owners/frame.rb +41 -3
  11. data/lib/playwright/channel_owners/js_handle.rb +51 -0
  12. data/lib/playwright/channel_owners/page.rb +48 -10
  13. data/lib/playwright/channel_owners/webkit_browser.rb +1 -1
  14. data/lib/playwright/connection.rb +9 -6
  15. data/lib/playwright/errors.rb +1 -1
  16. data/lib/playwright/input_files.rb +42 -0
  17. data/lib/playwright/input_types/keyboard.rb +1 -1
  18. data/lib/playwright/javascript/value_serializer.rb +11 -11
  19. data/lib/playwright/playwright_api.rb +8 -0
  20. data/lib/playwright/select_option_values.rb +32 -0
  21. data/lib/playwright/utils.rb +18 -0
  22. data/lib/playwright/version.rb +1 -1
  23. data/lib/playwright_api/android.rb +33 -0
  24. data/lib/playwright_api/android_device.rb +48 -0
  25. data/lib/playwright_api/binding_call.rb +3 -3
  26. data/lib/playwright_api/browser.rb +7 -6
  27. data/lib/playwright_api/browser_context.rb +6 -6
  28. data/lib/playwright_api/browser_type.rb +4 -4
  29. data/lib/playwright_api/chromium_browser_context.rb +3 -3
  30. data/lib/playwright_api/console_message.rb +3 -8
  31. data/lib/playwright_api/dialog.rb +2 -2
  32. data/lib/playwright_api/element_handle.rb +40 -39
  33. data/lib/playwright_api/frame.rb +23 -27
  34. data/lib/playwright_api/js_handle.rb +15 -9
  35. data/lib/playwright_api/keyboard.rb +6 -6
  36. data/lib/playwright_api/page.rb +35 -54
  37. data/lib/playwright_api/playwright.rb +7 -7
  38. data/lib/playwright_api/request.rb +3 -3
  39. data/lib/playwright_api/response.rb +3 -3
  40. data/lib/playwright_api/selectors.rb +3 -3
  41. data/playwright.gemspec +1 -0
  42. metadata +22 -2
@@ -81,7 +81,7 @@ module Playwright
81
81
  # [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
82
82
  # returns `null`.
83
83
  def query_selector(selector)
84
- wrap_impl(@impl.query_selector(selector))
84
+ wrap_impl(@impl.query_selector(unwrap_impl(selector)))
85
85
  end
86
86
 
87
87
  # Returns the ElementHandles pointing to the frame elements.
@@ -90,7 +90,7 @@ module Playwright
90
90
  # [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
91
91
  # returns empty array.
92
92
  def query_selector_all(selector)
93
- wrap_impl(@impl.query_selector_all(selector))
93
+ wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
94
94
  end
95
95
 
96
96
  # Returns the return value of `pageFunction`
@@ -122,7 +122,7 @@ module Playwright
122
122
  # html = frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
123
123
  # ```
124
124
  def eval_on_selector(selector, pageFunction, arg: nil)
125
- wrap_impl(@impl.eval_on_selector(selector, pageFunction, arg: arg))
125
+ wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
126
126
  end
127
127
 
128
128
  # Returns the return value of `pageFunction`
@@ -148,7 +148,7 @@ module Playwright
148
148
  # divs_counts = frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
149
149
  # ```
150
150
  def eval_on_selector_all(selector, pageFunction, arg: nil)
151
- wrap_impl(@impl.eval_on_selector_all(selector, pageFunction, arg: arg))
151
+ wrap_impl(@impl.eval_on_selector_all(unwrap_impl(selector), unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
152
152
  end
153
153
 
154
154
  # Returns the added tag when the script's onload fires or when the script content was injected into frame.
@@ -207,7 +207,7 @@ module Playwright
207
207
  noWaitAfter: nil,
208
208
  position: nil,
209
209
  timeout: nil)
210
- wrap_impl(@impl.click(selector, button: button, clickCount: clickCount, delay: delay, force: force, modifiers: modifiers, noWaitAfter: noWaitAfter, position: position, timeout: timeout))
210
+ wrap_impl(@impl.click(unwrap_impl(selector), 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)))
211
211
  end
212
212
 
213
213
  # Gets the full HTML contents of the frame, including the doctype.
@@ -237,7 +237,7 @@ module Playwright
237
237
  noWaitAfter: nil,
238
238
  position: nil,
239
239
  timeout: nil)
240
- raise NotImplementedError.new('dblclick is not implemented yet.')
240
+ wrap_impl(@impl.dblclick(unwrap_impl(selector), 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)))
241
241
  end
242
242
 
243
243
  # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click`
@@ -360,7 +360,7 @@ module Playwright
360
360
  # body_handle.dispose()
361
361
  # ```
362
362
  def evaluate(pageFunction, arg: nil)
363
- wrap_impl(@impl.evaluate(pageFunction, arg: arg))
363
+ wrap_impl(@impl.evaluate(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
364
364
  end
365
365
 
366
366
  # Returns the return value of `pageFunction` as in-page object (JSHandle).
@@ -427,7 +427,7 @@ module Playwright
427
427
  # result_handle.dispose()
428
428
  # ```
429
429
  def evaluate_handle(pageFunction, arg: nil)
430
- wrap_impl(@impl.evaluate_handle(pageFunction, arg: arg))
430
+ wrap_impl(@impl.evaluate_handle(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
431
431
  end
432
432
 
433
433
  # This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the
@@ -437,13 +437,13 @@ module Playwright
437
437
  #
438
438
  # To send fine-grained keyboard events, use [`method: Frame.type`].
439
439
  def fill(selector, value, noWaitAfter: nil, timeout: nil)
440
- raise NotImplementedError.new('fill is not implemented yet.')
440
+ wrap_impl(@impl.fill(unwrap_impl(selector), unwrap_impl(value), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
441
441
  end
442
442
 
443
443
  # This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
444
444
  # waits until a matching element appears in the DOM.
445
445
  def focus(selector, timeout: nil)
446
- wrap_impl(@impl.focus(selector, timeout: timeout))
446
+ wrap_impl(@impl.focus(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
447
447
  end
448
448
 
449
449
  # Returns the `frame` or `iframe` element handle which corresponds to this frame.
@@ -479,6 +479,7 @@ module Playwright
479
479
  def get_attribute(selector, name, timeout: nil)
480
480
  raise NotImplementedError.new('get_attribute is not implemented yet.')
481
481
  end
482
+ alias_method :[], :get_attribute
482
483
 
483
484
  # Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
484
485
  # last redirect.
@@ -499,7 +500,7 @@ module Playwright
499
500
  # > NOTE: Headless mode doesn't support navigation to a PDF document. See the
500
501
  # [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
501
502
  def goto(url, referer: nil, timeout: nil, waitUntil: nil)
502
- wrap_impl(@impl.goto(url, referer: referer, timeout: timeout, waitUntil: waitUntil))
503
+ wrap_impl(@impl.goto(unwrap_impl(url), referer: unwrap_impl(referer), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
503
504
  end
504
505
 
505
506
  # This method hovers over an element matching `selector` by performing the following steps:
@@ -607,7 +608,7 @@ module Playwright
607
608
  delay: nil,
608
609
  noWaitAfter: nil,
609
610
  timeout: nil)
610
- wrap_impl(@impl.press(selector, key, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout))
611
+ wrap_impl(@impl.press(unwrap_impl(selector), unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
611
612
  end
612
613
 
613
614
  # Returns the array of option values that have been successfully selected.
@@ -651,7 +652,7 @@ module Playwright
651
652
  end
652
653
 
653
654
  def set_content(html, timeout: nil, waitUntil: nil)
654
- wrap_impl(@impl.set_content(html, timeout: timeout, waitUntil: waitUntil))
655
+ wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
655
656
  end
656
657
  alias_method :content=, :set_content
657
658
 
@@ -716,13 +717,13 @@ module Playwright
716
717
  # frame.type("#mytextarea", "hello") # types instantly
717
718
  # frame.type("#mytextarea", "world", delay=100) # types slower, like a user
718
719
  # ```
719
- def type_text(
720
+ def type(
720
721
  selector,
721
722
  text,
722
723
  delay: nil,
723
724
  noWaitAfter: nil,
724
725
  timeout: nil)
725
- wrap_impl(@impl.type_text(selector, text, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout))
726
+ wrap_impl(@impl.type(unwrap_impl(selector), unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
726
727
  end
727
728
 
728
729
  # This method checks an element matching `selector` by performing the following steps:
@@ -840,7 +841,7 @@ module Playwright
840
841
  # frame.wait_for_load_state() # the promise resolves after "load" event.
841
842
  # ```
842
843
  def wait_for_load_state(state: nil, timeout: nil)
843
- wrap_impl(@impl.wait_for_load_state(state: state, timeout: timeout))
844
+ wrap_impl(@impl.wait_for_load_state(state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
844
845
  end
845
846
 
846
847
  # Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation
@@ -872,8 +873,8 @@ module Playwright
872
873
  #
873
874
  # > NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
874
875
  # considered a navigation.
875
- def expect_navigation(timeout: nil, url: nil, waitUntil: nil)
876
- raise NotImplementedError.new('expect_navigation is not implemented yet.')
876
+ def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
877
+ wrap_impl(@impl.expect_navigation(timeout: unwrap_impl(timeout), url: unwrap_impl(url), waitUntil: unwrap_impl(waitUntil), &wrap_block_call(block)))
877
878
  end
878
879
 
879
880
  # Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
@@ -949,11 +950,6 @@ module Playwright
949
950
  raise NotImplementedError.new('wait_for_timeout is not implemented yet.')
950
951
  end
951
952
 
952
- # @nodoc
953
- def wait_for_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
954
- wrap_impl(@impl.wait_for_navigation(timeout: timeout, url: url, waitUntil: waitUntil, &wrap_block_call(block)))
955
- end
956
-
957
953
  # @nodoc
958
954
  def after_initialize
959
955
  wrap_impl(@impl.after_initialize)
@@ -961,25 +957,25 @@ module Playwright
961
957
 
962
958
  # @nodoc
963
959
  def detached=(req)
964
- wrap_impl(@impl.detached=(req))
960
+ wrap_impl(@impl.detached=(unwrap_impl(req)))
965
961
  end
966
962
 
967
963
  # -- inherited from EventEmitter --
968
964
  # @nodoc
969
965
  def on(event, callback)
970
- wrap_impl(@impl.on(event, callback))
966
+ wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
971
967
  end
972
968
 
973
969
  # -- inherited from EventEmitter --
974
970
  # @nodoc
975
971
  def off(event, callback)
976
- wrap_impl(@impl.off(event, callback))
972
+ wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
977
973
  end
978
974
 
979
975
  # -- inherited from EventEmitter --
980
976
  # @nodoc
981
977
  def once(event, callback)
982
- wrap_impl(@impl.once(event, callback))
978
+ wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
983
979
  end
984
980
  end
985
981
  end
@@ -28,7 +28,7 @@ module Playwright
28
28
 
29
29
  # Returns either `null` or the object handle itself, if the object handle is an instance of `ElementHandle`.
30
30
  def as_element
31
- raise NotImplementedError.new('as_element is not implemented yet.')
31
+ wrap_impl(@impl.as_element)
32
32
  end
33
33
 
34
34
  # The `jsHandle.dispose` method stops referencing the element handle.
@@ -61,7 +61,7 @@ module Playwright
61
61
  # assert tweet_handle.evaluate("node => node.innerText") == "10 retweets"
62
62
  # ```
63
63
  def evaluate(pageFunction, arg: nil)
64
- raise NotImplementedError.new('evaluate is not implemented yet.')
64
+ wrap_impl(@impl.evaluate(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
65
65
  end
66
66
 
67
67
  # Returns the return value of `pageFunction` as in-page object (JSHandle).
@@ -76,7 +76,7 @@ module Playwright
76
76
  #
77
77
  # See [`method: Page.evaluateHandle`] for more details.
78
78
  def evaluate_handle(pageFunction, arg: nil)
79
- raise NotImplementedError.new('evaluate_handle is not implemented yet.')
79
+ wrap_impl(@impl.evaluate_handle(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
80
80
  end
81
81
 
82
82
  # The method returns a map with **own property names** as keys and JSHandle instances for the property values.
@@ -106,12 +106,13 @@ module Playwright
106
106
  # handle.dispose()
107
107
  # ```
108
108
  def get_properties
109
- raise NotImplementedError.new('get_properties is not implemented yet.')
109
+ wrap_impl(@impl.get_properties)
110
110
  end
111
+ alias_method :properties, :get_properties
111
112
 
112
113
  # Fetches a single property from the referenced object.
113
114
  def get_property(propertyName)
114
- raise NotImplementedError.new('get_property is not implemented yet.')
115
+ wrap_impl(@impl.get_property(unwrap_impl(propertyName)))
115
116
  end
116
117
 
117
118
  # Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.
@@ -119,25 +120,30 @@ module Playwright
119
120
  # > NOTE: The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an
120
121
  # error if the object has circular references.
121
122
  def json_value
122
- raise NotImplementedError.new('json_value is not implemented yet.')
123
+ wrap_impl(@impl.json_value)
124
+ end
125
+
126
+ # @nodoc
127
+ def after_initialize
128
+ wrap_impl(@impl.after_initialize)
123
129
  end
124
130
 
125
131
  # -- inherited from EventEmitter --
126
132
  # @nodoc
127
133
  def on(event, callback)
128
- wrap_impl(@impl.on(event, callback))
134
+ wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
129
135
  end
130
136
 
131
137
  # -- inherited from EventEmitter --
132
138
  # @nodoc
133
139
  def off(event, callback)
134
- wrap_impl(@impl.off(event, callback))
140
+ wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
135
141
  end
136
142
 
137
143
  # -- inherited from EventEmitter --
138
144
  # @nodoc
139
145
  def once(event, callback)
140
- wrap_impl(@impl.once(event, callback))
146
+ wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
141
147
  end
142
148
  end
143
149
  end
@@ -114,7 +114,7 @@ module Playwright
114
114
  #
115
115
  # > NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.
116
116
  def down(key)
117
- @impl.down(key)
117
+ @impl.down(unwrap_impl(key))
118
118
  end
119
119
 
120
120
  # Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.
@@ -134,7 +134,7 @@ module Playwright
134
134
  #
135
135
  # > NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.
136
136
  def insert_text(text)
137
- @impl.insert_text(text)
137
+ @impl.insert_text(unwrap_impl(text))
138
138
  end
139
139
 
140
140
  # `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
@@ -193,7 +193,7 @@ module Playwright
193
193
  #
194
194
  # Shortcut for [`method: Keyboard.down`] and [`method: Keyboard.up`].
195
195
  def press(key, delay: nil)
196
- @impl.press(key, delay: delay)
196
+ @impl.press(unwrap_impl(key), delay: unwrap_impl(delay))
197
197
  end
198
198
 
199
199
  # Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
@@ -217,13 +217,13 @@ module Playwright
217
217
  # ```
218
218
  #
219
219
  # > NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
220
- def type_text(text, delay: nil)
221
- @impl.type_text(text, delay: delay)
220
+ def type(text, delay: nil)
221
+ @impl.type(unwrap_impl(text), delay: unwrap_impl(delay))
222
222
  end
223
223
 
224
224
  # Dispatches a `keyup` event.
225
225
  def up(key)
226
- @impl.up(key)
226
+ @impl.up(unwrap_impl(key))
227
227
  end
228
228
  end
229
229
  end
@@ -119,7 +119,7 @@ module Playwright
119
119
  #
120
120
  # Shortcut for main frame's [`method: Frame.$`].
121
121
  def query_selector(selector)
122
- wrap_impl(@impl.query_selector(selector))
122
+ wrap_impl(@impl.query_selector(unwrap_impl(selector)))
123
123
  end
124
124
 
125
125
  # The method finds all elements matching the specified selector within the page. If no elements match the selector, the
@@ -127,7 +127,7 @@ module Playwright
127
127
  #
128
128
  # Shortcut for main frame's [`method: Frame.$$`].
129
129
  def query_selector_all(selector)
130
- wrap_impl(@impl.query_selector_all(selector))
130
+ wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
131
131
  end
132
132
 
133
133
  # The method finds an element matching the specified selector within the page and passes it as a first argument to
@@ -159,7 +159,7 @@ module Playwright
159
159
  #
160
160
  # Shortcut for main frame's [`method: Frame.$eval`].
161
161
  def eval_on_selector(selector, pageFunction, arg: nil)
162
- wrap_impl(@impl.eval_on_selector(selector, pageFunction, arg: arg))
162
+ wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
163
163
  end
164
164
 
165
165
  # The method finds all elements matching the specified selector within the page and passes an array of matched elements as
@@ -183,7 +183,7 @@ module Playwright
183
183
  # div_counts = page.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
184
184
  # ```
185
185
  def eval_on_selector_all(selector, pageFunction, arg: nil)
186
- wrap_impl(@impl.eval_on_selector_all(selector, pageFunction, arg: arg))
186
+ wrap_impl(@impl.eval_on_selector_all(unwrap_impl(selector), unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
187
187
  end
188
188
 
189
189
  # Adds a script which would be evaluated in one of the following scenarios:
@@ -286,7 +286,7 @@ module Playwright
286
286
  noWaitAfter: nil,
287
287
  position: nil,
288
288
  timeout: nil)
289
- wrap_impl(@impl.click(selector, button: button, clickCount: clickCount, delay: delay, force: force, modifiers: modifiers, noWaitAfter: noWaitAfter, position: position, timeout: timeout))
289
+ wrap_impl(@impl.click(unwrap_impl(selector), 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)))
290
290
  end
291
291
 
292
292
  # If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If
@@ -297,7 +297,7 @@ module Playwright
297
297
  # > NOTE: if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled manually
298
298
  # via [`event: Page.dialog`] event.
299
299
  def close(runBeforeUnload: nil)
300
- wrap_impl(@impl.close(runBeforeUnload: runBeforeUnload))
300
+ wrap_impl(@impl.close(runBeforeUnload: unwrap_impl(runBeforeUnload)))
301
301
  end
302
302
 
303
303
  # Gets the full HTML contents of the page, including the doctype.
@@ -334,7 +334,7 @@ module Playwright
334
334
  noWaitAfter: nil,
335
335
  position: nil,
336
336
  timeout: nil)
337
- raise NotImplementedError.new('dblclick is not implemented yet.')
337
+ wrap_impl(@impl.dblclick(unwrap_impl(selector), 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)))
338
338
  end
339
339
 
340
340
  # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click`
@@ -555,7 +555,7 @@ module Playwright
555
555
  #
556
556
  # Shortcut for main frame's [`method: Frame.evaluate`].
557
557
  def evaluate(pageFunction, arg: nil)
558
- wrap_impl(@impl.evaluate(pageFunction, arg: arg))
558
+ wrap_impl(@impl.evaluate(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
559
559
  end
560
560
 
561
561
  # Returns the value of the `pageFunction` invocation as in-page object (JSHandle).
@@ -622,7 +622,7 @@ module Playwright
622
622
  # result_handle.dispose()
623
623
  # ```
624
624
  def evaluate_handle(pageFunction, arg: nil)
625
- wrap_impl(@impl.evaluate_handle(pageFunction, arg: arg))
625
+ wrap_impl(@impl.evaluate_handle(unwrap_impl(pageFunction), arg: unwrap_impl(arg)))
626
626
  end
627
627
 
628
628
  # The method adds a function called `name` on the `window` object of every frame in this page. When called, the function
@@ -866,7 +866,7 @@ module Playwright
866
866
  #
867
867
  # Shortcut for main frame's [`method: Frame.fill`]
868
868
  def fill(selector, value, noWaitAfter: nil, timeout: nil)
869
- raise NotImplementedError.new('fill is not implemented yet.')
869
+ wrap_impl(@impl.fill(unwrap_impl(selector), unwrap_impl(value), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
870
870
  end
871
871
 
872
872
  # This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
@@ -874,7 +874,7 @@ module Playwright
874
874
  #
875
875
  # Shortcut for main frame's [`method: Frame.focus`].
876
876
  def focus(selector, timeout: nil)
877
- wrap_impl(@impl.focus(selector, timeout: timeout))
877
+ wrap_impl(@impl.focus(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
878
878
  end
879
879
 
880
880
  # Returns frame matching the specified criteria. Either `name` or `url` must be specified.
@@ -897,7 +897,7 @@ module Playwright
897
897
  # frame = page.frame(url=r".*domain.*")
898
898
  # ```
899
899
  def frame(frameSelector)
900
- wrap_impl(@impl.frame(frameSelector))
900
+ wrap_impl(@impl.frame(unwrap_impl(frameSelector)))
901
901
  end
902
902
 
903
903
  # An array of all frames attached to the page.
@@ -909,6 +909,7 @@ module Playwright
909
909
  def get_attribute(selector, name, timeout: nil)
910
910
  raise NotImplementedError.new('get_attribute is not implemented yet.')
911
911
  end
912
+ alias_method :[], :get_attribute
912
913
 
913
914
  # Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
914
915
  # last redirect. If can not go back, returns `null`.
@@ -947,7 +948,7 @@ module Playwright
947
948
  #
948
949
  # Shortcut for main frame's [`method: Frame.goto`]
949
950
  def goto(url, referer: nil, timeout: nil, waitUntil: nil)
950
- wrap_impl(@impl.goto(url, referer: referer, timeout: timeout, waitUntil: waitUntil))
951
+ wrap_impl(@impl.goto(unwrap_impl(url), referer: unwrap_impl(referer), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
951
952
  end
952
953
 
953
954
  # This method hovers over an element matching `selector` by performing the following steps:
@@ -1162,13 +1163,13 @@ module Playwright
1162
1163
  delay: nil,
1163
1164
  noWaitAfter: nil,
1164
1165
  timeout: nil)
1165
- wrap_impl(@impl.press(selector, key, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout))
1166
+ wrap_impl(@impl.press(unwrap_impl(selector), unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
1166
1167
  end
1167
1168
 
1168
1169
  # Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
1169
1170
  # last redirect.
1170
1171
  def reload(timeout: nil, waitUntil: nil)
1171
- raise NotImplementedError.new('reload is not implemented yet.')
1172
+ wrap_impl(@impl.reload(timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
1172
1173
  end
1173
1174
 
1174
1175
  # Routing provides the capability to modify network requests that are made by a page.
@@ -1245,7 +1246,7 @@ module Playwright
1245
1246
  quality: nil,
1246
1247
  timeout: nil,
1247
1248
  type: nil)
1248
- wrap_impl(@impl.screenshot(clip: clip, fullPage: fullPage, omitBackground: omitBackground, path: path, quality: quality, timeout: timeout, type: type))
1249
+ wrap_impl(@impl.screenshot(clip: unwrap_impl(clip), fullPage: unwrap_impl(fullPage), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
1249
1250
  end
1250
1251
 
1251
1252
  # Returns the array of option values that have been successfully selected.
@@ -1292,7 +1293,7 @@ module Playwright
1292
1293
  end
1293
1294
 
1294
1295
  def set_content(html, timeout: nil, waitUntil: nil)
1295
- wrap_impl(@impl.set_content(html, timeout: timeout, waitUntil: waitUntil))
1296
+ wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
1296
1297
  end
1297
1298
  alias_method :content=, :set_content
1298
1299
 
@@ -1364,7 +1365,7 @@ module Playwright
1364
1365
  # page.goto("https://example.com")
1365
1366
  # ```
1366
1367
  def set_viewport_size(viewportSize)
1367
- wrap_impl(@impl.set_viewport_size(viewportSize))
1368
+ wrap_impl(@impl.set_viewport_size(unwrap_impl(viewportSize)))
1368
1369
  end
1369
1370
  alias_method :viewport_size=, :set_viewport_size
1370
1371
 
@@ -1424,13 +1425,13 @@ module Playwright
1424
1425
  # ```
1425
1426
  #
1426
1427
  # Shortcut for main frame's [`method: Frame.type`].
1427
- def type_text(
1428
+ def type(
1428
1429
  selector,
1429
1430
  text,
1430
1431
  delay: nil,
1431
1432
  noWaitAfter: nil,
1432
1433
  timeout: nil)
1433
- wrap_impl(@impl.type_text(selector, text, delay: delay, noWaitAfter: noWaitAfter, timeout: timeout))
1434
+ wrap_impl(@impl.type(unwrap_impl(selector), unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
1434
1435
  end
1435
1436
 
1436
1437
  # This method unchecks an element matching `selector` by performing the following steps:
@@ -1493,8 +1494,8 @@ module Playwright
1493
1494
  # page.click("button")
1494
1495
  # frame = event_info.value
1495
1496
  # ```
1496
- def expect_event(event, optionsOrPredicate: nil)
1497
- raise NotImplementedError.new('expect_event is not implemented yet.')
1497
+ def expect_event(event, optionsOrPredicate: nil, &block)
1498
+ wrap_impl(@impl.expect_event(unwrap_impl(event), optionsOrPredicate: unwrap_impl(optionsOrPredicate), &wrap_block_call(block)))
1498
1499
  end
1499
1500
 
1500
1501
  # Returns when the `pageFunction` returns a truthy value. It resolves to a JSHandle of the truthy value.
@@ -1622,7 +1623,7 @@ module Playwright
1622
1623
  #
1623
1624
  # Shortcut for main frame's [`method: Frame.waitForLoadState`].
1624
1625
  def wait_for_load_state(state: nil, timeout: nil)
1625
- raise NotImplementedError.new('wait_for_load_state is not implemented yet.')
1626
+ wrap_impl(@impl.wait_for_load_state(state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
1626
1627
  end
1627
1628
 
1628
1629
  # Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the
@@ -1657,8 +1658,8 @@ module Playwright
1657
1658
  # considered a navigation.
1658
1659
  #
1659
1660
  # Shortcut for main frame's [`method: Frame.waitForNavigation`].
1660
- def expect_navigation(timeout: nil, url: nil, waitUntil: nil)
1661
- raise NotImplementedError.new('expect_navigation is not implemented yet.')
1661
+ def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
1662
+ wrap_impl(@impl.expect_navigation(timeout: unwrap_impl(timeout), url: unwrap_impl(url), waitUntil: unwrap_impl(waitUntil), &wrap_block_call(block)))
1662
1663
  end
1663
1664
 
1664
1665
  # Waits for the matching request and returns it.
@@ -1695,7 +1696,7 @@ module Playwright
1695
1696
  # await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');
1696
1697
  # ```
1697
1698
  def expect_request(urlOrPredicate, timeout: nil)
1698
- raise NotImplementedError.new('expect_request is not implemented yet.')
1699
+ wrap_impl(@impl.expect_request(unwrap_impl(urlOrPredicate), timeout: unwrap_impl(timeout)))
1699
1700
  end
1700
1701
 
1701
1702
  # Returns the matched response.
@@ -1719,7 +1720,7 @@ module Playwright
1719
1720
  # return final_response.ok
1720
1721
  # ```
1721
1722
  def expect_response(urlOrPredicate, timeout: nil)
1722
- raise NotImplementedError.new('expect_response is not implemented yet.')
1723
+ wrap_impl(@impl.expect_response(unwrap_impl(urlOrPredicate), timeout: unwrap_impl(timeout)))
1723
1724
  end
1724
1725
 
1725
1726
  # Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
@@ -1822,51 +1823,31 @@ module Playwright
1822
1823
  end
1823
1824
 
1824
1825
  # @nodoc
1825
- def owned_context=(req)
1826
- wrap_impl(@impl.owned_context=(req))
1827
- end
1828
-
1829
- # @nodoc
1830
- def wait_for_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
1831
- wrap_impl(@impl.wait_for_navigation(timeout: timeout, url: url, waitUntil: waitUntil, &wrap_block_call(block)))
1832
- end
1833
-
1834
- # @nodoc
1835
- def wait_for_request(urlOrPredicate, timeout: nil)
1836
- wrap_impl(@impl.wait_for_request(urlOrPredicate, timeout: timeout))
1837
- end
1838
-
1839
- # @nodoc
1840
- def wait_for_event(event, optionsOrPredicate: nil, &block)
1841
- wrap_impl(@impl.wait_for_event(event, optionsOrPredicate: optionsOrPredicate, &wrap_block_call(block)))
1842
- end
1843
-
1844
- # @nodoc
1845
- def wait_for_response(urlOrPredicate, timeout: nil)
1846
- wrap_impl(@impl.wait_for_response(urlOrPredicate, timeout: timeout))
1826
+ def after_initialize
1827
+ wrap_impl(@impl.after_initialize)
1847
1828
  end
1848
1829
 
1849
1830
  # @nodoc
1850
- def after_initialize
1851
- wrap_impl(@impl.after_initialize)
1831
+ def owned_context=(req)
1832
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1852
1833
  end
1853
1834
 
1854
1835
  # -- inherited from EventEmitter --
1855
1836
  # @nodoc
1856
1837
  def on(event, callback)
1857
- wrap_impl(@impl.on(event, callback))
1838
+ wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
1858
1839
  end
1859
1840
 
1860
1841
  # -- inherited from EventEmitter --
1861
1842
  # @nodoc
1862
1843
  def off(event, callback)
1863
- wrap_impl(@impl.off(event, callback))
1844
+ wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
1864
1845
  end
1865
1846
 
1866
1847
  # -- inherited from EventEmitter --
1867
1848
  # @nodoc
1868
1849
  def once(event, callback)
1869
- wrap_impl(@impl.once(event, callback))
1850
+ wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
1870
1851
  end
1871
1852
  end
1872
1853
  end