playwright-ruby-client 0.0.7 → 0.2.1
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.
- checksums.yaml +4 -4
- data/README.md +38 -3
- data/docs/api_coverage.md +89 -84
- data/lib/playwright.rb +4 -2
- data/lib/playwright/android_input_impl.rb +23 -0
- data/lib/playwright/api_implementation.rb +18 -0
- data/lib/playwright/channel.rb +7 -0
- data/lib/playwright/channel_owner.rb +3 -5
- data/lib/playwright/channel_owners/android.rb +1 -1
- data/lib/playwright/channel_owners/android_device.rb +83 -13
- data/lib/playwright/channel_owners/browser.rb +1 -1
- data/lib/playwright/channel_owners/browser_context.rb +10 -2
- data/lib/playwright/channel_owners/download.rb +27 -0
- data/lib/playwright/channel_owners/element_handle.rb +15 -4
- data/lib/playwright/channel_owners/frame.rb +228 -19
- data/lib/playwright/channel_owners/js_handle.rb +1 -1
- data/lib/playwright/channel_owners/page.rb +350 -27
- data/lib/playwright/channel_owners/request.rb +9 -1
- data/lib/playwright/errors.rb +1 -1
- data/lib/playwright/event_emitter.rb +8 -1
- data/lib/playwright/event_emitter_proxy.rb +49 -0
- data/lib/playwright/file_chooser_impl.rb +23 -0
- data/lib/playwright/http_headers.rb +20 -0
- data/lib/playwright/input_files.rb +1 -1
- data/lib/playwright/javascript/expression.rb +15 -0
- data/lib/playwright/javascript/function.rb +15 -0
- data/lib/playwright/javascript/value_parser.rb +1 -1
- data/lib/playwright/javascript/value_serializer.rb +1 -1
- data/lib/playwright/{input_types/keyboard.rb → keyboard_impl.rb} +5 -1
- data/lib/playwright/mouse_impl.rb +7 -0
- data/lib/playwright/playwright_api.rb +59 -20
- data/lib/playwright/select_option_values.rb +14 -4
- data/lib/playwright/timeout_settings.rb +1 -1
- data/lib/playwright/touchscreen_impl.rb +7 -0
- data/lib/playwright/utils.rb +3 -3
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright/wait_helper.rb +1 -1
- data/lib/playwright_api/android.rb +9 -10
- data/lib/playwright_api/android_device.rb +43 -14
- data/lib/playwright_api/android_input.rb +25 -0
- data/lib/playwright_api/binding_call.rb +10 -6
- data/lib/playwright_api/browser.rb +20 -21
- data/lib/playwright_api/browser_context.rb +29 -20
- data/lib/playwright_api/browser_type.rb +16 -56
- data/lib/playwright_api/chromium_browser_context.rb +10 -8
- data/lib/playwright_api/console_message.rb +10 -6
- data/lib/playwright_api/dialog.rb +5 -1
- data/lib/playwright_api/download.rb +28 -11
- data/lib/playwright_api/element_handle.rb +107 -96
- data/lib/playwright_api/file_chooser.rb +17 -9
- data/lib/playwright_api/frame.rb +136 -132
- data/lib/playwright_api/js_handle.rb +18 -20
- data/lib/playwright_api/keyboard.rb +5 -5
- data/lib/playwright_api/page.rb +204 -149
- data/lib/playwright_api/playwright.rb +32 -44
- data/lib/playwright_api/request.rb +7 -8
- data/lib/playwright_api/response.rb +10 -6
- data/lib/playwright_api/selectors.rb +13 -9
- data/lib/playwright_api/web_socket.rb +10 -1
- data/lib/playwright_api/worker.rb +13 -13
- metadata +12 -6
- data/lib/playwright/input_type.rb +0 -19
- data/lib/playwright/input_types/mouse.rb +0 -4
- data/lib/playwright/input_types/touchscreen.rb +0 -4
data/lib/playwright_api/frame.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 `
|
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
|
-
#
|
303
|
-
#
|
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(
|
363
|
-
wrap_impl(@impl.evaluate(unwrap_impl(
|
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 `
|
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
|
-
#
|
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
|
-
#
|
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(
|
430
|
-
wrap_impl(@impl.evaluate_handle(unwrap_impl(
|
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
|
435
|
-
#
|
436
|
-
#
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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(
|
651
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 `
|
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);"
|
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);"
|
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(
|
820
|
-
|
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
|
-
|
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
|
955
|
-
wrap_impl(@impl.
|
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
|
960
|
-
|
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
|
-
|
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
|
-
|
978
|
+
event_emitter_proxy.off(event, callback)
|
973
979
|
end
|
974
980
|
|
975
|
-
|
976
|
-
|
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
|