playwright-ruby-client 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/download.md +97 -0
  3. data/documentation/docs/api/element_handle.md +27 -2
  4. data/documentation/docs/api/frame.md +50 -17
  5. data/documentation/docs/api/locator.md +650 -0
  6. data/documentation/docs/api/page.md +68 -18
  7. data/documentation/docs/article/guides/inspector.md +31 -0
  8. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +1 -1
  9. data/documentation/docs/article/guides/semi_automation.md +1 -1
  10. data/documentation/docs/include/api_coverage.md +57 -1
  11. data/lib/playwright.rb +0 -1
  12. data/lib/playwright/channel_owners/browser_context.rb +25 -0
  13. data/lib/playwright/channel_owners/frame.rb +70 -33
  14. data/lib/playwright/channel_owners/page.rb +102 -40
  15. data/lib/playwright/{download.rb → download_impl.rb} +1 -1
  16. data/lib/playwright/javascript/expression.rb +5 -4
  17. data/lib/playwright/locator_impl.rb +314 -0
  18. data/lib/playwright/timeout_settings.rb +4 -4
  19. data/lib/playwright/version.rb +2 -2
  20. data/lib/playwright_api/android.rb +6 -6
  21. data/lib/playwright_api/android_device.rb +6 -6
  22. data/lib/playwright_api/browser.rb +6 -6
  23. data/lib/playwright_api/browser_context.rb +16 -11
  24. data/lib/playwright_api/browser_type.rb +6 -6
  25. data/lib/playwright_api/cdp_session.rb +6 -6
  26. data/lib/playwright_api/console_message.rb +6 -6
  27. data/lib/playwright_api/dialog.rb +6 -6
  28. data/lib/playwright_api/download.rb +70 -0
  29. data/lib/playwright_api/element_handle.rb +33 -19
  30. data/lib/playwright_api/frame.rb +81 -51
  31. data/lib/playwright_api/js_handle.rb +6 -6
  32. data/lib/playwright_api/locator.rb +509 -0
  33. data/lib/playwright_api/page.rb +84 -52
  34. data/lib/playwright_api/playwright.rb +6 -6
  35. data/lib/playwright_api/request.rb +6 -6
  36. data/lib/playwright_api/response.rb +6 -6
  37. data/lib/playwright_api/route.rb +6 -6
  38. data/lib/playwright_api/selectors.rb +6 -6
  39. data/lib/playwright_api/web_socket.rb +6 -6
  40. data/lib/playwright_api/worker.rb +6 -6
  41. metadata +10 -4
@@ -363,29 +363,28 @@ module Playwright
363
363
  end
364
364
 
365
365
  # @nodoc
366
- def browser=(req)
367
- wrap_impl(@impl.browser=(unwrap_impl(req)))
366
+ def enable_debug_console!
367
+ wrap_impl(@impl.enable_debug_console!)
368
368
  end
369
369
 
370
370
  # @nodoc
371
- def owner_page=(req)
372
- wrap_impl(@impl.owner_page=(unwrap_impl(req)))
371
+ def pause
372
+ wrap_impl(@impl.pause)
373
373
  end
374
374
 
375
375
  # @nodoc
376
- def options=(req)
377
- wrap_impl(@impl.options=(unwrap_impl(req)))
376
+ def browser=(req)
377
+ wrap_impl(@impl.browser=(unwrap_impl(req)))
378
378
  end
379
379
 
380
380
  # @nodoc
381
- def pause
382
- wrap_impl(@impl.pause)
381
+ def owner_page=(req)
382
+ wrap_impl(@impl.owner_page=(unwrap_impl(req)))
383
383
  end
384
384
 
385
- # -- inherited from EventEmitter --
386
385
  # @nodoc
387
- def off(event, callback)
388
- event_emitter_proxy.off(event, callback)
386
+ def options=(req)
387
+ wrap_impl(@impl.options=(unwrap_impl(req)))
389
388
  end
390
389
 
391
390
  # -- inherited from EventEmitter --
@@ -400,6 +399,12 @@ module Playwright
400
399
  event_emitter_proxy.on(event, callback)
401
400
  end
402
401
 
402
+ # -- inherited from EventEmitter --
403
+ # @nodoc
404
+ def off(event, callback)
405
+ event_emitter_proxy.off(event, callback)
406
+ end
407
+
403
408
  private def event_emitter_proxy
