playwright-ruby-client 0.5.9 → 0.6.3

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/documentation/README.md +33 -0
  4. data/documentation/babel.config.js +3 -0
  5. data/documentation/docs/api/accessibility.md +7 -0
  6. data/documentation/docs/api/browser.md +187 -0
  7. data/documentation/docs/api/browser_context.md +397 -0
  8. data/documentation/docs/api/browser_type.md +105 -0
  9. data/documentation/docs/api/cdp_session.md +7 -0
  10. data/documentation/docs/api/console_message.md +41 -0
  11. data/documentation/docs/api/dialog.md +71 -0
  12. data/documentation/docs/api/element_handle.md +618 -0
  13. data/documentation/docs/api/experimental/_category_.yml +3 -0
  14. data/documentation/docs/api/experimental/android.md +25 -0
  15. data/documentation/docs/api/experimental/android_device.md +92 -0
  16. data/documentation/docs/api/experimental/android_input.md +38 -0
  17. data/documentation/docs/api/experimental/android_socket.md +7 -0
  18. data/documentation/docs/api/experimental/android_web_view.md +7 -0
  19. data/documentation/docs/api/file_chooser.md +50 -0
  20. data/documentation/docs/api/frame.md +866 -0
  21. data/documentation/docs/api/js_handle.md +113 -0
  22. data/documentation/docs/api/keyboard.md +157 -0
  23. data/documentation/docs/api/mouse.md +69 -0
  24. data/documentation/docs/api/page.md +1402 -0
  25. data/documentation/docs/api/playwright.md +63 -0
  26. data/documentation/docs/api/request.md +188 -0
  27. data/documentation/docs/api/response.md +97 -0
  28. data/documentation/docs/api/route.md +80 -0
  29. data/documentation/docs/api/selectors.md +23 -0
  30. data/documentation/docs/api/touchscreen.md +8 -0
  31. data/documentation/docs/api/tracing.md +54 -0
  32. data/documentation/docs/api/web_socket.md +7 -0
  33. data/documentation/docs/api/worker.md +24 -0
  34. data/documentation/docs/article/api_coverage.mdx +11 -0
  35. data/documentation/docs/article/getting_started.md +152 -0
  36. data/documentation/docs/article/guides/_category_.yml +3 -0
  37. data/documentation/docs/article/guides/download_playwright_driver.md +49 -0
  38. data/documentation/docs/article/guides/launch_browser.md +119 -0
  39. data/documentation/docs/article/guides/rails_integration.md +162 -0
  40. data/{docs → documentation/docs/include}/api_coverage.md +12 -1
  41. data/documentation/docusaurus.config.js +107 -0
  42. data/documentation/package.json +39 -0
  43. data/documentation/sidebars.js +15 -0
  44. data/documentation/src/components/HomepageFeatures.js +61 -0
  45. data/documentation/src/components/HomepageFeatures.module.css +13 -0
  46. data/documentation/src/css/custom.css +44 -0
  47. data/documentation/src/pages/index.js +50 -0
  48. data/documentation/src/pages/index.module.css +41 -0
  49. data/documentation/src/pages/markdown-page.md +7 -0
  50. data/documentation/static/.nojekyll +0 -0
  51. data/documentation/static/img/playwright-logo.svg +9 -0
  52. data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
  53. data/documentation/static/img/undraw_web_development.svg +1 -0
  54. data/documentation/static/img/undraw_windows.svg +1 -0
  55. data/documentation/yarn.lock +8805 -0
  56. data/lib/playwright/channel_owners/binding_call.rb +33 -0
  57. data/lib/playwright/channel_owners/browser.rb +11 -2
  58. data/lib/playwright/channel_owners/browser_context.rb +58 -6
  59. data/lib/playwright/channel_owners/browser_type.rb +8 -1
  60. data/lib/playwright/channel_owners/element_handle.rb +17 -16
  61. data/lib/playwright/channel_owners/frame.rb +24 -34
  62. data/lib/playwright/channel_owners/js_handle.rb +2 -10
  63. data/lib/playwright/channel_owners/page.rb +37 -52
  64. data/lib/playwright/channel_owners/worker.rb +4 -0
  65. data/lib/playwright/download.rb +3 -2
  66. data/lib/playwright/events.rb +4 -0
  67. data/lib/playwright/input_files.rb +0 -8
  68. data/lib/playwright/javascript.rb +0 -10
  69. data/lib/playwright/javascript/expression.rb +2 -7
  70. data/lib/playwright/playwright_api.rb +16 -1
  71. data/lib/playwright/tracing_impl.rb +31 -0
  72. data/lib/playwright/version.rb +2 -1
  73. data/lib/playwright_api/accessibility.rb +7 -88
  74. data/lib/playwright_api/android.rb +2 -59
  75. data/lib/playwright_api/android_device.rb +6 -5
  76. data/lib/playwright_api/browser.rb +13 -122
  77. data/lib/playwright_api/browser_context.rb +66 -433
  78. data/lib/playwright_api/browser_type.rb +28 -78
  79. data/lib/playwright_api/cdp_session.rb +2 -25
  80. data/lib/playwright_api/console_message.rb +2 -0
  81. data/lib/playwright_api/dialog.rb +5 -63
  82. data/lib/playwright_api/element_handle.rb +96 -294
  83. data/lib/playwright_api/file_chooser.rb +0 -21
  84. data/lib/playwright_api/frame.rb +98 -564
  85. data/lib/playwright_api/js_handle.rb +10 -67
  86. data/lib/playwright_api/keyboard.rb +22 -166
  87. data/lib/playwright_api/mouse.rb +1 -45
  88. data/lib/playwright_api/page.rb +223 -1224
  89. data/lib/playwright_api/playwright.rb +8 -93
  90. data/lib/playwright_api/request.rb +9 -87
  91. data/lib/playwright_api/response.rb +1 -1
  92. data/lib/playwright_api/route.rb +3 -80
  93. data/lib/playwright_api/selectors.rb +0 -66
  94. data/lib/playwright_api/tracing.rb +39 -0
  95. data/lib/playwright_api/web_socket.rb +1 -1
  96. data/lib/playwright_api/worker.rb +28 -42
  97. data/playwright.gemspec +2 -2
  98. metadata +60 -20
  99. data/lib/playwright/javascript/function.rb +0 -67
