playwright-ruby-client 0.2.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/docs/api_coverage.md +116 -74
  4. data/lib/playwright.rb +48 -9
  5. data/lib/playwright/channel.rb +12 -2
  6. data/lib/playwright/channel_owners/artifact.rb +30 -0
  7. data/lib/playwright/channel_owners/binding_call.rb +3 -0
  8. data/lib/playwright/channel_owners/browser.rb +21 -0
  9. data/lib/playwright/channel_owners/browser_context.rb +154 -3
  10. data/lib/playwright/channel_owners/browser_type.rb +28 -0
  11. data/lib/playwright/channel_owners/dialog.rb +28 -0
  12. data/lib/playwright/channel_owners/element_handle.rb +6 -4
  13. data/lib/playwright/channel_owners/frame.rb +25 -2
  14. data/lib/playwright/channel_owners/js_handle.rb +2 -2
  15. data/lib/playwright/channel_owners/page.rb +141 -25
  16. data/lib/playwright/channel_owners/playwright.rb +24 -27
  17. data/lib/playwright/channel_owners/request.rb +26 -2
  18. data/lib/playwright/channel_owners/response.rb +60 -0
  19. data/lib/playwright/channel_owners/route.rb +78 -0
  20. data/lib/playwright/channel_owners/selectors.rb +19 -1
  21. data/lib/playwright/channel_owners/stream.rb +15 -0
  22. data/lib/playwright/connection.rb +11 -32
  23. data/lib/playwright/download.rb +27 -0
  24. data/lib/playwright/errors.rb +6 -0
  25. data/lib/playwright/events.rb +2 -5
  26. data/lib/playwright/keyboard_impl.rb +1 -1
  27. data/lib/playwright/mouse_impl.rb +41 -0
  28. data/lib/playwright/playwright_api.rb +3 -1
  29. data/lib/playwright/route_handler_entry.rb +28 -0
  30. data/lib/playwright/transport.rb +29 -7
  31. data/lib/playwright/url_matcher.rb +1 -1
  32. data/lib/playwright/utils.rb +9 -0
  33. data/lib/playwright/version.rb +1 -1
  34. data/lib/playwright/video.rb +51 -0
  35. data/lib/playwright/wait_helper.rb +2 -2
  36. data/lib/playwright_api/accessibility.rb +39 -1
  37. data/lib/playwright_api/android.rb +74 -2
  38. data/lib/playwright_api/android_device.rb +141 -23
  39. data/lib/playwright_api/android_input.rb +17 -13
  40. data/lib/playwright_api/android_socket.rb +16 -0
  41. data/lib/playwright_api/android_web_view.rb +21 -0
  42. data/lib/playwright_api/browser.rb +77 -2
  43. data/lib/playwright_api/browser_context.rb +182 -29
  44. data/lib/playwright_api/browser_type.rb +40 -9
  45. data/lib/playwright_api/dialog.rb +54 -7
  46. data/lib/playwright_api/element_handle.rb +105 -31
  47. data/lib/playwright_api/file_chooser.rb +6 -1
  48. data/lib/playwright_api/frame.rb +229 -36
  49. data/lib/playwright_api/js_handle.rb +23 -0
  50. data/lib/playwright_api/keyboard.rb +48 -1
  51. data/lib/playwright_api/mouse.rb +26 -5
  52. data/lib/playwright_api/page.rb +491 -81
  53. data/lib/playwright_api/playwright.rb +21 -4
  54. data/lib/playwright_api/request.rb +30 -2
  55. data/lib/playwright_api/response.rb +21 -11
  56. data/lib/playwright_api/route.rb +51 -5
  57. data/lib/playwright_api/selectors.rb +27 -1
  58. data/lib/playwright_api/touchscreen.rb +1 -1
  59. data/lib/playwright_api/worker.rb +25 -1
  60. data/playwright.gemspec +4 -2
  61. metadata +42 -14
  62. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  63. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  64. data/lib/playwright/channel_owners/download.rb +0 -27
  65. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  66. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  67. data/lib/playwright_api/binding_call.rb +0 -27
  68. data/lib/playwright_api/chromium_browser_context.rb +0 -59
  69. data/lib/playwright_api/download.rb +0 -95
  70. data/lib/playwright_api/video.rb +0 -24
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- # `FileChooser` objects are dispatched by the page in the [`event: Page.filechooser`] event.
2
+ # `FileChooser` objects are dispatched by the page in the [`event: Page.fileChooser`] event.
3
3
  #