404
409
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
405
410
  end
@@ -144,12 +144,6 @@ module Playwright
144
144
  wrap_impl(@impl.name)
145
145
  end
146
146
 
147
- # -- inherited from EventEmitter --
148
- # @nodoc
149
- def off(event, callback)
150
- event_emitter_proxy.off(event, callback)
151
- end
152
-
153
147
  # -- inherited from EventEmitter --
154
148
  # @nodoc
155
149
  def once(event, callback)
@@ -162,6 +156,12 @@ module Playwright
162
156
  event_emitter_proxy.on(event, callback)
163
157
  end
164
158
 
159
+ # -- inherited from EventEmitter --
160
+ # @nodoc
161
+ def off(event, callback)
162
+ event_emitter_proxy.off(event, callback)
163
+ end
164
+
165
165
  private def event_emitter_proxy
166
166
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
167
167
  end
@@ -33,12 +33,6 @@ module Playwright
33
33
  wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
34
34
  end
35
35
 
36
- # -- inherited from EventEmitter --
37
- # @nodoc
38
- def off(event, callback)
39
- event_emitter_proxy.off(event, callback)
40
- end
41
-
42
36
  # -- inherited from EventEmitter --
43
37
  # @nodoc
44
38
  def once(event, callback)
@@ -51,6 +45,12 @@ module Playwright
51
45
  event_emitter_proxy.on(event, callback)
52
46
  end
53
47
 
48
+ # -- inherited from EventEmitter --
49
+ # @nodoc
50
+ def off(event, callback)
51
+ event_emitter_proxy.off(event, callback)
52
+ end
53
+
54
54
  private def event_emitter_proxy
55
55
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
56
56
  end
@@ -23,12 +23,6 @@ module Playwright
23
23
  wrap_impl(@impl.type)
24
24
  end
25
25
 
26
- # -- inherited from EventEmitter --
27
- # @nodoc
28
- def off(event, callback)
29
- event_emitter_proxy.off(event, callback)
30
- end
31
-
32
26
  # -- inherited from EventEmitter --
33
27
  # @nodoc
34
28
  def once(event, callback)
@@ -41,6 +35,12 @@ module Playwright
41
35
  event_emitter_proxy.on(event, callback)
42
36
  end
43
37
 
38
+ # -- inherited from EventEmitter --
39
+ # @nodoc
40
+ def off(event, callback)
41
+ event_emitter_proxy.off(event, callback)
42
+ end
43
+
44
44
  private def event_emitter_proxy
45
45
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
46
46
  end
@@ -58,12 +58,6 @@ module Playwright
58
58
  wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
59
59
  end
60
60
 
61
- # -- inherited from EventEmitter --
62
- # @nodoc
63
- def off(event, callback)
64
- event_emitter_proxy.off(event, callback)
65
- end
66
-
67
61
  # -- inherited from EventEmitter --
68
62
  # @nodoc
69
63
  def once(event, callback)
@@ -76,6 +70,12 @@ module Playwright
76
70
  event_emitter_proxy.on(event, callback)
77
71
  end
78
72
 
73
+ # -- inherited from EventEmitter --
74
+ # @nodoc
75
+ def off(event, callback)
76
+ event_emitter_proxy.off(event, callback)
77
+ end
78
+
79
79
  private def event_emitter_proxy
80
80
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
81
81
  end