@@ -1,58 +1,10 @@
1
1
  module Playwright
2
2
  # BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a
3
3
  # typical example of using Playwright to drive automation:
4
- #
5
4
  #
6
- # ```js
7
- # const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
8
- #
9
- # (async () => {
10
- # const browser = await chromium.launch();
11
- # const page = await browser.newPage();
12
- # await page.goto('https://example.com');
13
- # // other actions...
14
- # await browser.close();
15
- # })();
16
- # ```
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
- #
35
- # ```python async
36
- # import asyncio
37
- # from playwright.async_api import async_playwright
38
- #
39
- # async def run(playwright):
40
- # chromium = playwright.chromium
41
- # browser = await chromium.launch()
42
- # page = await browser.new_page()
43
- # await page.goto("https://example.com")
44
- # # other actions...
45
- # await browser.close()
46
- #
47
- # async def main():
48
- # async with async_playwright() as playwright:
49
- # await run(playwright)
50
- # asyncio.run(main())
51
- # ```
52
- #
53
5
  # ```python sync
54
6
  # from playwright.sync_api import sync_playwright
55
- #
7
+ #
56
8
  # def run(playwright):
57
9
  # chromium = playwright.chromium
58
10
  # browser = chromium.launch()
@@ -60,46 +12,46 @@ module Playwright
60
12
  # page.goto("https://example.com")
61
13
  # # other actions...
62
14
  # browser.close()
63
- #
15
+ #
64
16
  # with sync_playwright() as playwright:
65
17
  # run(playwright)
66
18
  # ```
67
19
  class BrowserType < PlaywrightApi
68
20
 
21
+ # This methods attaches Playwright to an existing browser instance.
22
+ def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
23
+ raise NotImplementedError.new('connect is not implemented yet.')
24
+ end
25
+
26
+ # This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
27
+ #
28
+ # The default browser context is accessible via [`method: Browser.contexts`].
29
+ #
30
+ # > NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
31
+ def connect_over_cdp(
32
+ endpointURL,
33
+ headers: nil,
34
+ slowMo: nil,
35
+ timeout: nil,
36
+ &block)
37
+ wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
38
+ end
39
+
69
40
  # A path where Playwright expects to find a bundled browser executable.
70
41
  def executable_path
71
42
  wrap_impl(@impl.executable_path)
72
43
  end
73
44
 
74
45
  # Returns the browser instance.
75
- #
46
+ #
76
47
  # You can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:
77
- #
78
48
  #
