playwright-ruby-client 0.2.0 → 0.5.2

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 (69) 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 +1 -1
  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/route_handler_entry.rb +28 -0
  29. data/lib/playwright/transport.rb +27 -6
  30. data/lib/playwright/url_matcher.rb +1 -1
  31. data/lib/playwright/utils.rb +9 -0
  32. data/lib/playwright/version.rb +1 -1
  33. data/lib/playwright/video.rb +51 -0
  34. data/lib/playwright/wait_helper.rb +2 -2
  35. data/lib/playwright_api/accessibility.rb +39 -1
  36. data/lib/playwright_api/android.rb +74 -2
  37. data/lib/playwright_api/android_device.rb +141 -23
  38. data/lib/playwright_api/android_input.rb +17 -13
  39. data/lib/playwright_api/android_socket.rb +16 -0
  40. data/lib/playwright_api/android_web_view.rb +21 -0
  41. data/lib/playwright_api/browser.rb +77 -2
  42. data/lib/playwright_api/browser_context.rb +182 -29
  43. data/lib/playwright_api/browser_type.rb +40 -9
  44. data/lib/playwright_api/dialog.rb +54 -7
  45. data/lib/playwright_api/element_handle.rb +105 -31
  46. data/lib/playwright_api/file_chooser.rb +6 -1
  47. data/lib/playwright_api/frame.rb +229 -36
  48. data/lib/playwright_api/js_handle.rb +23 -0
  49. data/lib/playwright_api/keyboard.rb +48 -1
  50. data/lib/playwright_api/mouse.rb +26 -5
  51. data/lib/playwright_api/page.rb +491 -81
  52. data/lib/playwright_api/playwright.rb +21 -4
  53. data/lib/playwright_api/request.rb +30 -2
  54. data/lib/playwright_api/response.rb +21 -11
  55. data/lib/playwright_api/route.rb +51 -5
  56. data/lib/playwright_api/selectors.rb +27 -1
  57. data/lib/playwright_api/touchscreen.rb +1 -1
  58. data/lib/playwright_api/worker.rb +25 -1
  59. data/playwright.gemspec +4 -2
  60. metadata +42 -14
  61. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  62. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  63. data/lib/playwright/channel_owners/download.rb +0 -27
  64. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  65. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  66. data/lib/playwright_api/binding_call.rb +0 -27
  67. data/lib/playwright_api/chromium_browser_context.rb +0 -59
  68. data/lib/playwright_api/download.rb +0 -95
  69. data/lib/playwright_api/video.rb +0 -24
@@ -15,6 +15,23 @@ module Playwright
15
15
  # })();
16
16
  # ```
17
17
  #
18
+ # ```java
19
+ # import com.microsoft.playwright.*;
20
+ #
21
+ # public class Example {
22
+ # public static void main(String[] args) {
23
+ # try (Playwright playwright = Playwright.create()) {
24
+ # BrowserType chromium = playwright.chromium();
25
+ # Browser browser = chromium.launch();
26
+ # Page page = browser.newPage();
27
+ # page.navigate("https://example.com");
28
+ # // other actions...
29
+ # browser.close();
30
+ # }
31
+ # }
32
+ # }
33
+ # ```
34
+ #
18
35
  # ```python async
19
36
  # import asyncio
20
37
  # from playwright.async_api import async_playwright
@@ -65,6 +82,12 @@ module Playwright
65
82
  # });
66
83
  # ```
67
84
  #
85
+ # ```java
86
+ # // Or "firefox" or "webkit".
87
+ # Browser browser = chromium.launch(new BrowserType.LaunchOptions()
88
+ # .setIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
89
+ # ```
90
+ #
68
91
  # ```python async
69
92
  # browser = await playwright.chromium.launch( # or "firefox" or "webkit".
70
93
  # ignore_default_args=["--mute-audio"]
@@ -77,22 +100,23 @@ module Playwright
77
100
  # )
78
101
  # ```
79
102
  #
80
- # > **Chromium-only** Playwright can also be used to control the Chrome browser, but it works best with the version of
81
- # Chromium it is bundled with. There is no guarantee it will work with any other version. Use `executablePath` option with
82
- # extreme caution.
103
+ # > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
104
+ # best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use
105
+ # `executablePath` option with extreme caution.
83
106
  # >