4
4
  #
5
5
  # ```js
@@ -10,6 +10,11 @@ module Playwright
10
10
  # await fileChooser.setFiles('myfile.pdf');
11
11
  # ```
12
12
  #
13
+ # ```java
14
+ # FileChooser fileChooser = page.waitForFileChooser(() -> page.click("upload"));
15
+ # fileChooser.setFiles(Paths.get("myfile.pdf"));
16
+ # ```
17
+ #
13
18
  # ```python async
14
19
  # async with page.expect_file_chooser() as fc_info:
15
20
  # await page.click("upload")
@@ -3,10 +3,10 @@ module Playwright
3
3
  # [`method: Frame.childFrames`] methods.
4
4
  #
5
5
  # `Frame` object's lifecycle is controlled by three events, dispatched on the page object:
6
- # - [`event: Page.frameattached`] - fired when the frame gets attached to the page. A Frame can be attached to the page
6
+ # - [`event: Page.frameAttached`] - fired when the frame gets attached to the page. A Frame can be attached to the page
7
7
  # only once.
8
- # - [`event: Page.framenavigated`] - fired when the frame commits navigation to a different URL.
9
- # - [`event: Page.framedetached`] - fired when the frame gets detached from the page. A Frame can be detached from the
8
+ # - [`event: Page.frameNavigated`] - fired when the frame commits navigation to a different URL.
9
+ # - [`event: Page.frameDetached`] - fired when the frame gets detached from the page. A Frame can be detached from the
10
10
  # page only once.
11
11
  #
12
12
  # An example of dumping frame tree:
@@ -31,6 +31,29 @@ module Playwright
31
31
  # })();
32
32
  # ```
33
33
  #
34
+ # ```java
35
+ # import com.microsoft.playwright.*;
36
+ #
37
+ # public class Example {
38
+ # public static void main(String[] args) {
39
+ # try (Playwright playwright = Playwright.create()) {
40
+ # BrowserType firefox = playwright.firefox();
41
+ # Browser browser = firefox.launch();
42
+ # Page page = browser.newPage();
43
+ # page.navigate("https://www.google.com/chrome/browser/canary.html");
44
+ # dumpFrameTree(page.mainFrame(), "");
45
+ # browser.close();
46
+ # }
47
+ # }
48
+ # static void dumpFrameTree(Frame frame, String indent) {
49
+ # System.out.println(indent + frame.url());
50
+ # for (Frame child : frame.childFrames()) {
51
+ # dumpFrameTree(child, indent + " ");
52
+ # }
53
+ # }
54
+ # }
55
+ # ```
56
+ #
34
57
  # ```python async
35
58
  # import asyncio
36
59
  # from playwright.async_api import async_playwright
@@ -91,20 +114,25 @@ module Playwright
91
114
  end
92
115
 
93
116
  # This method checks an element matching `selector` by performing the following steps:
94
- # 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.
95
- # 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already
117
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
118
+ # 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
96
119
  # checked, this method returns immediately.
97
120
  # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
98
121
  # element is detached during the checks, the whole action is retried.
99
122
  # 1. Scroll the element into view if needed.
100
123
  # 1. Use [`property: Page.mouse`] to click in the center of the element.
101
124
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
102
- # 1. Ensure that the element is now checked. If not, this method rejects.
125
+ # 1. Ensure that the element is now checked. If not, this method throws.
103
126
  #
104
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
105
- # Passing zero timeout disables this.
106
- def check(selector, force: nil, noWaitAfter: nil, timeout: nil)
107
- wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
127
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
128
+ # zero timeout disables this.
129
+ def check(
130
+ selector,
131
+ force: nil,
132
+ noWaitAfter: nil,
133
+ position: nil,
134
+ timeout: nil)
135
+ wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
108
136
  end
109
137
 
110
138
  def child_frames
@@ -112,15 +140,15 @@ module Playwright
112
140
  end
113
141
 
114
142
  # This method clicks an element matching `selector` by performing the following steps:
115
- # 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.
143
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
116
144
  # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
117
145
  # element is detached during the checks, the whole action is retried.
118
146
  # 1. Scroll the element into view if needed.
119
147
  # 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
120
148
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
121
149
  #