79
- # ```js
80
- # const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.
81
- # ignoreDefaultArgs: ['--mute-audio']
82
- # });
83
- # ```
84
- #
85
- # ```java
86
- # // Or "firefox" or "webkit".
87
- # Browser browser = chromium.launch(new BrowserType.LaunchOptions()
88
- # .setIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
89
- # ```
90
- #
91
- # ```python async
92
- # browser = await playwright.chromium.launch( # or "firefox" or "webkit".
93
- # ignore_default_args=["--mute-audio"]
94
- # )
95
- # ```
96
- #
97
49
  # ```python sync
98
50
  # browser = playwright.chromium.launch( # or "firefox" or "webkit".
99
51
  # ignore_default_args=["--mute-audio"]
100
52
  # )
101
53
  # ```
102
- #
54
+ #
103
55
  # > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
104
56
  # best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use
105
57
  # `executablePath` option with extreme caution.
@@ -131,12 +83,13 @@ module Playwright
131
83
  proxy: nil,
132
84
  slowMo: nil,
133
85
  timeout: nil,
86
+ traceDir: nil,
134
87
  &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)))
88
+ 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), traceDir: unwrap_impl(traceDir), &wrap_block_call(block)))
136
89
  end
137
90
 
138
91
  # Returns the persistent browser context instance.
139
- #
92
+ #
140
93
  # Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this
141
94
  # context will automatically close the browser.
142
95
  def launch_persistent_context(
@@ -173,10 +126,12 @@ module Playwright
173
126
  record_har_path: nil,
174
127
  record_video_dir: nil,
175
128
  record_video_size: nil,
129
+ reducedMotion: nil,
176
130
  screen: nil,
177
131
  slowMo: nil,
178
132
  timeout: nil,
179
133
  timezoneId: nil,
134
+ traceDir: nil,
180
135
  userAgent: nil,
181
136
  viewport: nil)
182
137
  raise NotImplementedError.new('launch_persistent_context is not implemented yet.')
@@ -187,11 +142,6 @@ module Playwright
187
142
  wrap_impl(@impl.name)
188
143
  end
189
144
 
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
-
195
145
  # -- inherited from EventEmitter --
196
146
  # @nodoc
197
147
  def once(event, callback)
@@ -1,39 +1,16 @@
1
1
  module Playwright
2
2
  # - extends: [EventEmitter]
3
- #
3
+ #
4
4
  # The `CDPSession` instances are used to talk raw Chrome Devtools Protocol:
5
5
  # - protocol methods can be called with `session.send` method.
6
6
  # - protocol events can be subscribed to with `session.on` method.
7
- #
7
+ #
8
8
  # Useful links:
9
9
  # - Documentation on DevTools Protocol can be found here:
10
10
  # [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).
11
11
  # - Getting Started with DevTools Protocol:
12
12
  # https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md
13
- #
14
13
  #
15
- # ```js
16
- # const client = await page.context().newCDPSession(page);
17
- # await client.send('Animation.enable');
18
- # client.on('Animation.animationCreated', () => console.log('Animation created!'));
19
- # const response = await client.send('Animation.getPlaybackRate');
20
- # console.log('playback rate is ' + response.playbackRate);
21
- # await client.send('Animation.setPlaybackRate', {
22
- # playbackRate: response.playbackRate / 2
23
- # });
24
- # ```
25
- #
26
- # ```python async
27
- # client = await page.context().new_cdp_session(page)
28
- # await client.send("animation.enable")
29
- # client.on("animation.animation_created", lambda: print("animation created!"))
30
- # response = await client.send("animation.get_playback_rate")
31
- # print("playback rate is " + response["playback_rate"])
32
- # await client.send("animation.set_playback_rate", {
33
- # playback_rate: response["playback_rate"] / 2
34
- # })
35
- # ```
36
- #
37
14
  # ```python sync
38
15
  # client = page.context().new_cdp_session(page)
39
16
  # client.send("animation.enable")
@@ -2,6 +2,7 @@ module Playwright
2
2
  # `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.
3
3
  class ConsoleMessage < PlaywrightApi
4
4
 
5
+ # List of arguments passed to a `console` function call. See also [`event: Page.console`].
5
6
  def args
6
7
  wrap_impl(@impl.args)
7
8
  end
@@ -10,6 +11,7 @@ module Playwright
10
11
  wrap_impl(@impl.location)
11
12
  end
12
13
 
14
+ # The text of the console message.
13
15
  def text
14
16
  wrap_impl(@impl.text)