84
107
  # > If Google Chrome (rather than Chromium) is preferred, a
85
108
  # [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or
86
109
  # [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested.
87
110
  # >
88
- # > In [`method: BrowserType.launch`] above, any mention of Chromium also applies to Chrome.
89
- # >
90
- # > See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for
91
- # a description of the differences between Chromium and Chrome.
92
- # [`This article`](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)
111
+ # > Stock browsers like Google Chrome and Microsoft Edge are suitable for tests that require proprietary media codecs for
112
+ # video playback. See
113
+ # [this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for other
114
+ # differences between Chromium and Chrome.
115
+ # [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)
93
116
  # describes some differences for Linux users.
94
117
  def launch(
95
118
  args: nil,
119
+ channel: nil,
96
120
  chromiumSandbox: nil,
97
121
  devtools: nil,
98
122
  downloadsPath: nil,
@@ -108,7 +132,7 @@ module Playwright
108
132
  slowMo: nil,
109
133
  timeout: nil,
110
134
  &block)
111
- wrap_impl(@impl.launch(args: unwrap_impl(args), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
135
+ wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
112
136
  end
113
137
 
114
138
  # Returns the persistent browser context instance.
@@ -120,6 +144,7 @@ module Playwright
120
144
  acceptDownloads: nil,
121
145
  args: nil,
122
146
  bypassCSP: nil,
147
+ channel: nil,
123
148
  chromiumSandbox: nil,
124
149
  colorScheme: nil,
125
150
  deviceScaleFactor: nil,
@@ -148,6 +173,7 @@ module Playwright
148
173
  record_har_path: nil,
149
174
  record_video_dir: nil,
150
175
  record_video_size: nil,
176
+ screen: nil,
151
177
  slowMo: nil,
152
178
  timeout: nil,
153
179
  timezoneId: nil,
@@ -161,6 +187,11 @@ module Playwright
161
187
  wrap_impl(@impl.name)
162
188
  end
163
189
 
190
+ # @nodoc
191
+ def connect_over_cdp(endpointURL, slowMo: nil, timeout: nil, &block)
192
+ wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
193
+ end
194
+
164
195
  # -- inherited from EventEmitter --
165
196
  # @nodoc
166
197
  def once(event, callback)
@@ -13,12 +13,32 @@ module Playwright
13
13
  # page.on('dialog', async dialog => {
14
14
  # console.log(dialog.message());
15
15
  # await dialog.dismiss();
16
- # await browser.close();
17
16
  # });
18
- # page.evaluate(() => alert('1'));
17
+ # await page.evaluate(() => alert('1'));
18
+ # await browser.close();
19
19
  # })();
20
20
  # ```
21
21
  #
22
+ # ```java
23
+ # import com.microsoft.playwright.*;
24
+ #
25
+ # public class Example {
26
+ # public static void main(String[] args) {
27
+ # try (Playwright playwright = Playwright.create()) {
28
+ # BrowserType chromium = playwright.chromium();
29
+ # Browser browser = chromium.launch();
30
+ # Page page = browser.newPage();
31
+ # page.onDialog(dialog -> {
32
+ # System.out.println(dialog.message());
33
+ # dialog.dismiss();
34
+ # });
35
+ # page.evaluate("alert('1')");
36
+ # browser.close();
37
+ # }
38
+ # }
39
+ # }
40
+ # ```
41
+ #
22
42
  # ```python async
23
43
  # import asyncio
24
44
  # from playwright.async_api import async_playwright
@@ -68,27 +88,54 @@ module Playwright
68
88
 
69
89
  # Returns when the dialog has been accepted.
70
90
  def accept(promptText: nil)
71
- raise NotImplementedError.new('accept is not implemented yet.')
91
+ wrap_impl(@impl.accept(promptText: unwrap_impl(promptText)))
72
92
  end
73
93
 
74
94
  # If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
75
95
  def default_value
76
- raise NotImplementedError.new('default_value is not implemented yet.')
96
+ wrap_impl(@impl.default_value)
77
97
  end
78
98
 
79
99
  # Returns when the dialog has been dismissed.
80
100
  def dismiss
81
- raise NotImplementedError.new('dismiss is not implemented yet.')
101
+ wrap_impl(@impl.dismiss)
82
102
  end
83
103
 
84
104
  # A message displayed in the dialog.
85
105
  def message
86
- raise NotImplementedError.new('message is not implemented yet.')
106
+ wrap_impl(@impl.message)
87
107
  end
88
108
 
89
109
  # Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.
90
110
  def type
91
- raise NotImplementedError.new('type is not implemented yet.')
111
+ wrap_impl(@impl.type)
112
+ end
113
+
114
+ # @nodoc
115
+ def accept_async(promptText: nil)
116
+ wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
117
+ end
118
+
119
+ # -- inherited from EventEmitter --
120
+ # @nodoc
121
+ def once(event, callback)
122
+ event_emitter_proxy.once(event, callback)
123
+ end
124
+
125
+ # -- inherited from EventEmitter --
126
+ # @nodoc
127
+ def on(event, callback)
128
+ event_emitter_proxy.on(event, callback)
129
+ end
130
+
131
+ # -- inherited from EventEmitter --
132
+ # @nodoc
133
+ def off(event, callback)
134
+ event_emitter_proxy.off(event, callback)
135
+ end
136
+
137
+ private def event_emitter_proxy
138
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
92
139
  end
93
140
  end
94
141
  end
@@ -20,6 +20,24 @@ module Playwright
20
20
  # })();
21
21
  # ```
22
22
  #
23
+ # ```java
24
+ # import com.microsoft.playwright.*;
25
+ #
26
+ # public class Example {
27
+ # public static void main(String[] args) {
28
+ # try (Playwright playwright = Playwright.create()) {
29
+ # BrowserType chromium = playwright.chromium();
30
+ # Browser browser = chromium.launch();
31
+ # Page page = browser.newPage();
32
+ # page.navigate("https://example.com");
33
+ # ElementHandle hrefElement = page.querySelector("a");
34
+ # hrefElement.click();
35
+ # // ...
36
+ # }
37
+ # }
38
+ # }
39
+ # ```
40
+ #
23
41
  # ```python async
24
42
  # import asyncio
25
43
  # from playwright.async_api import async_playwright
@@ -81,6 +99,11 @@ module Playwright
81
99
  # await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
82
100
  # ```
83
101
  #
102
+ # ```java
103
+ # BoundingBox box = elementHandle.boundingBox();
104
+ # page.mouse().click(box.x + box.width / 2, box.y + box.height / 2);
105
+ # ```
106
+ #
84
107
  # ```python async
85
108
  # box = await element_handle.bounding_box()
86
109
  # await page.mouse.click(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2)
@@ -95,20 +118,20 @@ module Playwright
95
118
  end
96
119
 
97
120
  # This method checks the element by performing the following steps:
98
- # 1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already
99
- # checked, this method returns immediately.
121
+ # 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked,
122
+ # this method returns immediately.
100
123
  # 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
101
124
  # 1. Scroll the element into view if needed.
102
125
  # 1. Use [`property: Page.mouse`] to click in the center of the element.
103
126
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
104
- # 1. Ensure that the element is now checked. If not, this method rejects.
127
+ # 1. Ensure that the element is now checked. If not, this method throws.
105
128
  #
106
- # If the element is detached from the DOM at any moment during the action, this method rejects.
129
+ # If the element is detached from the DOM at any moment during the action, this method throws.
107
130
  #
108
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
109
- # Passing zero timeout disables this.
110
- def check(force: nil, noWaitAfter: nil, timeout: nil)
111
- wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
131
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
132
+ # zero timeout disables this.
133
+ def check(force: nil, noWaitAfter: nil, position: nil, timeout: nil)
134
+ wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
112
135
  end
113
136
 
114
137
  # This method clicks the element by performing the following steps:
@@ -117,10 +140,10 @@ module Playwright
117
140
  # 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
118
141
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
119
142
  #
120
- # If the element is detached from the DOM at any moment during the action, this method rejects.
143
+ # If the element is detached from the DOM at any moment during the action, this method throws.
121
144
  #
122
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
123
- # Passing zero timeout disables this.
145
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
146
+ # zero timeout disables this.
124
147
  def click(
125
148
  button: nil,
126
149
  clickCount: nil,
@@ -143,12 +166,12 @@ module Playwright
143
166
  # 1. Scroll the element into view if needed.
144
167
  # 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
145
168
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
146
- # first click of the `dblclick()` triggers a navigation event, this method will reject.
169
+ # first click of the `dblclick()` triggers a navigation event, this method will throw.
147
170
  #
148
- # If the element is detached from the DOM at any moment during the action, this method rejects.
171
+ # If the element is detached from the DOM at any moment during the action, this method throws.
149
172
  #
150
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
151
- # Passing zero timeout disables this.
173
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
174
+ # zero timeout disables this.
152
175
  #
153
176
  # > NOTE: `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.
154
177
  def dblclick(
@@ -162,8 +185,8 @@ module Playwright
162
185
  wrap_impl(@impl.dblclick(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)))
163
186
  end
164
187
 
165
- # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click`
166
- # is dispatched. This is equivalend to calling
188
+ # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
189
+ # `click` is dispatched. This is equivalent to calling
167
190
  # [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
168
191
  #
169
192
  #
@@ -171,6 +194,10 @@ module Playwright
171
194
  # await elementHandle.dispatchEvent('click');
172
195
  # ```
173
196
  #
197
+ # ```java
198
+ # elementHandle.dispatchEvent("click");
199
+ # ```
200
+ #
174
201
  # ```python async
175
202
  # await element_handle.dispatch_event("click")
176
203
  # ```
@@ -200,6 +227,14 @@ module Playwright
200
227
  # await elementHandle.dispatchEvent('dragstart', { dataTransfer });
201
228
  # ```
202
229
  #
230
+ # ```java
231
+ # // Note you can only create DataTransfer in Chromium and Firefox
232
+ # JSHandle dataTransfer = page.evaluateHandle("() => new DataTransfer()");
233
+ # Map<String, Object> arg = new HashMap<>();
234
+ # arg.put("dataTransfer", dataTransfer);
235
+ # elementHandle.dispatchEvent("dragstart", arg);
236
+ # ```
237
+ #
203
238
  # ```python async
204
239
  # # note you can only create data_transfer in chromium and firefox
205
240
  # data_transfer = await page.evaluate_handle("new DataTransfer()")
@@ -233,6 +268,12 @@ module Playwright
233
268
  # expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
234
269
  # ```
235
270
  #
271
+ # ```java
272
+ # ElementHandle tweetHandle = page.querySelector(".tweet");
273
+ # assertEquals("100", tweetHandle.evalOnSelector(".like", "node => node.innerText"));
274
+ # assertEquals("10", tweetHandle.evalOnSelector(".retweets", "node => node.innerText"));
275
+ # ```
276
+ #
236
277
  # ```python async
237
278
  # tweet_handle = await page.query_selector(".tweet")
238
279
  # assert await tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
@@ -271,6 +312,11 @@ module Playwright
271
312
  # expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);
272
313
  # ```
273
314
  #
315
+ # ```java
316
+ # ElementHandle feedHandle = page.querySelector(".feed");
317
+ # assertEquals(Arrays.asList("Hello!", "Hi!"), feedHandle.evalOnSelectorAll(".tweet", "nodes => nodes.map(n => n.innerText)"));
318
+ # ```
319
+ #
274
320
  # ```python async
275
321
  # feed_handle = await page.query_selector(".feed")
276
322
  # assert await feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
@@ -310,10 +356,10 @@ module Playwright
310
356
  # 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
311
357
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
312
358
  #
313
- # If the element is detached from the DOM at any moment during the action, this method rejects.
359
+ # If the element is detached from the DOM at any moment during the action, this method throws.
314
360
  #
315
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
316
- # Passing zero timeout disables this.
361
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
362
+ # zero timeout disables this.
317
363
  def hover(force: nil, modifiers: nil, position: nil, timeout: nil)
318
364
  wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
319
365
  end
@@ -379,7 +425,7 @@ module Playwright
379
425
  # If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
380
426
  # texts.
381
427
  #
382
- # Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the
428
+ # Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
383
429
  # modifier, modifier is pressed and being held while the subsequent key is being pressed.
384
430
  def press(key, delay: nil, noWaitAfter: nil, timeout: nil)
385
431
  wrap_impl(@impl.press(unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
@@ -439,6 +485,15 @@ module Playwright
439
485
  # handle.selectOption(['red', 'green', 'blue']);
440
486
  # ```
441
487
  #
488
+ # ```java
489
+ # // single selection matching the value
490
+ # handle.selectOption("blue");
491
+ # // single selection matching the label
492
+ # handle.selectOption(new SelectOption().setLabel("Blue"));
493
+ # // multiple selection
494
+ # handle.selectOption(new String[] {"red", "green", "blue"});
495
+ # ```
496
+ #
442
497
  # ```python async
443
498
  # # single selection matching the value
444
499
  # await handle.select_option("blue")
@@ -499,10 +554,10 @@ module Playwright
499
554
  # 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
500
555
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
501
556
  #
502
- # If the element is detached from the DOM at any moment during the action, this method rejects.
557
+ # If the element is detached from the DOM at any moment during the action, this method throws.
503
558
  #
504
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
505
- # Passing zero timeout disables this.
559
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
560
+ # zero timeout disables this.
506
561
  #
507
562
  # > NOTE: `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.
508
563
  def tap_point(
@@ -529,6 +584,11 @@ module Playwright
529
584
  # await elementHandle.type('World', {delay: 100}); // Types slower, like a user
530
585
  # ```
531
586
  #
587
+ # ```java
588
+ # elementHandle.type("Hello"); // Types instantly
589
+ # elementHandle.type("World", new ElementHandle.TypeOptions().setDelay(100)); // Types slower, like a user
590
+ # ```
591
+ #
532
592
  # ```python async
533
593
  # await element_handle.type("hello") # types instantly
534
594
  # await element_handle.type("world", delay=100) # types slower, like a user
@@ -548,6 +608,12 @@ module Playwright
548
608
  # await elementHandle.press('Enter');
549
609
  # ```
550
610
  #
611
+ # ```java
612
+ # ElementHandle elementHandle = page.querySelector("input");
613
+ # elementHandle.type("some text");
614
+ # elementHandle.press("Enter");
615
+ # ```
616
+ #
551
617
  # ```python async
552
618
  # element_handle = await page.query_selector("input")
553
619
  # await element_handle.type("some text")
@@ -564,20 +630,20 @@ module Playwright
564
630
  end
565
631
 
566
632
  # This method checks the element by performing the following steps:
567
- # 1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already
633
+ # 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
568
634
  # unchecked, this method returns immediately.
569
635
  # 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
570
636
  # 1. Scroll the element into view if needed.
571
637
  # 1. Use [`property: Page.mouse`] to click in the center of the element.
572
638
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
573
- # 1. Ensure that the element is now unchecked. If not, this method rejects.
639
+ # 1. Ensure that the element is now unchecked. If not, this method throws.
574
640
  #
575
- # If the element is detached from the DOM at any moment during the action, this method rejects.
641
+ # If the element is detached from the DOM at any moment during the action, this method throws.
576
642
  #
577
- # When all steps combined have not finished during the specified `timeout`, this method rejects with a `TimeoutError`.
578
- # Passing zero timeout disables this.
579
- def uncheck(force: nil, noWaitAfter: nil, timeout: nil)
580
- wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
643
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
644
+ # zero timeout disables this.
645
+ def uncheck(force: nil, noWaitAfter: nil, position: nil, timeout: nil)
646
+ wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
581
647
  end
582
648
 
583
649
  # Returns when the element satisfies the `state`.
@@ -614,6 +680,14 @@ module Playwright
614
680
  # const span = await div.waitForSelector('span', { state: 'attached' });
615
681
  # ```
616
682
  #
683
+ # ```java
684
+ # page.setContent("<div><span></span></div>");
685
+ # ElementHandle div = page.querySelector("div");
686
+ # // Waiting for the "span" selector relative to the div.
687
+ # ElementHandle span = div.waitForSelector("span", new ElementHandle.WaitForSelectorOptions()
688
+ # .setState(WaitForSelectorState.ATTACHED));
689
+ # ```
690
+ #
617
691
  # ```python async
618
692
  # await page.set_content("<div><span></span></div>")
619
693
  # div = await page.query_selector("div")