@@ -0,0 +1,70 @@
1
+ module Playwright
2
+ # `Download` objects are dispatched by page via the [`event: Page.download`] event.
3
+ #
4
+ # All the downloaded files belonging to the browser context are deleted when the browser context is closed.
5
+ #
6
+ # Download event is emitted once the download starts. Download path becomes available once download completes:
7
+ #
8
+ # ```python sync
9
+ # with page.expect_download() as download_info:
10
+ # page.click("a")
11
+ # download = download_info.value
12
+ # # wait for download to complete
13
+ # path = download.path()
14
+ # ```
15
+ #
16
+ # > NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the
17
+ # downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not
18
+ # performed and user has no access to the downloaded files.
19
+ class Download < PlaywrightApi
20
+
21
+ # Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations,
22
+ # `download.failure()` would resolve to `'canceled'`.
23
+ def cancel
24
+ wrap_impl(@impl.cancel)
25
+ end
26
+
27
+ # Deletes the downloaded file. Will wait for the download to finish if necessary.
28
+ def delete
29
+ wrap_impl(@impl.delete)
30
+ end
31
+
32
+ # Returns download error if any. Will wait for the download to finish if necessary.
33
+ def failure
34
+ wrap_impl(@impl.failure)
35
+ end
36
+
37
+ # Get the page that the download belongs to.
38
+ def page
39
+ wrap_impl(@impl.page)
40
+ end
41
+
42
+ # Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if
43
+ # necessary. The method throws when connected remotely.
44
+ #
45
+ # Note that the download's file name is a random GUID, use [`method: Download.suggestedFilename`] to get suggested file
46
+ # name.
47
+ def path
48
+ wrap_impl(@impl.path)
49
+ end
50
+
51
+ # Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will
52
+ # wait for the download to finish if necessary.
53
+ def save_as(path)
54
+ wrap_impl(@impl.save_as(unwrap_impl(path)))
55
+ end
56
+
57
+ # Returns suggested filename for this download. It is typically computed by the browser from the
58
+ # [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
59
+ # or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
60
+ # browsers can use different logic for computing it.
61
+ def suggested_filename
62
+ wrap_impl(@impl.suggested_filename)
63
+ end
64
+
65
+ # Returns downloaded url.
66
+ def url
67
+ wrap_impl(@impl.url)
68
+ end
69
+ end
70
+ end
@@ -7,19 +7,8 @@ module Playwright
7
7
  # method.
8
8
  #
9
9
  # ```python sync
10
- # from playwright.sync_api import sync_playwright
11
- #
12
- # def run(playwright):
13
- # chromium = playwright.chromium
14
- # browser = chromium.launch()
15
- # page = browser.new_page()
16
- # page.goto("https://example.com")
17
- # href_element = page.query_selector("a")
18
- # href_element.click()
19
- # # ...
20
- #
21
- # with sync_playwright() as playwright:
22
- # run(playwright)
10
+ # href_element = page.query_selector("a")
11
+ # href_element.click()
23
12
  # ```
24
13
  #
25
14
  # ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
@@ -27,6 +16,31 @@ module Playwright
27
16
  #
28
17
  # ElementHandle instances can be used as an argument in [`method: Page.evalOnSelector`] and [`method: Page.evaluate`]
29
18
  # methods.
19
+ #
20
+ # > NOTE: In most cases, you would want to use the `Locator` object instead. You should only use `ElementHandle` if you
21
+ # want to retain a handle to a particular DOM Node that you intend to pass into [`method: Page.evaluate`] as an argument.
22
+ #
23
+ # The difference between the `Locator` and ElementHandle is that the ElementHandle points to a particular element, while
24
+ # `Locator` captures the logic of how to retrieve an element.
25
+ #
26
+ # In the example below, handle points to a particular DOM element on page. If that element changes text or is used by
27
+ # React to render an entirely different component, handle is still pointing to that very DOM element. This can lead to
28
+ # unexpected behaviors.
29
+ #
30
+ # ```python sync
31
+ # handle = page.query_selector("text=Submit")
32
+ # handle.hover()
33
+ # handle.click()
34
+ # ```
35
+ #
36
+ # With the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So
37
+ # in the snippet below, underlying DOM element is going to be located twice.
38
+ #
39
+ # ```python sync
40
+ # locator = page.locator("text=Submit")
41
+ # locator.hover()
42
+ # locator.click()
43
+ # ```
30
44
  class ElementHandle < JSHandle
31
45
 
32
46
  # This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
@@ -515,12 +529,6 @@ module Playwright
515
529
  wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
516
530
  end
517
531
 
518
- # -- inherited from EventEmitter --
519
- # @nodoc
520
- def off(event, callback)
521
- event_emitter_proxy.off(event, callback)
522
- end
523
-
524
532
  # -- inherited from EventEmitter --
525
533
  # @nodoc
526
534
  def once(event, callback)
@@ -533,6 +541,12 @@ module Playwright
533
541
  event_emitter_proxy.on(event, callback)
534
542
  end
535
543
 
544
+ # -- inherited from EventEmitter --
545
+ # @nodoc
546
+ def off(event, callback)
547
+ event_emitter_proxy.off(event, callback)
548
+ end
549
+
536
550
  private def event_emitter_proxy