15
17
  end
@@ -1,73 +1,15 @@
1
1
  module Playwright
2
2
  # `Dialog` objects are dispatched by page via the [`event: Page.dialog`] event.
3
- #
3
+ #
4
4
  # An example of using `Dialog` class:
5
- #
6
5
  #
7
- # ```js
8
- # const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
9
- #
10
- # (async () => {
11
- # const browser = await chromium.launch();
12
- # const page = await browser.newPage();
13
- # page.on('dialog', async dialog => {
14
- # console.log(dialog.message());
15
- # await dialog.dismiss();
16
- # });
17
- # await page.evaluate(() => alert('1'));
18
- # await browser.close();
19
- # })();
20
- # ```
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
- #
42
- # ```python async
43
- # import asyncio
44
- # from playwright.async_api import async_playwright
45
- #
46
- # async def handle_dialog(dialog):
47
- # print(dialog.message)
48
- # await dialog.dismiss()
49
- #
50
- # async def run(playwright):
51
- # chromium = playwright.chromium
52
- # browser = await chromium.launch()
53
- # page = await browser.new_page()
54
- # page.on("dialog", handle_dialog)
55
- # page.evaluate("alert('1')")
56
- # await browser.close()
57
- #
58
- # async def main():
59
- # async with async_playwright() as playwright:
60
- # await run(playwright)
61
- # asyncio.run(main())
62
- # ```
63
- #
64
6
  # ```python sync
65
7
  # from playwright.sync_api import sync_playwright
66
- #
8
+ #
67
9
  # def handle_dialog(dialog):
68
10
  # print(dialog.message)
69
11
  # dialog.dismiss()
70
- #
12
+ #
71
13
  # def run(playwright):
72
14
  # chromium = playwright.chromium
73
15
  # browser = chromium.launch()
@@ -75,11 +17,11 @@ module Playwright
75
17
  # page.on("dialog", handle_dialog)
76
18
  # page.evaluate("alert('1')")
77
19
  # browser.close()
78
- #
20
+ #
79
21
  # with sync_playwright() as playwright:
80
22
  # run(playwright)
81
23
  # ```
82
- #
24
+ #
83
25
  # > NOTE: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener. When listener is
84
26
  # present, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will
85
27
  # [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and
@@ -2,64 +2,13 @@ require_relative './js_handle.rb'
2
2
 
3
3
  module Playwright
4
4
  # - extends: `JSHandle`
5
- #
5
+ #
6
6
  # ElementHandle represents an in-page DOM element. ElementHandles can be created with the [`method: Page.querySelector`]
7
7
  # method.
8
- #
9
8
  #
10
- # ```js
11
- # const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
12
- #
13
- # (async () => {
14
- # const browser = await chromium.launch();
15
- # const page = await browser.newPage();
16
- # await page.goto('https://example.com');
17
- # const hrefElement = await page.$('a');
18
- # await hrefElement.click();
19
- # // ...
20
- # })();
21
- # ```
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
- #
41
- # ```python async
42
- # import asyncio
43
- # from playwright.async_api import async_playwright
44
- #
45
- # async def run(playwright):
46
- # chromium = playwright.chromium
47
- # browser = await chromium.launch()
48
- # page = await browser.new_page()
49
- # await page.goto("https://example.com")
50
- # href_element = await page.query_selector("a")
51
- # await href_element.click()
52
- # # ...
53
- #
54
- # async def main():
55
- # async with async_playwright() as playwright:
56
- # await run(playwright)
57
- # asyncio.run(main())
58
- # ```
59
- #
60
9
  # ```python sync
61
10
  # from playwright.sync_api import sync_playwright
62
- #
11
+ #
63
12
  # def run(playwright):
64
13
  # chromium = playwright.chromium
65
14
  # browser = chromium.launch()
@@ -68,47 +17,31 @@ module Playwright
68
17
  # href_element = page.query_selector("a")
69
18
  # href_element.click()
70
19
  # # ...
71
- #
20
+ #
72
21
  # with sync_playwright() as playwright:
73
22
  # run(playwright)
74
23
  # ```
75
- #
24
+ #
76
25
  # ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
77
26
  # [`method: JSHandle.dispose`]. ElementHandles are auto-disposed when their origin frame gets navigated.
78
- #
27
+ #
79
28
  # ElementHandle instances can be used as an argument in [`method: Page.evalOnSelector`] and [`method: Page.evaluate`]
