playwright-ruby-client 1.39.0 → 1.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request_context.md +1 -2
  3. data/documentation/docs/api/browser.md +10 -14
  4. data/documentation/docs/api/browser_context.md +32 -51
  5. data/documentation/docs/api/browser_type.md +8 -12
  6. data/documentation/docs/api/dialog.md +15 -18
  7. data/documentation/docs/api/download.md +10 -12
  8. data/documentation/docs/api/element_handle.md +9 -7
  9. data/documentation/docs/api/frame.md +28 -55
  10. data/documentation/docs/api/locator.md +24 -23
  11. data/documentation/docs/api/locator_assertions.md +652 -0
  12. data/documentation/docs/api/page.md +53 -103
  13. data/documentation/docs/api/playwright.md +20 -23
  14. data/documentation/docs/api/selectors.md +29 -34
  15. data/documentation/docs/article/guides/rails_integration.md +80 -51
  16. data/documentation/docs/article/guides/rspec_integration.md +59 -0
  17. data/documentation/docs/include/api_coverage.md +43 -0
  18. data/documentation/docusaurus.config.js +1 -1
  19. data/documentation/package.json +7 -7
  20. data/documentation/yarn.lock +4641 -5023
  21. data/lib/playwright/api_response_impl.rb +2 -2
  22. data/lib/playwright/channel.rb +1 -1
  23. data/lib/playwright/channel_owners/api_request_context.rb +12 -3
  24. data/lib/playwright/channel_owners/browser.rb +11 -7
  25. data/lib/playwright/channel_owners/browser_context.rb +35 -15
  26. data/lib/playwright/channel_owners/frame.rb +38 -14
  27. data/lib/playwright/channel_owners/page.rb +29 -16
  28. data/lib/playwright/channel_owners/web_socket.rb +8 -13
  29. data/lib/playwright/connection.rb +18 -2
  30. data/lib/playwright/errors.rb +22 -2
  31. data/lib/playwright/input_files.rb +4 -4
  32. data/lib/playwright/javascript/value_serializer.rb +1 -1
  33. data/lib/playwright/locator_assertions_impl.rb +417 -0
  34. data/lib/playwright/locator_impl.rb +24 -5
  35. data/lib/playwright/test.rb +68 -0
  36. data/lib/playwright/utils.rb +3 -10
  37. data/lib/playwright/version.rb +2 -2
  38. data/lib/playwright/waiter.rb +146 -0
  39. data/lib/playwright.rb +1 -1
  40. data/lib/playwright_api/api_request_context.rb +1 -2
  41. data/lib/playwright_api/browser.rb +2 -2
  42. data/lib/playwright_api/browser_context.rb +3 -3
  43. data/lib/playwright_api/browser_type.rb +2 -1
  44. data/lib/playwright_api/download.rb +1 -2
  45. data/lib/playwright_api/element_handle.rb +4 -1
  46. data/lib/playwright_api/frame.rb +4 -1
  47. data/lib/playwright_api/locator.rb +9 -1
  48. data/lib/playwright_api/locator_assertions.rb +561 -0
  49. data/lib/playwright_api/page.rb +16 -13
  50. data/lib/playwright_api/request.rb +4 -4
  51. data/lib/playwright_api/worker.rb +4 -4
  52. data/sig/playwright.rbs +48 -5
  53. metadata +9 -4
  54. data/lib/playwright/wait_helper.rb +0 -73
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0dedf5c9cce96afd64ad16c45baed1b2c1fe37bb9b2632a741d8b75640bf2ae
4
- data.tar.gz: 5f056dc5acd7bd5860c3ccaee1d7e5460923e9eb2a985c41ec1e36c8d8c91b7a
3
+ metadata.gz: 0d2ac0187f243c1e1f408f9b2733a4c9f8bd2ea24b95667127ad9e991ae09a61
4
+ data.tar.gz: cf860a1ea1f67bb33a13041eb5b87ea79035065a374e5f2c099d3f1207ef94a3
5
5
  SHA512:
6
- metadata.gz: 82629797b234ab08abe2c9258605d0d7826eeaf3f4f70274e3f1ced8a5b41560ee1832f7ae98522ce7dfe1a826bd5058c88e9aba7f6d507d16bfa20d20206cea
7
- data.tar.gz: '0027783e79287ba14021438154229a4de61c041c983a9f6fa582d533524df395bfb9cfaedbabf9e3d6be015a2ebed9a1fa03674bd86965f693bbd12bae9c67ce'
6
+ metadata.gz: 75db55fb24aea5a6a92ab54d2f50e62a7444b4438eb6a745d0ec8981d04984c6704ef403a3b86e659953fced1b729798d296d516947ee7c9dba12a1e742f572e
7
+ data.tar.gz: 2c5918e7878c96c5d1ed7ab728757a996006d1a4c47d96f8b2503051a18986da2cf766a91623b005368017a0841404ab938fe5540219f84e2905166d8a2f414c
@@ -85,8 +85,7 @@ def dispose
85
85
  ```
86
86
 
87
87
 
88
- All responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods are stored in the memory, so that you can later call [APIResponse#body](./api_response#body). This method
89
- discards all stored responses, and makes [APIResponse#body](./api_response#body) throw "Response disposed" error.
88
+ All responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods are stored in the memory, so that you can later call [APIResponse#body](./api_response#body).This method discards all its resources, calling any method on disposed [APIRequestContext](./api_request_context) will throw an exception.
90
89
 
91
90
  ## fetch
92
91
 
@@ -8,19 +8,15 @@ sidebar_position: 10
8
8
 
9
9
  A Browser is created via [BrowserType#launch](./browser_type#launch). An example of using a [Browser](./browser) to create a [Page](./page):
10
10
 
11
- ```python sync title=example_5d31815545511b1d8ce5dfce5b153cb5ea46a1868cee95eb211d77f33026788b.py
12
- from playwright.sync_api import sync_playwright, Playwright
13
-
14
- def run(playwright: Playwright):
15
- firefox = playwright.firefox
16
- browser = firefox.launch()
17
- page = browser.new_page()
18
- page.goto("https://example.com")
19
- browser.close()
20
-
21
- with sync_playwright() as playwright:
22
- run(playwright)
23
-
11
+ ```ruby
12
+ firefox = playwright.firefox
13
+ browser = firefox.launch
14
+ begin
15
+ page = browser.new_page
16
+ page.goto("https://example.com")
17
+ ensure
18
+ browser.close
19
+ end
24
20
  ```
25
21
 
26
22
  ## browser_type
@@ -35,7 +31,7 @@ Get the browser type (chromium, firefox or webkit) that the browser belongs to.
35
31
  ## close
36
32
 
37
33
  ```
38
- def close
34
+ def close(reason: nil)
39
35
  ```
40
36
 
41
37
 
@@ -120,7 +120,7 @@ context.clear_permissions
120
120
  ## close
121
121
 
122
122
  ```
123
- def close
123
+ def close(reason: nil)
124
124
  ```
125
125
 
126
126
 