122
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
123
- # Passing zero timeout disables this.
150
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
151
+ # zero timeout disables this.
124
152
  def click(
125
153
  selector,
126
154
  button: nil,
@@ -140,16 +168,16 @@ module Playwright
140
168
  end
141
169
 
142
170
  # This method double clicks an element matching `selector` by performing the following steps:
143
- # 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.
171
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
144
172
  # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
145
173
  # element is detached during the checks, the whole action is retried.
146
174
  # 1. Scroll the element into view if needed.
147
175
  # 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
148
176
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
149
- # first click of the `dblclick()` triggers a navigation event, this method will reject.
177
+ # first click of the `dblclick()` triggers a navigation event, this method will throw.
150
178
  #
151
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
152
- # Passing zero timeout disables this.
179
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
180
+ # zero timeout disables this.
153
181
  #
154
182
  # > NOTE: `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.
155
183
  def dblclick(
@@ -164,8 +192,8 @@ module Playwright
164
192
  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)))
165
193
  end
166
194
 
167
- # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click`
168
- # is dispatched. This is equivalend to calling
195
+ # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
196
+ # `click` is dispatched. This is equivalent to calling
169
197
  # [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
170
198
  #
171
199
  #
@@ -173,6 +201,10 @@ module Playwright
173
201
  # await frame.dispatchEvent('button#submit', 'click');
174
202
  # ```
175
203
  #
204
+ # ```java
205
+ # frame.dispatchEvent("button#submit", "click");
206
+ # ```
207
+ #
176
208
  # ```python async
177
209
  # await frame.dispatch_event("button#submit", "click")
178
210
  # ```
@@ -202,6 +234,14 @@ module Playwright
202
234
  # await frame.dispatchEvent('#source', 'dragstart', { dataTransfer });
203
235
  # ```
204
236
  #
237
+ # ```java
238
+ # // Note you can only create DataTransfer in Chromium and Firefox
239
+ # JSHandle dataTransfer = frame.evaluateHandle("() => new DataTransfer()");
240
+ # Map<String, Object> arg = new HashMap<>();
241
+ # arg.put("dataTransfer", dataTransfer);
242
+ # frame.dispatchEvent("#source", "dragstart", arg);
243
+ # ```
244
+ #
205
245
  # ```python async
206
246
  # # note you can only create data_transfer in chromium and firefox
207
247
  # data_transfer = await frame.evaluate_handle("new DataTransfer()")
@@ -235,6 +275,12 @@ module Playwright
235
275
  # const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
236
276
  # ```
237
277
  #
278
+ # ```java
279
+ # String searchValue = (String) frame.evalOnSelector("#search", "el => el.value");
280
+ # String preloadHref = (String) frame.evalOnSelector("link[rel=preload]", "el => el.href");
281
+ # String html = (String) frame.evalOnSelector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello");
282
+ # ```
283
+ #
238
284
  # ```python async
239
285
  # search_value = await frame.eval_on_selector("#search", "el => el.value")
240
286
  # preload_href = await frame.eval_on_selector("link[rel=preload]", "el => el.href")
@@ -265,6 +311,10 @@ module Playwright
265
311
  # const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);
266
312
  # ```
267
313
  #
314
+ # ```java
315
+ # boolean divsCounts = (boolean) page.evalOnSelectorAll("div", "(divs, min) => divs.length >= min", 10);
316
+ # ```
317
+ #
268
318
  # ```python async
269
319
  # divs_counts = await frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
270
320
  # ```
@@ -293,6 +343,13 @@ module Playwright
293
343
  # console.log(result); // prints "56"
294
344
  # ```
295
345
  #
346
+ # ```java
347
+ # Object result = frame.evaluate("([x, y]) => {\n" +
348
+ # " return Promise.resolve(x * y);\n" +
349
+ # "}", Arrays.asList(7, 8));
350
+ # System.out.println(result); // prints "56"
351
+ # ```
352
+ #
296
353
  # ```python async
297
354
  # result = await frame.evaluate("([x, y]) => Promise.resolve(x * y)", [7, 8])
298
355
  # print(result) # prints "56"
@@ -310,6 +367,10 @@ module Playwright
310
367
  # console.log(await frame.evaluate('1 + 2')); // prints "3"
311
368
  # ```
312
369
  #
370
+ # ```java
371
+ # System.out.println(frame.evaluate("1 + 2")); // prints "3"
372
+ # ```
373
+ #
313
374
  # ```python async