80
29
  # methods.
81
30
  class ElementHandle < JSHandle
82
31
 
83
32
  # This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
84
33
  # calculated relative to the main frame viewport - which is usually the same as the browser window.
85
- #
34
+ #
86
35
  # Scrolling affects the returned bonding box, similarly to
87
36
  # [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
88
37
  # means `x` and/or `y` may be negative.
89
- #
38
+ #
90
39
  # Elements from child frames return the bounding box relative to the main frame, unlike the
91
40
  # [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
92
- #
41
+ #
93
42
  # Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following
94
43
  # snippet should click the center of the element.
95
- #
96
44
  #
97
- # ```js
98
- # const box = await elementHandle.boundingBox();
99
- # await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
100
- # ```
101
- #
102
- # ```java
103
- # BoundingBox box = elementHandle.boundingBox();
104
- # page.mouse().click(box.x + box.width / 2, box.y + box.height / 2);
105
- # ```
106
- #
107
- # ```python async
108
- # box = await element_handle.bounding_box()
109
- # await page.mouse.click(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2)
110
- # ```
111
- #
112
45
  # ```python sync
113
46
  # box = element_handle.bounding_box()
114
47
  # page.mouse.click(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2)
@@ -125,13 +58,18 @@ module Playwright
125
58
  # 1. Use [`property: Page.mouse`] to click in the center of the element.
126
59
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
127
60
  # 1. Ensure that the element is now checked. If not, this method throws.
128
- #
61
+ #
129
62
  # If the element is detached from the DOM at any moment during the action, this method throws.
130
- #
63
+ #
131
64
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
132
65
  # 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)))
66
+ def check(
67
+ force: nil,
68
+ noWaitAfter: nil,
69
+ position: nil,
70
+ timeout: nil,
71
+ trial: nil)
72
+ wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
135
73
  end
136
74
 
137
75
  # This method clicks the element by performing the following steps:
@@ -139,9 +77,9 @@ module Playwright
139
77
  # 1. Scroll the element into view if needed.
140
78
  # 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
141
79
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
142
- #
80
+ #
143
81
  # If the element is detached from the DOM at any moment during the action, this method throws.
144
- #
82
+ #
145
83
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
146
84
  # zero timeout disables this.
147
85
  def click(
@@ -152,8 +90,9 @@ module Playwright
152
90
  modifiers: nil,
153
91
  noWaitAfter: nil,
154
92
  position: nil,
155
- timeout: nil)
156
- wrap_impl(@impl.click(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)))
93
+ timeout: nil,
94
+ trial: nil)
95
+ wrap_impl(@impl.click(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)))
157
96
  end
158
97
 
159
98
  # Returns the content frame for element handles referencing iframe nodes, or `null` otherwise
@@ -167,12 +106,12 @@ module Playwright
167
106
  # 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
168
107
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
169
108
  # first click of the `dblclick()` triggers a navigation event, this method will throw.
170
- #
109
+ #
171
110
  # If the element is detached from the DOM at any moment during the action, this method throws.
172
- #
111
+ #
173
112
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
174
113
  # zero timeout disables this.
175
- #
114
+ #
176
115
  # > NOTE: `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.
177
116
  def dblclick(
178
117
  button: nil,
@@ -181,34 +120,22 @@ module Playwright
181
120
  modifiers: nil,
182
121
  noWaitAfter: nil,
183
122
  position: nil,
184
- timeout: nil)
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)))
123
+ timeout: nil,
124
+ trial: nil)
125
+ 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), trial: unwrap_impl(trial)))
186
126
  end
187
127
 
188
128
  # The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
189
129
  # `click` is dispatched. This is equivalent to calling
190
130
  # [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
191
- #
192
131
  #
193
- # ```js
194
- # await elementHandle.dispatchEvent('click');
195
- # ```
196
- #
197
- # ```java
198
- # elementHandle.dispatchEvent("click");
199
- # ```
200
- #
201
- # ```python async
202
- # await element_handle.dispatch_event("click")
203
- # ```
204
- #
205
132
  # ```python sync
206
133
  # element_handle.dispatch_event("click")
207
134
  # ```
208
- #
135
+ #
209
136
  # Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties
210
137
  # and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.
211
- #
138
+ #
212
139
  # Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:
213
140
  # - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
214
141
  # - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
@@ -217,30 +144,9 @@ module Playwright
217
144
  # - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
218
145
  # - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
219
146
  # - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
220
- #
147
+ #
221
148
  # You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