@@ -158,29 +158,21 @@ See [Page#expose_binding](./page#expose_binding) for page-only version.
158
158
 
159
159
  An example of exposing page URL to all frames in all pages in the context:
160
160
 
161
- ```python sync title=example_a450852d36dda88564582371af8d87bb58b1a517aac4fa60b7a58a0e41c5ceff.py
162
- from playwright.sync_api import sync_playwright, Playwright
163
-
164
- def run(playwright: Playwright):
165
- webkit = playwright.webkit
166
- browser = webkit.launch(headless=false)
167
- context = browser.new_context()
168
- context.expose_binding("pageURL", lambda source: source["page"].url)
169
- page = context.new_page()
170
- page.set_content("""
171
- <script>
172
- async function onClick() {
173
- document.querySelector('div').textContent = await window.pageURL();
174
- }
175
- </script>
176
- <button onclick="onClick()">Click me</button>
177
- <div></div>
178
- """)
179
- page.get_by_role("button").click()
161
+ ```ruby
162
+ browser_context.expose_binding("pageURL", ->(source) { source[:page].url })
163
+ page = browser_context.new_page
180
164
 
181
- with sync_playwright() as playwright:
182
- run(playwright)
165
+ page.content = <<~HTML
166
+ <script>
167
+ async function onClick() {
168
+ document.querySelector('div').textContent = await window.pageURL();
169
+ }
170
+ </script>
171
+ <button onclick="onClick()">Click me</button>
172
+ <div></div>
173
+ HTML
183
174
 
175
+ page.get_by_role("button").click
184
176
  ```
185
177
 
186
178
  An example of passing an element handle:
@@ -225,36 +217,25 @@ See [Page#expose_function](./page#expose_function) for page-only version.
225
217
 
226
218
  An example of adding a `sha256` function to all pages in the context:
227
219
 
228
- ```python sync title=example_714719de9c92e66678257180301c2512f8cd69185f53a5121b6c52194f61a871.py
229
- import hashlib
230
- from playwright.sync_api import sync_playwright
231
-
232
- def sha256(text: str) -> str:
233
- m = hashlib.sha256()
234
- m.update(bytes(text, "utf8"))
235
- return m.hexdigest()
236
-
237
-
238
- def run(playwright: Playwright):
239
- webkit = playwright.webkit
240
- browser = webkit.launch(headless=False)
241
- context = browser.new_context()
242
- context.expose_function("sha256", sha256)
243
- page = context.new_page()
244
- page.set_content("""
245
- <script>
246
- async function onClick() {
247
- document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');
248
- }
249
- </script>
250
- <button onclick="onClick()">Click me</button>
251
- <div></div>
252
- """)
253
- page.get_by_role("button").click()
254
-
255
- with sync_playwright() as playwright:
256
- run(playwright)
220
+ ```ruby
221
+ require 'digest'
222
+
223
+ def sha256(text)
224
+ Digest::SHA256.hexdigest(text)
225
+ end
257
226
 
227
+ browser_context.expose_function("sha256", method(:sha256))
228
+ page = browser_context.new_page()
229
+ page.content = <<~HTML
230
+ <script>
231
+ async function onClick() {
232
+ document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');
233
+ }
234
+ </script>
235
+ <button onclick="onClick()">Click me</button>
236
+ <div></div>
237
+ HTML
238
+ page.get_by_role("button").click
258
239
  ```
259
240
 
260
241
  ## grant_permissions
@@ -8,20 +8,15 @@ sidebar_position: 10
8
8
  BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a
9
9
  typical example of using Playwright to drive automation:
10
10
 
11
- ```python sync title=example_2f9fbff87f35af4b76a27f54efeca3201696bbfa94ce03fee5a3df2639cc27d3.py
12
- from playwright.sync_api import sync_playwright, Playwright
13
-
14
- def run(playwright: Playwright):
15
- chromium = playwright.chromium
16
- browser = chromium.launch()
17
- page = browser.new_page()
18
- page.goto("https://example.com")
19
- # other actions...
20
- browser.close()
11
+ ```ruby
12
+ chromium = playwright.chromium
13
+ chromium.launch do |browser|
14
+ page = browser.new_page
15
+ page.goto('https://example.com/')
21
16
 
22
- with sync_playwright() as playwright:
23
- run(playwright)
17
+ # other actions
24
18
 
19
+ end
25
20
  ```
26
21
 
27
22
  ## connect_over_cdp
@@ -132,6 +127,7 @@ def launch_persistent_context(
132
127
  env: nil,
133
128
  executablePath: nil,
134
129
  extraHTTPHeaders: nil,
130
+ firefoxUserPrefs: nil,
135
131
  forcedColors: nil,
136
132
  geolocation: nil,
137
133
  handleSIGHUP: nil,
@@ -9,24 +9,21 @@ sidebar_position: 10
9
9
 
10
10
  An example of using [Dialog](./dialog) class:
11
11
 
12
- ```python sync title=example_a7dcc75b7aa5544237ac3a964e9196d0445308864d3ce820f8cb8396f687b04a.py
13
- from playwright.sync_api import sync_playwright, Playwright
14
-
15
- def handle_dialog(dialog):
16
- print(dialog.message)
17
- dialog.dismiss()
18
-
19
- def run(playwright: Playwright):
20
- chromium = playwright.chromium
21
- browser = chromium.launch()
22
- page = browser.new_page()
23
- page.on("dialog", handle_dialog)
24
- page.evaluate("alert('1')")
25
- browser.close()
26
-
27
- with sync_playwright() as playwright:
28
- run(playwright)
29
-
12
+ ```ruby
13
+ def handle_dialog(dialog)
14
+ puts "[#{dialog.type}] #{dialog.message}"
15
+ if dialog.message =~ /foo/
16
+ dialog.accept
17
+ else
18
+ dialog.dismiss
19
+ end
20
+ end
21
+
22
+ page.on("dialog", method(:handle_dialog))
23
+ page.evaluate("confirm('foo')") # will be accepted
24
+ # => [confirm] foo
25
+ page.evaluate("alert('bar')") # will be dismissed
26
+ # => [alert] bar
30
27
  ```
31
28
 
32
29
  **NOTE**: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener.
@@ -12,16 +12,16 @@ browser context is closed.
12
12
 
13
13
  Download event is emitted once the download starts. Download path becomes available once download completes.
14
14
 
15
- ```python sync title=example_c247767083cf193df26a39a61a3a8bc19d63ed5c24db91b88c50b7d37975005d.py
16
- # Start waiting for the download
17
- with page.expect_download() as download_info:
18
- # Perform the action that initiates download
19
- page.get_by_text("Download file").click()
20
- download = download_info.value
15
+ ```ruby
16
+ download = page.expect_download do
17
+ page.get_by_text("Download file").click
18
+ end
21
19
 
22
20
  # Wait for the download process to complete and save the downloaded file somewhere
23
- download.save_as("/path/to/save/at/" + download.suggested_filename)
21
+ path = File.join(download_dir, download.suggested_filename)
22
+ download.save_as(path)
24
23
 
24
+ path
25
25
  ```
26
26
 
27
27
  ## cancel
@@ -68,8 +68,7 @@ def path
68
68
  ```
69
69
 
70
70
 
71
- Returns path to the downloaded file in case of successful download. The method will
72
- wait for the download to finish if necessary. The method throws when connected remotely.
71
+ Returns path to the downloaded file for a successful download, or throws for a failed/canceled download. The method will wait for the download to finish if necessary. The method throws when connected remotely.
73
72
 
74
73
  Note that the download's file name is a random GUID, use [Download#suggested_filename](./download#suggested_filename)
75
74
  to get suggested file name.
@@ -86,9 +85,8 @@ is still in progress. Will wait for the download to finish if necessary.
86
85
 
87
86
  **Usage**
88
87
 
89
- ```python sync title=example_66ffd4ef7286957e4294d84b8f660ff852c87af27a56b3e4dd9f84562b5ece02.py
90
- download.save_as("/path/to/save/at/" + download.suggested_filename)
91
-
88
+ ```ruby
89
+ download.save_as(File.join(download_dir, download.suggested_filename))
92
90
  ```
93
91
 
94
92
  ## suggested_filename
@@ -180,13 +180,16 @@ default.
180
180
 
181
181
  Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
182
182
  properties:
183
+ - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
184
+ - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
183
185
  - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
186
+ - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
184
187
  - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
185
188
  - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
186
189
  - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
187
190
  - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
188
191
  - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
189
- - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
192
+ - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
190
193
 
191
194
  You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
192
195
 
@@ -505,14 +508,13 @@ Triggers a `change` and `input` event once all the provided options have been se
505
508
 
506
509
  **Usage**
507
510
 
508
- ```python sync title=example_e6bbc99e34c9f6ee73aa7d4265d34af456e6c67d185530f0a77f8064050a3ec4.py
509
- # Single selection matching the value or label
510
- handle.select_option("blue")
511
+ ```ruby
512
+ # single selection matching the value
513
+ element_handle.select_option(value: "blue")
511
514
  # single selection matching both the label
512
- handle.select_option(label="blue")
515
+ element_handle.select_option(label: "blue")
513
516
  # multiple selection
514
- handle.select_option(value=["red", "green", "blue"])
515
-
517
+ element_handle.select_option(value: ["red", "green", "blue"])
516
518
  ```
517
519
 
518
520
  ## select_text
@@ -15,25 +15,16 @@ At every point of time, page exposes its current frame tree via the [Page#main_f
15
15
 
16
16
  An example of dumping frame tree:
17
17
 
18
- ```python sync title=example_2bc8a0187190738d8dc7b29c66ad5f9f2187fd1827455e9ceb1e9ace26aaf534.py
19
- from playwright.sync_api import sync_playwright, Playwright
20
-
21
- def run(playwright: Playwright):
22
- firefox = playwright.firefox
23
- browser = firefox.launch()
24
- page = browser.new_page()
25
- page.goto("https://www.theverge.com")
26
- dump_frame_tree(page.main_frame, "")
27
- browser.close()
28
-
29
- def dump_frame_tree(frame, indent):
30
- print(indent + frame.name + '@' + frame.url)
31
- for child in frame.child_frames:
32
- dump_frame_tree(child, indent + " ")
33
-
34
- with sync_playwright() as playwright:
35
- run(playwright)
18
+ ```ruby
19
+ def dump_frame_tree(frame, indent = 0)
20
+ puts "#{' ' * indent}#{frame.name}@#{frame.url}"
21
+ frame.child_frames.each do |child|
22
+ dump_frame_tree(child, indent + 2)
23
+ end
24
+ end
36
25
 
26
+ page.goto("https://www.theverge.com")
27
+ dump_frame_tree(page.main_frame)
37
28
  ```
38
29
 
39
30
  ## add_script_tag
@@ -187,13 +178,16 @@ default.
187
178
 
188
179
  Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
189
180
  properties:
181
+ - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
182
+ - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
190
183
  - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
184
+ - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
191
185
  - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
192
186
  - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
193
187
  - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
194
188
  - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
195
189
  - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
196
- - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
190
+ - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
197
191
 
198
192
  You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
199
193
 
@@ -920,14 +914,13 @@ Triggers a `change` and `input` event once all the provided options have been se
920
914
 
921
915
  **Usage**
922
916
 
923
- ```python sync title=example_3f390f340c78c42dd0c88a09b2f56575b02b163786e8cdee33581217afced6b2.py
924
- # Single selection matching the value or label
925
- frame.select_option("select#colors", "blue")
917
+ ```ruby
918
+ # single selection matching the value
919
+ frame.select_option("select#colors", value: "blue")
926
920
  # single selection matching both the label
927
- frame.select_option("select#colors", label="blue")
921
+ frame.select_option("select#colors", label: "blue")
928
922
  # multiple selection
929
- frame.select_option("select#colors", value=["red", "green", "blue"])
930
-
923
+ frame.select_option("select#colors", value: ["red", "green", "blue"])
931
924
  ```
932
925
 
933
926
  ## set_checked
@@ -1099,20 +1092,9 @@ Returns when the `expression` returns a truthy value, returns that value.
1099
1092
 
1100
1093
  The [Frame#wait_for_function](./frame#wait_for_function) can be used to observe viewport size change:
1101
1094
 
1102
- ```python sync title=example_e6a8c279eb09e58e3522cb6237f5d62165b164cad0c1916720af299ffcb8dc8a.py
1103
- from playwright.sync_api import sync_playwright, Playwright
1104
-
1105
- def run(playwright: Playwright):
1106
- webkit = playwright.webkit
1107
- browser = webkit.launch()
1108
- page = browser.new_page()
1109
- page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
1110
- page.main_frame.wait_for_function("() => window.x > 0")
1111
- browser.close()
1112
-
1113
- with sync_playwright() as playwright:
1114
- run(playwright)
1115
-
1095
+ ```ruby
1096
+ frame.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
1097
+ frame.wait_for_function("() => window.x > 0")
1116
1098
  ```
1117
1099
 
1118
1100
  To pass an argument to the predicate of `frame.waitForFunction` function:
@@ -1188,22 +1170,13 @@ function will throw.
1188
1170
 
1189
1171
  This method works across navigations:
1190
1172
 
1191
- ```python sync title=example_6e2a71807566cf008382d4c163ff6e71e34d7f10ef6706ad7fcaa9b70c256a66.py
1192
- from playwright.sync_api import sync_playwright, Playwright
1193
-
1194
- def run(playwright: Playwright):
1195
- chromium = playwright.chromium
1196
- browser = chromium.launch()
1197
- page = browser.new_page()
1198
- for current_url in ["https://google.com", "https://bbc.com"]:
1199
- page.goto(current_url, wait_until="domcontentloaded")
1200
- element = page.main_frame.wait_for_selector("img")
1201
- print("Loaded image: " + str(element.get_attribute("src")))
1202
- browser.close()
1203
-
1204
- with sync_playwright() as playwright:
1205
- run(playwright)
1206
-
1173
+ ```ruby
1174
+ %w[https://google.com https://bbc.com].each do |current_url|
1175
+ page.goto(current_url, waitUntil: "domcontentloaded")
1176
+ frame = page.main_frame
1177
+ element = frame.wait_for_selector("img")
1178
+ puts "Loaded image: #{element["src"]}"
1179
+ end
1207
1180
  ```
1208
1181
 
1209
1182
  ## wait_for_timeout
@@ -42,7 +42,7 @@ def all_inner_texts
42
42
 
43
43
  Returns an array of `node.innerText` values for all matching nodes.
44
44
 
45
- **NOTE**: If you need to assert text on the page, prefer [`method: LocatorAssertions.toHaveText`] with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
45
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
46
46
 
47
47
  **Usage**
48
48
 
@@ -59,7 +59,7 @@ def all_text_contents
59
59
 
60
60
  Returns an array of `node.textContent` values for all matching nodes.
61
61
 
62
- **NOTE**: If you need to assert text on the page, prefer [`method: LocatorAssertions.toHaveText`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
62
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
63
63
 
64
64
  **Usage**
65
65
 
@@ -236,7 +236,7 @@ def count
236
236
 
237
237
  Returns the number of elements matching the locator.
238
238
 
239
- **NOTE**: If you need to assert the number of elements on the page, prefer [`method: LocatorAssertions.toHaveCount`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
239
+ **NOTE**: If you need to assert the number of elements on the page, prefer [LocatorAssertions#to_have_count](./locator_assertions#to_have_count) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
240
240
 
241
241
  **Usage**
242
242
 
@@ -303,13 +303,16 @@ default.
303
303
 
304
304
  Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
305
305
  properties:
306
+ - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
307
+ - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
306
308
  - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
309
+ - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
307
310
  - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
308
311
  - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
309
312
  - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
310
313
  - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
311
314
  - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
312
- - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
315
+ - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
313
316
 
314
317
  You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
315
318
 
@@ -532,7 +535,7 @@ alias: `[]`
532
535
 
533
536
  Returns the matching element's attribute value.
534
537
 
535
- **NOTE**: If you need to assert an element's attribute, prefer [`method: LocatorAssertions.toHaveAttribute`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
538
+ **NOTE**: If you need to assert an element's attribute, prefer [LocatorAssertions#to_have_attribute](./locator_assertions#to_have_attribute) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
536
539
 
537
540
  ## get_by_alt_text
538
541
 
@@ -816,7 +819,7 @@ def inner_text(timeout: nil)
816
819
 
817
820
  Returns the [`element.innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText).
818
821
 
819
- **NOTE**: If you need to assert text on the page, prefer [`method: LocatorAssertions.toHaveText`] with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
822
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
820
823
 
821
824
  ## input_value
822
825
 
@@ -827,7 +830,7 @@ def input_value(timeout: nil)
827
830
 
828
831
  Returns the value for the matching `<input>` or `<textarea>` or `<select>` element.
829
832
 
830
- **NOTE**: If you need to assert input value, prefer [`method: LocatorAssertions.toHaveValue`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
833
+ **NOTE**: If you need to assert input value, prefer [LocatorAssertions#to_have_value](./locator_assertions#to_have_value) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
831
834
 
832
835
  **Usage**
833
836
 
@@ -848,7 +851,7 @@ def checked?(timeout: nil)
848
851
 
849
852
  Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
850
853
 
851
- **NOTE**: If you need to assert that checkbox is checked, prefer [`method: LocatorAssertions.toBeChecked`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
854
+ **NOTE**: If you need to assert that checkbox is checked, prefer [LocatorAssertions#to_be_checked](./locator_assertions#to_be_checked) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
852
855
 
853
856
  **Usage**
854
857
 
@@ -865,7 +868,7 @@ def disabled?(timeout: nil)
865
868
 
866
869
  Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/python/docs/actionability#enabled).
867
870
 
868
- **NOTE**: If you need to assert that an element is disabled, prefer [`method: LocatorAssertions.toBeDisabled`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
871
+ **NOTE**: If you need to assert that an element is disabled, prefer [LocatorAssertions#to_be_disabled](./locator_assertions#to_be_disabled) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
869
872
 
870
873
  **Usage**
871
874
 
@@ -882,7 +885,7 @@ def editable?(timeout: nil)
882
885
 
883
886
  Returns whether the element is [editable](https://playwright.dev/python/docs/actionability#editable).
884
887
 
885
- **NOTE**: If you need to assert that an element is editable, prefer [`method: LocatorAssertions.toBeEditable`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
888
+ **NOTE**: If you need to assert that an element is editable, prefer [LocatorAssertions#to_be_editable](./locator_assertions#to_be_editable) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
886
889
 
887
890
  **Usage**
888
891
 
@@ -899,7 +902,7 @@ def enabled?(timeout: nil)
899
902
 
900
903
  Returns whether the element is [enabled](https://playwright.dev/python/docs/actionability#enabled).
901
904
 
902
- **NOTE**: If you need to assert that an element is enabled, prefer [`method: LocatorAssertions.toBeEnabled`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
905
+ **NOTE**: If you need to assert that an element is enabled, prefer [LocatorAssertions#to_be_enabled](./locator_assertions#to_be_enabled) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
903
906
 
904
907
  **Usage**
905
908
 
@@ -916,7 +919,7 @@ def hidden?(timeout: nil)
916
919
 
917
920
  Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/python/docs/actionability#visible).
918
921
 
919
- **NOTE**: If you need to assert that element is hidden, prefer [`method: LocatorAssertions.toBeHidden`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
922
+ **NOTE**: If you need to assert that element is hidden, prefer [LocatorAssertions#to_be_hidden](./locator_assertions#to_be_hidden) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
920
923
 
921
924
  **Usage**
922
925
 
@@ -933,7 +936,7 @@ def visible?(timeout: nil)
933
936
 
934
937
  Returns whether the element is [visible](https://playwright.dev/python/docs/actionability#visible).
935
938
 
936
- **NOTE**: If you need to assert that element is visible, prefer [`method: LocatorAssertions.toBeVisible`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
939
+ **NOTE**: If you need to assert that element is visible, prefer [LocatorAssertions#to_be_visible](./locator_assertions#to_be_visible) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
937
940
 
938
941
  **Usage**
939
942
 
@@ -1071,19 +1074,17 @@ To press a special key, like `Control` or `ArrowDown`, use [Locator#press](./loc
1071
1074
 
1072
1075
  **Usage**
1073
1076
 
1074
- ```python sync title=example_1b7781d5527574a18d4b9812e3461203d2acc9ba7e09cbfd0ffbc4154e3f5971.py
1075
- locator.press_sequentially("hello") # types instantly
1076
- locator.press_sequentially("world", delay=100) # types slower, like a user
1077
-
1077
+ ```ruby
1078
+ element.press_sequentially("hello") # types instantly
1079
+ element.press_sequentially("world", delay: 100) # types slower, like a user
1078
1080
  ```
1079
1081
 
1080
1082
  An example of typing into a text field and then submitting the form:
1081
1083
 
1082
- ```python sync title=example_cc0a6b9aa95b97e5c17c4b114da10a29c7f6f793e99aee1ea2703636af6e24f9.py
1083
- locator = page.get_by_label("Password")
1084
- locator.press_sequentially("my password")
1085
- locator.press("Enter")
1086
-
1084
+ ```ruby
1085
+ element = page.get_by_label("Password")
1086
+ element.press_sequentially("my password")
1087
+ element.press("Enter")
1087
1088
  ```
1088
1089
 
1089
1090
  ## screenshot
@@ -1301,7 +1302,7 @@ def text_content(timeout: nil)
1301
1302
 
1302
1303
  Returns the [`node.textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
1303
1304
 
1304
- **NOTE**: If you need to assert text on the page, prefer [`method: LocatorAssertions.toHaveText`] to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
1305
+ **NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
1305
1306
 
1306
1307
  ## type
1307
1308