537
551
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
538
552
  end
@@ -65,9 +65,10 @@ module Playwright
65
65
  force: nil,
66
66
  noWaitAfter: nil,
67
67
  position: nil,
68
+ strict: nil,
68
69
  timeout: nil,
69
70
  trial: nil)
70
- wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
71
+ wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
71
72
  end
72
73
 
73
74
  def child_frames
@@ -93,9 +94,10 @@ module Playwright
93
94
  modifiers: nil,
94
95
  noWaitAfter: nil,
95
96
  position: nil,
97
+ strict: nil,
96
98
  timeout: nil,
97
99
  trial: nil)
98
- 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), trial: unwrap_impl(trial)))
100
+ 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), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
99
101
  end
100
102
 
101
103
  # Gets the full HTML contents of the frame, including the doctype.
@@ -124,9 +126,10 @@ module Playwright
124
126
  modifiers: nil,
125
127
  noWaitAfter: nil,
126
128
  position: nil,
129
+ strict: nil,
127
130
  timeout: nil,
128
131
  trial: nil)
129
- 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), trial: unwrap_impl(trial)))
132
+ 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), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
130
133
  end
131
134
 
132
135
  # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
@@ -156,8 +159,13 @@ module Playwright
156
159
  # data_transfer = frame.evaluate_handle("new DataTransfer()")
157
160
  # frame.dispatch_event("#source", "dragstart", { "dataTransfer": data_transfer })
158
161
  # ```
159
- def dispatch_event(selector, type, eventInit: nil, timeout: nil)
160
- wrap_impl(@impl.dispatch_event(unwrap_impl(selector), unwrap_impl(type), eventInit: unwrap_impl(eventInit), timeout: unwrap_impl(timeout)))
162
+ def dispatch_event(
163
+ selector,
164
+ type,
165
+ eventInit: nil,
166
+ strict: nil,
167
+ timeout: nil)
168
+ wrap_impl(@impl.dispatch_event(unwrap_impl(selector), unwrap_impl(type), eventInit: unwrap_impl(eventInit), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
161
169
  end
162
170
 
163
171
  def drag_and_drop(
@@ -165,9 +173,10 @@ module Playwright
165
173
  target,
166
174
  force: nil,
167
175
  noWaitAfter: nil,
176
+ strict: nil,
168
177
  timeout: nil,
169
178
  trial: nil)
170
- wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
179
+ wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
171
180
  end
172
181
 
173
182
  # Returns the return value of `expression`.
@@ -186,8 +195,8 @@ module Playwright
186
195
  # preload_href = frame.eval_on_selector("link[rel=preload]", "el => el.href")
187
196
  # html = frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
188
197
  # ```
189
- def eval_on_selector(selector, expression, arg: nil)
190
- wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg)))
198
+ def eval_on_selector(selector, expression, arg: nil, strict: nil)
199
+ wrap_impl(@impl.eval_on_selector(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg), strict: unwrap_impl(strict)))
191
200
  end
192
201
 
193
202
  # Returns the return value of `expression`.
@@ -286,14 +295,15 @@ module Playwright
286
295
  value,
287
296
  force: nil,
288
297
  noWaitAfter: nil,
298
+ strict: nil,
289
299
  timeout: nil)