314
375
  # print(await frame.evaluate("1 + 2")) # prints "3"
315
376
  # x = 10
@@ -331,6 +392,12 @@ module Playwright
331
392
  # await bodyHandle.dispose();
332
393
  # ```
333
394
  #
395
+ # ```java
396
+ # ElementHandle bodyHandle = frame.querySelector("body");
397
+ # String html = (String) frame.evaluate("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(bodyHandle, "hello"));
398
+ # bodyHandle.dispose();
399
+ # ```
400
+ #
334
401
  # ```python async
335
402
  # body_handle = await frame.query_selector("body")
336
403
  # html = await frame.evaluate("([body, suffix]) => body.innerHTML + suffix", [body_handle, "hello"])
@@ -349,7 +416,7 @@ module Playwright
349
416
  # Returns the return value of `expression` as a `JSHandle`.
350
417
  #
351
418
  # The only difference between [`method: Frame.evaluate`] and [`method: Frame.evaluateHandle`] is that
352
- # [method: Frame.evaluateHandle`] returns `JSHandle`.
419
+ # [`method: Frame.evaluateHandle`] returns `JSHandle`.
353
420
  #
354
421
  # If the function, passed to the [`method: Frame.evaluateHandle`], returns a [Promise], then
355
422
  # [`method: Frame.evaluateHandle`] would wait for the promise to resolve and return its value.
@@ -360,6 +427,11 @@ module Playwright
360
427
  # aWindowHandle; // Handle for the window object.
361
428
  # ```
362
429
  #
430
+ # ```java
431
+ # // Handle for the window object.
432
+ # JSHandle aWindowHandle = frame.evaluateHandle("() => Promise.resolve(window)");
433
+ # ```
434
+ #
363
435
  # ```python async
364
436
  # a_window_handle = await frame.evaluate_handle("Promise.resolve(window)")
365
437
  # a_window_handle # handle for the window object.
@@ -377,6 +449,10 @@ module Playwright
377
449
  # const aHandle = await frame.evaluateHandle('document'); // Handle for the 'document'.
378
450
  # ```
379
451
  #
452
+ # ```java
453
+ # JSHandle aHandle = frame.evaluateHandle("document"); // Handle for the "document".
454
+ # ```
455
+ #
380
456
  # ```python async
381
457
  # a_handle = await page.evaluate_handle("document") # handle for the "document"
382
458
  # ```
@@ -395,6 +471,13 @@ module Playwright
395
471
  # await resultHandle.dispose();
396
472
  # ```
397
473
  #
474
+ # ```java
475
+ # JSHandle aHandle = frame.evaluateHandle("() => document.body");
476
+ # JSHandle resultHandle = frame.evaluateHandle("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(aHandle, "hello"));
477
+ # System.out.println(resultHandle.jsonValue());
478
+ # resultHandle.dispose();
479
+ # ```
480
+ #
398
481
  # ```python async
399
482
  # a_handle = await page.evaluate_handle("document.body")
400
483
  # result_handle = await page.evaluate_handle("body => body.innerHTML", a_handle)
@@ -443,6 +526,12 @@ module Playwright
443
526
  # console.log(frame === contentFrame); // -> true
444
527
  # ```
445
528
  #
529
+ # ```java
530
+ # ElementHandle frameElement = frame.frameElement();
531
+ # Frame contentFrame = frameElement.contentFrame();
532
+ # System.out.println(frame == contentFrame); // -> true
533
+ # ```
534
+ #
446
535
  # ```python async
447
536
  # frame_element = await frame.frame_element()
448
537
  # content_frame = await frame_element.content_frame()
@@ -486,15 +575,15 @@ module Playwright
486
575
  end
487
576
 
488
577
  # This method hovers over an element matching `selector` by performing the following steps:
489
- # 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.
578
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
490
579
  # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
491
580
  # element is detached during the checks, the whole action is retried.
492
581
  # 1. Scroll the element into view if needed.
493
582
  # 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
494
583
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
495
584
  #