222
- #
223
149
  #
224
- # ```js
225
- # // Note you can only create DataTransfer in Chromium and Firefox
226
- # const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
227
- # await elementHandle.dispatchEvent('dragstart', { dataTransfer });
228
- # ```
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
- #
238
- # ```python async
239
- # # note you can only create data_transfer in chromium and firefox
240
- # data_transfer = await page.evaluate_handle("new DataTransfer()")
241
- # await element_handle.dispatch_event("#source", "dragstart", {"dataTransfer": data_transfer})
242
- # ```
243
- #
244
150
  # ```python sync
245
151
  # # note you can only create data_transfer in chromium and firefox
246
152
  # data_transfer = page.evaluate_handle("new DataTransfer()")
@@ -251,35 +157,16 @@ module Playwright
251
157
  end
252
158
 
253
159
  # Returns the return value of `expression`.
254
- #
160
+ #
255
161
  # The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first
256
162
  # argument to `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the
257
163
  # selector, the method throws an error.
258
- #
164
+ #
259
165
  # If `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelector`] would wait for the promise to resolve
260
166
  # and return its value.
261
- #
167
+ #
262
168
  # Examples:
263
- #
264
169
  #
265
- # ```js
266
- # const tweetHandle = await page.$('.tweet');
267
- # expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');
268
- # expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
269
- # ```
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
- #
277
- # ```python async
278
- # tweet_handle = await page.query_selector(".tweet")
279
- # assert await tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
280
- # assert await tweet_handle.eval_on_selector(".retweets", "node => node.innerText") = "10"
281
- # ```
282
- #
283
170
  # ```python sync
284
171
  # tweet_handle = page.query_selector(".tweet")
285
172
  # assert tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
@@ -290,38 +177,22 @@ module Playwright
290
177
  end
291
178
 
292
179
  # Returns the return value of `expression`.
293
- #
180
+ #
294
181
  # The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of
295
182
  # matched elements as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details.
296
- #
183
+ #
297
184
  # If `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelectorAll`] would wait for the promise to
298
185
  # resolve and return its value.
299
- #
186
+ #
300
187
  # Examples:
301
- #
188
+ #
302
189
  # ```html
303
190
  # <div class="feed">
304
191
  # <div class="tweet">Hello!</div>
305
192
  # <div class="tweet">Hi!</div>
306
193
  # </div>
307
194
  # ```
308
- #
309
195
  #
310
- # ```js
311
- # const feedHandle = await page.$('.feed');
312
- # expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);
313
- # ```
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
- #
320
- # ```python async
321
- # feed_handle = await page.query_selector(".feed")
322
- # assert await feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
323
- # ```
324
- #
325
196
  # ```python sync
326
197
  # feed_handle = page.query_selector(".feed")
327
198
  # assert feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
@@ -331,10 +202,14 @@ module Playwright
331
202
  end
332
203
 
333
204
  # This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input`
334
- # event after filling. If the element is inside the `<label>` element that has associated
335
- # [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), that control will be filled
336
- # instead. If the element to be filled is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method
337
- # throws an error. Note that you can pass an empty string to clear the input field.
205
+ # event after filling. Note that you can pass an empty string to clear the input field.
206
+ #
207
+ # If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
208
+ # However, if the element is inside the `<label>` element that has an associated
209
+ # [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
210
+ # instead.
211
+ #
212
+ # To send fine-grained keyboard events, use [`method: ElementHandle.type`].
338
213
  def fill(value, noWaitAfter: nil, timeout: nil)