290
- wrap_impl(@impl.fill(unwrap_impl(selector), unwrap_impl(value), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
300
+ wrap_impl(@impl.fill(unwrap_impl(selector), unwrap_impl(value), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
291
301
  end
292
302
 
293
303
  # This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
294
304
  # waits until a matching element appears in the DOM.
295
- def focus(selector, timeout: nil)
296
- wrap_impl(@impl.focus(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
305
+ def focus(selector, strict: nil, timeout: nil)
306
+ wrap_impl(@impl.focus(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
297
307
  end
298
308
 
299
309
  # Returns the `frame` or `iframe` element handle which corresponds to this frame.
@@ -313,8 +323,8 @@ module Playwright
313
323
  end
314
324
 
315
325
  # Returns element attribute value.
316
- def get_attribute(selector, name, timeout: nil)
317
- wrap_impl(@impl.get_attribute(unwrap_impl(selector), unwrap_impl(name), timeout: unwrap_impl(timeout)))
326
+ def get_attribute(selector, name, strict: nil, timeout: nil)
327
+ wrap_impl(@impl.get_attribute(unwrap_impl(selector), unwrap_impl(name), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
318
328
  end
319
329
 
320
330
  # Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
@@ -354,29 +364,30 @@ module Playwright
354
364
  force: nil,
355
365
  modifiers: nil,
356
366
  position: nil,
367
+ strict: nil,
357
368
  timeout: nil,
358
369
  trial: nil)
359
- wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
370
+ wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
360
371
  end
361
372
 
362
373
  # Returns `element.innerHTML`.
363
- def inner_html(selector, timeout: nil)
364
- wrap_impl(@impl.inner_html(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
374
+ def inner_html(selector, strict: nil, timeout: nil)
375
+ wrap_impl(@impl.inner_html(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
365
376
  end
366
377
 
367
378
  # Returns `element.innerText`.
368
- def inner_text(selector, timeout: nil)
369
- wrap_impl(@impl.inner_text(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
379
+ def inner_text(selector, strict: nil, timeout: nil)
380
+ wrap_impl(@impl.inner_text(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
370
381
  end
371
382
 
372
383
  # Returns `input.value` for the selected `<input>` or `<textarea>` element. Throws for non-input elements.
373
- def input_value(selector, timeout: nil)
374
- wrap_impl(@impl.input_value(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
384
+ def input_value(selector, strict: nil, timeout: nil)
385
+ wrap_impl(@impl.input_value(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
375
386
  end
376
387
 
377
388
  # Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
378
- def checked?(selector, timeout: nil)
379
- wrap_impl(@impl.checked?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
389
+ def checked?(selector, strict: nil, timeout: nil)
390
+ wrap_impl(@impl.checked?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
380
391
  end
381
392
 
382
393
  # Returns `true` if the frame has been detached, or `false` otherwise.
@@ -385,30 +396,39 @@ module Playwright
385
396
  end
386
397
 
387
398
  # Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
388
- def disabled?(selector, timeout: nil)
389
- wrap_impl(@impl.disabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
399
+ def disabled?(selector, strict: nil, timeout: nil)
400
+ wrap_impl(@impl.disabled?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
390
401
  end
391
402
 
392
403
  # Returns whether the element is [editable](./actionability.md#editable).
393
- def editable?(selector, timeout: nil)
394
- wrap_impl(@impl.editable?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
404
+ def editable?(selector, strict: nil, timeout: nil)
405
+ wrap_impl(@impl.editable?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
395
406
  end
396
407
 
397
408
  # Returns whether the element is [enabled](./actionability.md#enabled).
398
- def enabled?(selector, timeout: nil)
399
- wrap_impl(@impl.enabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
409
+ def enabled?(selector, strict: nil, timeout: nil)
410
+ wrap_impl(@impl.enabled?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
400
411
  end
401
412
 
402
413
  # Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not
403
414
  # match any elements is considered hidden.
404
- def hidden?(selector, timeout: nil)
405
- wrap_impl(@impl.hidden?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
415
+ def hidden?(selector, strict: nil, timeout: nil)
416
+ wrap_impl(@impl.hidden?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
406
417
  end
407
418
 
408
419
  # Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is
409
420
  # considered not visible.
410
- def visible?(selector, timeout: nil)
411
- wrap_impl(@impl.visible?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
421
+ def visible?(selector, strict: nil, timeout: nil)
422
+ wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
423
+ end
424
+
425
+ # The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
426
+ # element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
427
+ # different DOM elements. That would happen if the DOM structure between those actions has changed.
428
+ #
429
+ # Note that locator always implies visibility, so it will always be locating visible elements.
430
+ def locator(selector)
431
+ wrap_impl(@impl.locator(unwrap_impl(selector)))
412
432
  end
413
433
 
414
434
  # Returns frame's name attribute as specified in the tag.
@@ -451,16 +471,17 @@ module Playwright
451
471
  key,
452
472
  delay: nil,
453
473
  noWaitAfter: nil,
474
+ strict: nil,
454
475
  timeout: nil)
455
- wrap_impl(@impl.press(unwrap_impl(selector), unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
476
+ wrap_impl(@impl.press(unwrap_impl(selector), unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
456
477
  end
457
478
 
458
479
  # Returns the ElementHandle pointing to the frame element.
459
480
  #
460
481
  # The method finds an element matching the specified selector within the frame. See
461
482
  # [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`.
462
- def query_selector(selector)
463
- wrap_impl(@impl.query_selector(unwrap_impl(selector)))
483
+ def query_selector(selector, strict: nil)
484
+ wrap_impl(@impl.query_selector(unwrap_impl(selector), strict: unwrap_impl(strict)))
464
485
  end
465
486
 
466
487
  # Returns the ElementHandles pointing to the frame elements.
@@ -498,8 +519,9 @@ module Playwright
498
519
  label: nil,
499
520
  force: nil,
500
521
  noWaitAfter: nil,
522
+ strict: nil,
501
523
  timeout: nil)
502
- wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
524
+ wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
503
525
  end
504
526
 
505
527
  def set_content(html, timeout: nil, waitUntil: nil)
@@ -512,8 +534,13 @@ module Playwright
512
534
  #
513
535
  # Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
514
536
  # are resolved relative to the the current working directory. For empty array, clears the selected files.
515
- def set_input_files(selector, files, noWaitAfter: nil, timeout: nil)
516
- wrap_impl(@impl.set_input_files(unwrap_impl(selector), unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
537
+ def set_input_files(
538
+ selector,
539
+ files,
540
+ noWaitAfter: nil,
541
+ strict: nil,
542
+ timeout: nil)
543
+ wrap_impl(@impl.set_input_files(unwrap_impl(selector), unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
517
544
  end
518
545
 
519
546
  # This method taps an element matching `selector` by performing the following steps:
@@ -534,14 +561,15 @@ module Playwright
534
561
  modifiers: nil,
535
562
  noWaitAfter: nil,
536
563
  position: nil,
564
+ strict: nil,
537
565
  timeout: nil,
538
566
  trial: nil)
539
- 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), trial: unwrap_impl(trial)))
567
+ wrap_impl(@impl.tap_point(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
540
568
  end
541
569
 
542
570
  # Returns `element.textContent`.
543
- def text_content(selector, timeout: nil)
544
- wrap_impl(@impl.text_content(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
571
+ def text_content(selector, strict: nil, timeout: nil)
572
+ wrap_impl(@impl.text_content(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
545
573
  end
546
574
 
547
575
  # Returns the page title.
@@ -563,8 +591,9 @@ module Playwright
563
591
  text,
564
592
  delay: nil,
565
593
  noWaitAfter: nil,
594
+ strict: nil,
566
595
  timeout: nil)
567
- wrap_impl(@impl.type(unwrap_impl(selector), unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
596
+ wrap_impl(@impl.type(unwrap_impl(selector), unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
568
597
  end
569
598
 
570
599
  # This method checks an element matching `selector` by performing the following steps:
@@ -585,9 +614,10 @@ module Playwright
585
614
  force: nil,
586
615
  noWaitAfter: nil,
587
616
  position: nil,
617
+ strict: nil,
588
618
  timeout: nil,
589
619
  trial: nil)
590
- wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
620
+ wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
591
621
  end
592
622
 
593
623
  # Returns frame's url.
@@ -681,8 +711,8 @@ module Playwright
681
711
  # with sync_playwright() as playwright:
682
712
  # run(playwright)
683
713
  # ```
684
- def wait_for_selector(selector, state: nil, timeout: nil)
685
- wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
714
+ def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
715
+ wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
686
716
  end
687
717
 
688
718
  # Waits for the given `timeout` in milliseconds.
@@ -708,12 +738,6 @@ module Playwright
708
738
  wrap_impl(@impl.detached=(unwrap_impl(req)))
709
739
  end
710
740
 
711
- # -- inherited from EventEmitter --
712
- # @nodoc
713
- def off(event, callback)
714
- event_emitter_proxy.off(event, callback)
715
- end
716
-
717
741
  # -- inherited from EventEmitter --
718
742
  # @nodoc
719
743
  def once(event, callback)
@@ -726,6 +750,12 @@ module Playwright
726
750
  event_emitter_proxy.on(event, callback)
727
751
  end
728
752
 
753
+ # -- inherited from EventEmitter --
754
+ # @nodoc
755
+ def off(event, callback)
756
+ event_emitter_proxy.off(event, callback)
757
+ end
758
+
729
759
  private def event_emitter_proxy
730
760
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
731
761
  end