496
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
497
- # Passing zero timeout disables this.
585
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
586
+ # zero timeout disables this.
498
587
  def hover(
499
588
  selector,
500
589
  force: nil,
@@ -539,12 +628,14 @@ module Playwright
539
628
  wrap_impl(@impl.enabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
540
629
  end
541
630
 
542
- # Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
631
+ # Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not
632
+ # match any elements is considered hidden.
543
633
  def hidden?(selector, timeout: nil)
544
634
  wrap_impl(@impl.hidden?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
545
635
  end
546
636
 
547
- # Returns whether the element is [visible](./actionability.md#visible).
637
+ # Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is
638
+ # considered not visible.
548
639
  def visible?(selector, timeout: nil)
549
640
  wrap_impl(@impl.visible?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
550
641
  end
@@ -582,7 +673,7 @@ module Playwright
582
673
  # If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
583
674
  # texts.
584
675
  #
585
- # Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the
676
+ # Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
586
677
  # modifier, modifier is pressed and being held while the subsequent key is being pressed.
587
678
  def press(
588
679
  selector,
@@ -628,6 +719,15 @@ module Playwright
628
719
  # frame.selectOption('select#colors', 'red', 'green', 'blue');
629
720
  # ```
630
721
  #
722
+ # ```java
723
+ # // single selection matching the value
724
+ # frame.selectOption("select#colors", "blue");
725
+ # // single selection matching both the value and the label
726
+ # frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
727
+ # // multiple selection
728
+ # frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
729
+ # ```
730
+ #
631
731
  # ```python async
632
732
  # # single selection matching the value
633
733
  # await frame.select_option("select#colors", "blue")
@@ -671,15 +771,15 @@ module Playwright
671
771
  end
672
772
 
673
773
  # This method taps an element matching `selector` by performing the following steps:
674
- # 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.
774
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
675
775
  # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
676
776
  # element is detached during the checks, the whole action is retried.
677
777
  # 1. Scroll the element into view if needed.
678
778
  # 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
679
779
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
680
780
  #
681
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
682
- # Passing zero timeout disables this.
781
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
782
+ # zero timeout disables this.
683
783
  #
684
784
  # > NOTE: `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.
685
785
  def tap_point(
@@ -713,6 +813,13 @@ module Playwright
713
813
  # await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
714
814
  # ```
715
815
  #
816
+ # ```java
817
+ # // Types instantly
818
+ # frame.type("#mytextarea", "Hello");
819
+ # // Types slower, like a user
820
+ # frame.type("#mytextarea", "World", new Frame.TypeOptions().setDelay(100));
821
+ # ```
822
+ #
716
823
  # ```python async
717
824
  # await frame.type("#mytextarea", "hello") # types instantly
718
825
  # await frame.type("#mytextarea", "world", delay=100) # types slower, like a user
@@ -732,20 +839,25 @@ module Playwright
732
839
  end
733
840
 
734
841
  # This method checks an element matching `selector` by performing the following steps:
735
- # 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.
736
- # 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already
842
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
843
+ # 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
737
844
  # unchecked, this method returns immediately.
738
845
  # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
739
846
  # element is detached during the checks, the whole action is retried.
740
847
  # 1. Scroll the element into view if needed.
741
848
  # 1. Use [`property: Page.mouse`] to click in the center of the element.
742
849
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
743
- # 1. Ensure that the element is now unchecked. If not, this method rejects.
850
+ # 1. Ensure that the element is now unchecked. If not, this method throws.
744
851
  #
745
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
746
- # Passing zero timeout disables this.
747
- def uncheck(selector, force: nil, noWaitAfter: nil, timeout: nil)
748
- wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
852
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
853
+ # zero timeout disables this.
854
+ def uncheck(
855
+ selector,
856
+ force: nil,
857
+ noWaitAfter: nil,
858
+ position: nil,
859
+ timeout: nil)
860
+ wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
749
861
  end
750
862
 
751
863
  # Returns frame's url.
@@ -771,6 +883,23 @@ module Playwright
771
883
  # })();
772
884
  # ```
773
885
  #
886
+ # ```java
887
+ # import com.microsoft.playwright.*;
888
+ #
889
+ # public class Example {
890
+ # public static void main(String[] args) {
891
+ # try (Playwright playwright = Playwright.create()) {
892
+ # BrowserType firefox = playwright.firefox();
893
+ # Browser browser = firefox.launch();
894
+ # Page page = browser.newPage();
895
+ # page.setViewportSize(50, 50);
896
+ # page.mainFrame().waitForFunction("window.innerWidth < 100");
897
+ # browser.close();
898
+ # }
899
+ # }
900
+ # }
901
+ # ```
902
+ #
774
903
  # ```python async
775
904
  # import asyncio
776
905
  # from playwright.async_api import async_playwright
@@ -812,6 +941,11 @@ module Playwright
812
941
  # await frame.waitForFunction(selector => !!document.querySelector(selector), selector);
813
942
  # ```
814
943
  #
944
+ # ```java
945
+ # String selector = ".foo";
946
+ # frame.waitForFunction("selector => !!document.querySelector(selector)", selector);
947
+ # ```
948
+ #
815
949
  # ```python async
816
950
  # selector = ".foo"
817
951
  # await frame.wait_for_function("selector => !!document.querySelector(selector)", selector)
@@ -836,6 +970,11 @@ module Playwright
836
970
  # await frame.waitForLoadState(); // Waits for 'load' state by default.
837
971
  # ```
838
972
  #
973
+ # ```java
974
+ # frame.click("button"); // Click triggers navigation.
975
+ # frame.waitForLoadState(); // Waits for "load" state by default.
976
+ # ```
977
+ #
839
978
  # ```python async
840
979
  # await frame.click("button") # click triggers navigation.
841
980
  # await frame.wait_for_load_state() # the promise resolves after "load" event.
@@ -864,6 +1003,14 @@ module Playwright
864
1003
  # ]);
865
1004
  # ```
866
1005
  #
1006
+ # ```java
1007
+ # // The method returns after navigation has finished
1008
+ # Response response = frame.waitForNavigation(() -> {
1009
+ # // Clicking the link will indirectly cause a navigation
1010
+ # frame.click("a.delayed-navigation");
1011
+ # });
1012
+ # ```
1013
+ #
867
1014
  # ```python async
868
1015
  # async with frame.expect_navigation():
869
1016
  # await frame.click("a.delayed-navigation") # clicking the link will indirectly cause a navigation
@@ -907,6 +1054,26 @@ module Playwright
907
1054
  # })();
908
1055
  # ```
909
1056
  #
1057
+ # ```java
1058
+ # import com.microsoft.playwright.*;
1059
+ #
1060
+ # public class Example {
1061
+ # public static void main(String[] args) {
1062
+ # try (Playwright playwright = Playwright.create()) {
1063
+ # BrowserType chromium = playwright.chromium();
1064
+ # Browser browser = chromium.launch();
1065
+ # Page page = browser.newPage();
1066
+ # for (String currentURL : Arrays.asList("https://google.com", "https://bbc.com")) {
1067
+ # page.navigate(currentURL);
1068
+ # ElementHandle element = page.mainFrame().waitForSelector("img");
1069
+ # System.out.println("Loaded image: " + element.getAttribute("src"));
1070
+ # }
1071
+ # browser.close();
1072
+ # }
1073
+ # }
1074
+ # }
1075
+ # ```
1076
+ #
910
1077
  # ```python async
911
1078
  # import asyncio
912
1079
  # from playwright.async_api import async_playwright
@@ -955,6 +1122,32 @@ module Playwright
955
1122
  raise NotImplementedError.new('wait_for_timeout is not implemented yet.')
956
1123
  end
957
1124
 
1125
+ # Waits for the frame to navigate to the given URL.
1126
+ #
1127
+ #
1128
+ # ```js
1129
+ # await frame.click('a.delayed-navigation'); // Clicking the link will indirectly cause a navigation
1130
+ # await frame.waitForURL('**/target.html');
1131
+ # ```
1132
+ #
1133
+ # ```java
1134
+ # frame.click("a.delayed-navigation"); // Clicking the link will indirectly cause a navigation
1135
+ # frame.waitForURL("**/target.html");
1136
+ # ```
1137
+ #
1138
+ # ```python async
1139
+ # await frame.click("a.delayed-navigation") # clicking the link will indirectly cause a navigation
1140
+ # await frame.wait_for_url("**/target.html")
1141
+ # ```
1142
+ #
1143
+ # ```python sync
1144
+ # frame.click("a.delayed-navigation") # clicking the link will indirectly cause a navigation
1145
+ # frame.wait_for_url("**/target.html")
1146
+ # ```
1147
+ def wait_for_url(url, timeout: nil, waitUntil: nil)
1148
+ wrap_impl(@impl.wait_for_url(unwrap_impl(url), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
1149
+ end
1150
+
958
1151
  # @nodoc
959
1152
  def detached=(req)
960
1153
  wrap_impl(@impl.detached=(unwrap_impl(req)))