339
214
  wrap_impl(@impl.fill(unwrap_impl(value), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
340
215
  end
@@ -355,13 +230,18 @@ module Playwright
355
230
  # 1. Scroll the element into view if needed.
356
231
  # 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
357
232
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
358
- #
233
+ #
359
234
  # If the element is detached from the DOM at any moment during the action, this method throws.
360
- #
235
+ #
361
236
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
362
237
  # zero timeout disables this.
363
- def hover(force: nil, modifiers: nil, position: nil, timeout: nil)
364
- wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
238
+ def hover(
239
+ force: nil,
240
+ modifiers: nil,
241
+ position: nil,
242
+ timeout: nil,
243
+ trial: nil)
244
+ wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
365
245
  end
366
246
 
367
247
  # Returns the `element.innerHTML`.
@@ -410,21 +290,21 @@ module Playwright
410
290
  end
411
291
 
412
292
  # Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
413
- #
293
+ #
414
294
  # `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
415
295
  # value or a single character to generate the text for. A superset of the `key` values can be found
416
296
  # [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
417
- #
297
+ #
418
298
  # `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
419
299
  # `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
420
- #
300
+ #
421
301
  # Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
422
- #
302
+ #
423
303
  # Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
424
- #
304
+ #
425
305
  # If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
426
306
  # texts.
427
- #
307
+ #
428
308
  # Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
429
309
  # modifier, modifier is pressed and being held while the subsequent key is being pressed.
430
310
  def press(key, delay: nil, noWaitAfter: nil, timeout: nil)
@@ -444,7 +324,7 @@ module Playwright
444
324
  end
445
325
 
446
326
  # Returns the buffer with the captured screenshot.
447
- #
327
+ #
448
328
  # This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
449
329
  # screenshot. If the element is detached from DOM, the method throws an error.
450
330
  def screenshot(
@@ -459,50 +339,24 @@ module Playwright
459
339
  # This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is
460
340
  # completely visible as defined by
461
341
  # [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
462
- #
342
+ #
463
343
  # Throws when `elementHandle` does not point to an element
464
344
  # [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
465
345
  def scroll_into_view_if_needed(timeout: nil)
466
346
  wrap_impl(@impl.scroll_into_view_if_needed(timeout: unwrap_impl(timeout)))
467
347
  end
468
348
 
349
+ # This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the
350
+ # `<select>` element and selects these options.
351
+ #
352
+ # If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
353
+ # `<label>` element that has an associated
354
+ # [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
355
+ #
469
356
  # Returns the array of option values that have been successfully selected.
470
- #
471
- # Triggers a `change` and `input` event once all the provided options have been selected. If element is not a `<select>`
472
- # element, the method throws an error.
473
- #
474
- # Will wait until all specified options are present in the `<select>` element.
475
- #
476
- #
477
- # ```js
478
- # // single selection matching the value
479
- # handle.selectOption('blue');
480
- #
481
- # // single selection matching the label
482
- # handle.selectOption({ label: 'Blue' });
483
- #
484
- # // multiple selection
485
- # handle.selectOption(['red', 'green', 'blue']);
486
- # ```
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
- #
497
- # ```python async
498
- # # single selection matching the value
499
- # await handle.select_option("blue")
500
- # # single selection matching the label
501
- # await handle.select_option(label="blue")
502
- # # multiple selection
503
- # await handle.select_option(value=["red", "green", "blue"])
504
- # ```
505
- #
357
+ #
358
+ # Triggers a `change` and `input` event once all the provided options have been selected.
359
+ #
506
360
  # ```python sync
507
361
  # # single selection matching the value
508
362
  # handle.select_option("blue")
@@ -511,7 +365,7 @@ module Playwright
511
365
  # # multiple selection
512
366
  # handle.select_option(value=["red", "green", "blue"])
513
367
  # ```
514
- #
368
+ #
515
369
  # ```python sync
516
370
  # # single selection matching the value
517
371
  # handle.select_option("blue")
@@ -540,7 +394,7 @@ module Playwright
540
394
 
541
395
  # This method expects `elementHandle` to point to an
542
396
  # [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
543
- #
397
+ #
544
398
  # Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
545
399
  # are resolved relative to the the current working directory. For empty array, clears the selected files.
546
400
  def set_input_files(files, noWaitAfter: nil, timeout: nil)
@@ -553,20 +407,21 @@ module Playwright
553
407
  # 1. Scroll the element into view if needed.
554
408
  # 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
555
409
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
556
- #
410
+ #
557
411
  # If the element is detached from the DOM at any moment during the action, this method throws.
558
- #
412
+ #
559
413
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
560
414
  # zero timeout disables this.
561
- #
415
+ #
562
416
  # > NOTE: `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.
563
417
  def tap_point(
564
418
  force: nil,
565
419
  modifiers: nil,
566
420
  noWaitAfter: nil,
567
421
  position: nil,
568
- timeout: nil)
569
- wrap_impl(@impl.tap_point(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout)))
422
+ timeout: nil,
423
+ trial: nil)
424
+ wrap_impl(@impl.tap_point(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
570
425
  end
571
426
 
572
427
  # Returns the `node.textContent`.
@@ -575,51 +430,16 @@ module Playwright
575
430
  end
576
431
 
577
432
  # Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
578
- #
433
+ #
579
434
  # To press a special key, like `Control` or `ArrowDown`, use [`method: ElementHandle.press`].
580
- #
581
435
  #
582
- # ```js
583
- # await elementHandle.type('Hello'); // Types instantly
584
- # await elementHandle.type('World', {delay: 100}); // Types slower, like a user
585
- # ```
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
- #
592
- # ```python async
593
- # await element_handle.type("hello") # types instantly
594
- # await element_handle.type("world", delay=100) # types slower, like a user
595
- # ```
596
- #
597
436
  # ```python sync
598
437
  # element_handle.type("hello") # types instantly
599
438
  # element_handle.type("world", delay=100) # types slower, like a user
600
439
  # ```
601
- #
440
+ #
602
441
  # An example of typing into a text field and then submitting the form:
603
- #
604
442
  #
605
- # ```js
606
- # const elementHandle = await page.$('input');
607
- # await elementHandle.type('some text');
608
- # await elementHandle.press('Enter');
609
- # ```
610
- #
611
- # ```java
612
- # ElementHandle elementHandle = page.querySelector("input");
613
- # elementHandle.type("some text");
614
- # elementHandle.press("Enter");
615
- # ```
616
- #
617
- # ```python async
618
- # element_handle = await page.query_selector("input")
619
- # await element_handle.type("some text")
620
- # await element_handle.press("Enter")
621
- # ```
622
- #
623
443
  # ```python sync
624
444
  # element_handle = page.query_selector("input")
625
445
  # element_handle.type("some text")
@@ -637,17 +457,22 @@ module Playwright
637
457
  # 1. Use [`property: Page.mouse`] to click in the center of the element.
638
458
  # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
639
459
  # 1. Ensure that the element is now unchecked. If not, this method throws.
640
- #
460
+ #
641
461
  # If the element is detached from the DOM at any moment during the action, this method throws.
642
- #
462
+ #
643
463
  # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
644
464
  # 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)))
465
+ def uncheck(
466
+ force: nil,
467
+ noWaitAfter: nil,
468
+ position: nil,
469
+ timeout: nil,
470
+ trial: nil)
471
+ wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
647
472
  end
648
473
 
649
474
  # Returns when the element satisfies the `state`.
650
- #
475
+ #
651
476
  # Depending on the `state` parameter, this method waits for one of the [actionability](./actionability.md) checks to pass.
652
477
  # This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
653
478
  # - `"visible"` Wait until the element is [visible](./actionability.md#visible).
@@ -658,7 +483,7 @@ module Playwright
658
483
  # - `"enabled"` Wait until the element is [enabled](./actionability.md#enabled).
659
484
  # - `"disabled"` Wait until the element is [not enabled](./actionability.md#enabled).
660
485
  # - `"editable"` Wait until the element is [editable](./actionability.md#editable).
661
- #
486
+ #
662
487
  # If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.
663
488
  def wait_for_element_state(state, timeout: nil)
664
489
  wrap_impl(@impl.wait_for_element_state(unwrap_impl(state), timeout: unwrap_impl(timeout)))
@@ -666,42 +491,19 @@ module Playwright
666
491
 
667
492
  # Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
668
493
  # `detached`.
669
- #
494
+ #
670
495
  # Wait for the `selector` relative to the element handle to satisfy `state` option (either appear/disappear from dom, or
671
496
  # become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method
672
497
  # will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will
673
498
  # throw.
674
- #
675
499
  #
676
- # ```js
677
- # await page.setContent(`<div><span></span></div>`);
678
- # const div = await page.$('div');
679
- # // Waiting for the 'span' selector relative to the div.
680
- # const span = await div.waitForSelector('span', { state: 'attached' });
681
- # ```
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
- #
691
- # ```python async
692
- # await page.set_content("<div><span></span></div>")
693
- # div = await page.query_selector("div")
694
- # # waiting for the "span" selector relative to the div.
695
- # span = await div.wait_for_selector("span", state="attached")
696
- # ```
697
- #
698
500
  # ```python sync
699
501
  # page.set_content("<div><span></span></div>")
700
502
  # div = page.query_selector("div")
701
503
  # # waiting for the "span" selector relative to the div.
702
504
  # span = div.wait_for_selector("span", state="attached")
703
505
  # ```
704
- #
506
+ #
705
507
  # > NOTE: This method does not work across navigations, use [`method: Page.waitForSelector`] instead.
706
508
  def wait_for_selector(selector, state: nil, timeout: nil)
707
509
  wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))