playwright-ruby-client 1.58.1 → 1.59.0
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.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/documentation/docs/api/browser_context.md +26 -0
- data/documentation/docs/api/browser_type.md +2 -0
- data/documentation/docs/api/console_message.md +9 -0
- data/documentation/docs/api/frame.md +2 -2
- data/documentation/docs/api/frame_locator.md +2 -2
- data/documentation/docs/api/locator.md +16 -3
- data/documentation/docs/api/page.md +68 -5
- data/documentation/docs/api/request.md +13 -0
- data/documentation/docs/api/response.md +9 -0
- data/documentation/docs/api/tracing.md +1 -0
- data/documentation/docs/article/guides/rails_integration_with_null_driver.md +46 -0
- data/documentation/docs/include/api_coverage.md +15 -0
- data/lib/playwright/channel_owners/browser_context.rb +24 -4
- data/lib/playwright/channel_owners/debugger.rb +4 -0
- data/lib/playwright/channel_owners/dialog.rb +3 -1
- data/lib/playwright/channel_owners/disposable.rb +9 -0
- data/lib/playwright/channel_owners/overlay.rb +4 -0
- data/lib/playwright/channel_owners/page.rb +54 -31
- data/lib/playwright/channel_owners/request.rb +8 -0
- data/lib/playwright/channel_owners/response.rb +5 -0
- data/lib/playwright/channel_owners/tracing.rb +2 -1
- data/lib/playwright/console_message_impl.rb +4 -0
- data/lib/playwright/disposable.rb +11 -0
- data/lib/playwright/har_router.rb +16 -1
- data/lib/playwright/locator_impl.rb +19 -3
- data/lib/playwright/screencast.rb +91 -0
- data/lib/playwright/utils.rb +19 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/video.rb +6 -4
- data/lib/playwright.rb +2 -0
- data/lib/playwright_api/android.rb +7 -7
- data/lib/playwright_api/android_device.rb +6 -6
- data/lib/playwright_api/api_request_context.rb +6 -6
- data/lib/playwright_api/browser.rb +18 -6
- data/lib/playwright_api/browser_context.rb +42 -16
- data/lib/playwright_api/browser_type.rb +11 -9
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -0
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +8 -8
- data/lib/playwright_api/frame_locator.rb +2 -2
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +14 -4
- data/lib/playwright_api/page.rb +68 -19
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +16 -6
- data/lib/playwright_api/response.rb +12 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/tracing.rb +8 -7
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- data/playwright.gemspec +7 -1
- data/sig/playwright.rbs +28 -15
- metadata +7 -11
- data/AGENTS.md +0 -4
- data/CLAUDE/api_generation.md +0 -28
- data/CLAUDE/ci_expectations.md +0 -23
- data/CLAUDE/gem_release_flow.md +0 -39
- data/CLAUDE/past_upgrade_pr_patterns.md +0 -42
- data/CLAUDE/playwright_upgrade_workflow.md +0 -35
- data/CLAUDE/rspec_debugging.md +0 -30
- data/CLAUDE/unimplemented_examples.md +0 -18
- data/CLAUDE.md +0 -32
|
@@ -25,6 +25,12 @@ module Playwright
|
|
|
25
25
|
wrap_impl(@impl.clock)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
#
|
|
29
|
+
# Debugger allows to pause and resume the execution.
|
|
30
|
+
def debugger # property
|
|
31
|
+
raise NotImplementedError.new('debugger is not implemented yet.')
|
|
32
|
+
end
|
|
33
|
+
|
|
28
34
|
#
|
|
29
35
|
# API testing helper associated with this context. Requests made with this API will use context cookies.
|
|
30
36
|
def request # property
|
|
@@ -226,6 +232,12 @@ module Playwright
|
|
|
226
232
|
wrap_impl(@impl.grant_permissions(unwrap_impl(permissions), origin: unwrap_impl(origin)))
|
|
227
233
|
end
|
|
228
234
|
|
|
235
|
+
#
|
|
236
|
+
# Indicates that the browser context is in the process of closing or has already been closed.
|
|
237
|
+
def closed?
|
|
238
|
+
wrap_impl(@impl.closed?)
|
|
239
|
+
end
|
|
240
|
+
|
|
229
241
|
#
|
|
230
242
|
# **NOTE**: CDP sessions are only supported on Chromium-based browsers.
|
|
231
243
|
#
|
|
@@ -409,6 +421,20 @@ module Playwright
|
|
|
409
421
|
wrap_impl(@impl.storage_state(indexedDB: unwrap_impl(indexedDB), path: unwrap_impl(path)))
|
|
410
422
|
end
|
|
411
423
|
|
|
424
|
+
#
|
|
425
|
+
# Clears the existing cookies, local storage and IndexedDB entries for all origins and sets the new storage state.
|
|
426
|
+
#
|
|
427
|
+
# **Usage**
|
|
428
|
+
#
|
|
429
|
+
# ```python sync
|
|
430
|
+
# # Load storage state from a file and apply it to the context.
|
|
431
|
+
# context.set_storage_state("state.json")
|
|
432
|
+
# ```
|
|
433
|
+
def set_storage_state(storageState)
|
|
434
|
+
wrap_impl(@impl.set_storage_state(unwrap_impl(storageState)))
|
|
435
|
+
end
|
|
436
|
+
alias_method :storage_state=, :set_storage_state
|
|
437
|
+
|
|
412
438
|
#
|
|
413
439
|
# Removes all routes created with [`method: BrowserContext.route`] and [`method: BrowserContext.routeFromHAR`].
|
|
414
440
|
def unroute_all(behavior: nil)
|
|
@@ -464,34 +490,28 @@ module Playwright
|
|
|
464
490
|
end
|
|
465
491
|
|
|
466
492
|
# @nodoc
|
|
467
|
-
def
|
|
468
|
-
wrap_impl(@impl.
|
|
469
|
-
end
|
|
470
|
-
|
|
471
|
-
# @nodoc
|
|
472
|
-
def browser=(req)
|
|
473
|
-
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
|
493
|
+
def enable_debug_console!
|
|
494
|
+
wrap_impl(@impl.enable_debug_console!)
|
|
474
495
|
end
|
|
475
496
|
|
|
476
497
|
# @nodoc
|
|
477
|
-
def
|
|
478
|
-
wrap_impl(@impl.
|
|
498
|
+
def pause
|
|
499
|
+
wrap_impl(@impl.pause)
|
|
479
500
|
end
|
|
480
501
|
|
|
481
502
|
# @nodoc
|
|
482
|
-
def
|
|
483
|
-
wrap_impl(@impl.
|
|
503
|
+
def owner_page=(req)
|
|
504
|
+
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
|
484
505
|
end
|
|
485
506
|
|
|
486
507
|
# @nodoc
|
|
487
|
-
def
|
|
488
|
-
wrap_impl(@impl.
|
|
508
|
+
def options=(req)
|
|
509
|
+
wrap_impl(@impl.options=(unwrap_impl(req)))
|
|
489
510
|
end
|
|
490
511
|
|
|
491
|
-
# -- inherited from EventEmitter --
|
|
492
512
|
# @nodoc
|
|
493
|
-
def
|
|
494
|
-
|
|
513
|
+
def browser=(req)
|
|
514
|
+
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
|
495
515
|
end
|
|
496
516
|
|
|
497
517
|
# -- inherited from EventEmitter --
|
|
@@ -506,6 +526,12 @@ module Playwright
|
|
|
506
526
|
event_emitter_proxy.off(event, callback)
|
|
507
527
|
end
|
|
508
528
|
|
|
529
|
+
# -- inherited from EventEmitter --
|
|
530
|
+
# @nodoc
|
|
531
|
+
def once(event, callback)
|
|
532
|
+
event_emitter_proxy.once(event, callback)
|
|
533
|
+
end
|
|
534
|
+
|
|
509
535
|
private def event_emitter_proxy
|
|
510
536
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
511
537
|
end
|
|
@@ -24,7 +24,7 @@ module Playwright
|
|
|
24
24
|
#
|
|
25
25
|
# **NOTE**: The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
|
|
26
26
|
def connect(
|
|
27
|
-
|
|
27
|
+
endpoint,
|
|
28
28
|
exposeNetwork: nil,
|
|
29
29
|
headers: nil,
|
|
30
30
|
slowMo: nil,
|
|
@@ -94,6 +94,7 @@ module Playwright
|
|
|
94
94
|
# describes some differences for Linux users.
|
|
95
95
|
def launch(
|
|
96
96
|
args: nil,
|
|
97
|
+
artifactsDir: nil,
|
|
97
98
|
channel: nil,
|
|
98
99
|
chromiumSandbox: nil,
|
|
99
100
|
downloadsPath: nil,
|
|
@@ -110,7 +111,7 @@ module Playwright
|
|
|
110
111
|
timeout: nil,
|
|
111
112
|
tracesDir: nil,
|
|
112
113
|
&block)
|
|
113
|
-
wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), 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), tracesDir: unwrap_impl(tracesDir), &wrap_block_call(block)))
|
|
114
|
+
wrap_impl(@impl.launch(args: unwrap_impl(args), artifactsDir: unwrap_impl(artifactsDir), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), 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), tracesDir: unwrap_impl(tracesDir), &wrap_block_call(block)))
|
|
114
115
|
end
|
|
115
116
|
|
|
116
117
|
#
|
|
@@ -122,6 +123,7 @@ module Playwright
|
|
|
122
123
|
userDataDir,
|
|
123
124
|
acceptDownloads: nil,
|
|
124
125
|
args: nil,
|
|
126
|
+
artifactsDir: nil,
|
|
125
127
|
baseURL: nil,
|
|
126
128
|
bypassCSP: nil,
|
|
127
129
|
channel: nil,
|
|
@@ -170,7 +172,7 @@ module Playwright
|
|
|
170
172
|
userAgent: nil,
|
|
171
173
|
viewport: nil,
|
|
172
174
|
&block)
|
|
173
|
-
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
175
|
+
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), artifactsDir: unwrap_impl(artifactsDir), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
174
176
|
end
|
|
175
177
|
|
|
176
178
|
#
|
|
@@ -179,12 +181,6 @@ module Playwright
|
|
|
179
181
|
wrap_impl(@impl.name)
|
|
180
182
|
end
|
|
181
183
|
|
|
182
|
-
# -- inherited from EventEmitter --
|
|
183
|
-
# @nodoc
|
|
184
|
-
def once(event, callback)
|
|
185
|
-
event_emitter_proxy.once(event, callback)
|
|
186
|
-
end
|
|
187
|
-
|
|
188
184
|
# -- inherited from EventEmitter --
|
|
189
185
|
# @nodoc
|
|
190
186
|
def on(event, callback)
|
|
@@ -197,6 +193,12 @@ module Playwright
|
|
|
197
193
|
event_emitter_proxy.off(event, callback)
|
|
198
194
|
end
|
|
199
195
|
|
|
196
|
+
# -- inherited from EventEmitter --
|
|
197
|
+
# @nodoc
|
|
198
|
+
def once(event, callback)
|
|
199
|
+
event_emitter_proxy.once(event, callback)
|
|
200
|
+
end
|
|
201
|
+
|
|
200
202
|
private def event_emitter_proxy
|
|
201
203
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
202
204
|
end
|
|
@@ -31,12 +31,6 @@ module Playwright
|
|
|
31
31
|
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# -- inherited from EventEmitter --
|
|
35
|
-
# @nodoc
|
|
36
|
-
def once(event, callback)
|
|
37
|
-
event_emitter_proxy.once(event, callback)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
34
|
# -- inherited from EventEmitter --
|
|
41
35
|
# @nodoc
|
|
42
36
|
def on(event, callback)
|
|
@@ -49,6 +43,12 @@ module Playwright
|
|
|
49
43
|
event_emitter_proxy.off(event, callback)
|
|
50
44
|
end
|
|
51
45
|
|
|
46
|
+
# -- inherited from EventEmitter --
|
|
47
|
+
# @nodoc
|
|
48
|
+
def once(event, callback)
|
|
49
|
+
event_emitter_proxy.once(event, callback)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
52
|
private def event_emitter_proxy
|
|
53
53
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
54
54
|
end
|
|
@@ -68,12 +68,6 @@ module Playwright
|
|
|
68
68
|
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
# -- inherited from EventEmitter --
|
|
72
|
-
# @nodoc
|
|
73
|
-
def once(event, callback)
|
|
74
|
-
event_emitter_proxy.once(event, callback)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
71
|
# -- inherited from EventEmitter --
|
|
78
72
|
# @nodoc
|
|
79
73
|
def on(event, callback)
|
|
@@ -86,6 +80,12 @@ module Playwright
|
|
|
86
80
|
event_emitter_proxy.off(event, callback)
|
|
87
81
|
end
|
|
88
82
|
|
|
83
|
+
# -- inherited from EventEmitter --
|
|
84
|
+
# @nodoc
|
|
85
|
+
def once(event, callback)
|
|
86
|
+
event_emitter_proxy.once(event, callback)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
89
|
private def event_emitter_proxy
|
|
90
90
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
91
91
|
end
|
|
@@ -574,12 +574,6 @@ module Playwright
|
|
|
574
574
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
575
575
|
end
|
|
576
576
|
|
|
577
|
-
# -- inherited from EventEmitter --
|
|
578
|
-
# @nodoc
|
|
579
|
-
def once(event, callback)
|
|
580
|
-
event_emitter_proxy.once(event, callback)
|
|
581
|
-
end
|
|
582
|
-
|
|
583
577
|
# -- inherited from EventEmitter --
|
|
584
578
|
# @nodoc
|
|
585
579
|
def on(event, callback)
|
|
@@ -592,6 +586,12 @@ module Playwright
|
|
|
592
586
|
event_emitter_proxy.off(event, callback)
|
|
593
587
|
end
|
|
594
588
|
|
|
589
|
+
# -- inherited from EventEmitter --
|
|
590
|
+
# @nodoc
|
|
591
|
+
def once(event, callback)
|
|
592
|
+
event_emitter_proxy.once(event, callback)
|
|
593
|
+
end
|
|
594
|
+
|
|
595
595
|
private def event_emitter_proxy
|
|
596
596
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
597
597
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
|
@@ -436,7 +436,7 @@ module Playwright
|
|
|
436
436
|
# <button>Submit</button>
|
|
437
437
|
# ```
|
|
438
438
|
#
|
|
439
|
-
# You can locate each element by
|
|
439
|
+
# You can locate each element by its implicit role:
|
|
440
440
|
#
|
|
441
441
|
# ```python sync
|
|
442
442
|
# expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
|
|
@@ -476,7 +476,7 @@ module Playwright
|
|
|
476
476
|
# <button data-testid="directions">Itinéraire</button>
|
|
477
477
|
# ```
|
|
478
478
|
#
|
|
479
|
-
# You can locate the element by
|
|
479
|
+
# You can locate the element by its test id:
|
|
480
480
|
#
|
|
481
481
|
# ```python sync
|
|
482
482
|
# page.get_by_test_id("directions").click()
|
|
@@ -1055,12 +1055,6 @@ module Playwright
|
|
|
1055
1055
|
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
|
1056
1056
|
end
|
|
1057
1057
|
|
|
1058
|
-
# -- inherited from EventEmitter --
|
|
1059
|
-
# @nodoc
|
|
1060
|
-
def once(event, callback)
|
|
1061
|
-
event_emitter_proxy.once(event, callback)
|
|
1062
|
-
end
|
|
1063
|
-
|
|
1064
1058
|
# -- inherited from EventEmitter --
|
|
1065
1059
|
# @nodoc
|
|
1066
1060
|
def on(event, callback)
|
|
@@ -1073,6 +1067,12 @@ module Playwright
|
|
|
1073
1067
|
event_emitter_proxy.off(event, callback)
|
|
1074
1068
|
end
|
|
1075
1069
|
|
|
1070
|
+
# -- inherited from EventEmitter --
|
|
1071
|
+
# @nodoc
|
|
1072
|
+
def once(event, callback)
|
|
1073
|
+
event_emitter_proxy.once(event, callback)
|
|
1074
|
+
end
|
|
1075
|
+
|
|
1076
1076
|
private def event_emitter_proxy
|
|
1077
1077
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
1078
1078
|
end
|
|
@@ -118,7 +118,7 @@ module Playwright
|
|
|
118
118
|
# <button>Submit</button>
|
|
119
119
|
# ```
|
|
120
120
|
#
|
|
121
|
-
# You can locate each element by
|
|
121
|
+
# You can locate each element by its implicit role:
|
|
122
122
|
#
|
|
123
123
|
# ```python sync
|
|
124
124
|
# expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
|
|
@@ -158,7 +158,7 @@ module Playwright
|
|
|
158
158
|
# <button data-testid="directions">Itinéraire</button>
|
|
159
159
|
# ```
|
|
160
160
|
#
|
|
161
|
-
# You can locate the element by
|
|
161
|
+
# You can locate the element by its test id:
|
|
162
162
|
#
|
|
163
163
|
# ```python sync
|
|
164
164
|
# page.get_by_test_id("directions").click()
|
|
@@ -98,12 +98,6 @@ module Playwright
|
|
|
98
98
|
wrap_impl(@impl.to_s)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
# -- inherited from EventEmitter --
|
|
102
|
-
# @nodoc
|
|
103
|
-
def once(event, callback)
|
|
104
|
-
event_emitter_proxy.once(event, callback)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
101
|
# -- inherited from EventEmitter --
|
|
108
102
|
# @nodoc
|
|
109
103
|
def on(event, callback)
|
|
@@ -116,6 +110,12 @@ module Playwright
|
|
|
116
110
|
event_emitter_proxy.off(event, callback)
|
|
117
111
|
end
|
|
118
112
|
|
|
113
|
+
# -- inherited from EventEmitter --
|
|
114
|
+
# @nodoc
|
|
115
|
+
def once(event, callback)
|
|
116
|
+
event_emitter_proxy.once(event, callback)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
119
|
private def event_emitter_proxy
|
|
120
120
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
121
121
|
end
|
|
@@ -103,8 +103,11 @@ module Playwright
|
|
|
103
103
|
# - listitem:
|
|
104
104
|
# - link "About"
|
|
105
105
|
# ```
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
#
|
|
107
|
+
# An AI-optimized snapshot, controlled by `mode`, is different from a default snapshot:
|
|
108
|
+
# 1. Includes element references `[ref=e2]`. 2. Does not wait for an element matching the locator, and throws when no elements match. 3. Includes snapshots of `<iframe>`s inside the target.
|
|
109
|
+
def aria_snapshot(depth: nil, mode: nil, timeout: nil)
|
|
110
|
+
wrap_impl(@impl.aria_snapshot(depth: unwrap_impl(depth), mode: unwrap_impl(mode), timeout: unwrap_impl(timeout)))
|
|
108
111
|
end
|
|
109
112
|
|
|
110
113
|
#
|
|
@@ -628,7 +631,7 @@ module Playwright
|
|
|
628
631
|
# <button>Submit</button>
|
|
629
632
|
# ```
|
|
630
633
|
#
|
|
631
|
-
# You can locate each element by
|
|
634
|
+
# You can locate each element by its implicit role:
|
|
632
635
|
#
|
|
633
636
|
# ```python sync
|
|
634
637
|
# expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
|
|
@@ -668,7 +671,7 @@ module Playwright
|
|
|
668
671
|
# <button data-testid="directions">Itinéraire</button>
|
|
669
672
|
# ```
|
|
670
673
|
#
|
|
671
|
-
# You can locate the element by
|
|
674
|
+
# You can locate the element by its test id:
|
|
672
675
|
#
|
|
673
676
|
# ```python sync
|
|
674
677
|
# page.get_by_test_id("directions").click()
|
|
@@ -921,6 +924,13 @@ module Playwright
|
|
|
921
924
|
wrap_impl(@impl.locator(unwrap_impl(selectorOrLocator), has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
|
|
922
925
|
end
|
|
923
926
|
|
|
927
|
+
#
|
|
928
|
+
# Returns a new locator that uses best practices for referencing the matched element, prioritizing test ids,
|
|
929
|
+
# aria roles, and other user-facing attributes over CSS selectors. This is useful for converting implementation-detail selectors into more resilient, human-readable locators.
|
|
930
|
+
def normalize
|
|
931
|
+
wrap_impl(@impl.normalize)
|
|
932
|
+
end
|
|
933
|
+
|
|
924
934
|
#
|
|
925
935
|
# Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
|
|
926
936
|
#
|
data/lib/playwright_api/page.rb
CHANGED
|
@@ -64,6 +64,14 @@ module Playwright
|
|
|
64
64
|
wrap_impl(@impl.request)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
#
|
|
68
|
+
# `Screencast` object associated with this page.
|
|
69
|
+
#
|
|
70
|
+
# **Usage**
|
|
71
|
+
def screencast # property
|
|
72
|
+
wrap_impl(@impl.screencast)
|
|
73
|
+
end
|
|
74
|
+
|
|
67
75
|
def touchscreen # property
|
|
68
76
|
wrap_impl(@impl.touchscreen)
|
|
69
77
|
end
|
|
@@ -111,6 +119,13 @@ module Playwright
|
|
|
111
119
|
wrap_impl(@impl.bring_to_front)
|
|
112
120
|
end
|
|
113
121
|
|
|
122
|
+
#
|
|
123
|
+
# Cancels an ongoing [`method: Page.pickLocator`] call by deactivating pick locator mode.
|
|
124
|
+
# If no pick locator mode is active, this method is a no-op.
|
|
125
|
+
def cancel_pick_locator
|
|
126
|
+
wrap_impl(@impl.cancel_pick_locator)
|
|
127
|
+
end
|
|
128
|
+
|
|
114
129
|
#
|
|
115
130
|
# This method checks an element matching `selector` by performing the following steps:
|
|
116
131
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
|
@@ -661,7 +676,7 @@ module Playwright
|
|
|
661
676
|
# <button>Submit</button>
|
|
662
677
|
# ```
|
|
663
678
|
#
|
|
664
|
-
# You can locate each element by
|
|
679
|
+
# You can locate each element by its implicit role:
|
|
665
680
|
#
|
|
666
681
|
# ```python sync
|
|
667
682
|
# expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
|
|
@@ -701,7 +716,7 @@ module Playwright
|
|
|
701
716
|
# <button data-testid="directions">Itinéraire</button>
|
|
702
717
|
# ```
|
|
703
718
|
#
|
|
704
|
-
# You can locate the element by
|
|
719
|
+
# You can locate the element by its test id:
|
|
705
720
|
#
|
|
706
721
|
# ```python sync
|
|
707
722
|
# page.get_by_test_id("directions").click()
|
|
@@ -919,16 +934,28 @@ module Playwright
|
|
|
919
934
|
wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
920
935
|
end
|
|
921
936
|
|
|
937
|
+
#
|
|
938
|
+
# Clears all stored console messages from this page. Subsequent calls to [`method: Page.consoleMessages`] will only return messages logged after the clear.
|
|
939
|
+
def clear_console_messages
|
|
940
|
+
wrap_impl(@impl.clear_console_messages)
|
|
941
|
+
end
|
|
942
|
+
|
|
943
|
+
#
|
|
944
|
+
# Clears all stored page errors from this page. Subsequent calls to [`method: Page.pageErrors`] will only return errors thrown after the clear.
|
|
945
|
+
def clear_page_errors
|
|
946
|
+
wrap_impl(@impl.clear_page_errors)
|
|
947
|
+
end
|
|
948
|
+
|
|
922
949
|
#
|
|
923
950
|
# Returns up to (currently) 200 last console messages from this page. See [`event: Page.console`] for more details.
|
|
924
|
-
def console_messages
|
|
925
|
-
wrap_impl(@impl.console_messages)
|
|
951
|
+
def console_messages(filter: nil)
|
|
952
|
+
wrap_impl(@impl.console_messages(filter: unwrap_impl(filter)))
|
|
926
953
|
end
|
|
927
954
|
|
|
928
955
|
#
|
|
929
956
|
# Returns up to (currently) 200 last page errors from this page. See [`event: Page.pageError`] for more details.
|
|
930
|
-
def page_errors
|
|
931
|
-
wrap_impl(@impl.page_errors)
|
|
957
|
+
def page_errors(filter: nil)
|
|
958
|
+
wrap_impl(@impl.page_errors(filter: unwrap_impl(filter)))
|
|
932
959
|
end
|
|
933
960
|
|
|
934
961
|
#
|
|
@@ -1035,6 +1062,20 @@ module Playwright
|
|
|
1035
1062
|
wrap_impl(@impl.pdf(displayHeaderFooter: unwrap_impl(displayHeaderFooter), footerTemplate: unwrap_impl(footerTemplate), format: unwrap_impl(format), headerTemplate: unwrap_impl(headerTemplate), height: unwrap_impl(height), landscape: unwrap_impl(landscape), margin: unwrap_impl(margin), outline: unwrap_impl(outline), pageRanges: unwrap_impl(pageRanges), path: unwrap_impl(path), preferCSSPageSize: unwrap_impl(preferCSSPageSize), printBackground: unwrap_impl(printBackground), scale: unwrap_impl(scale), tagged: unwrap_impl(tagged), width: unwrap_impl(width)))
|
|
1036
1063
|
end
|
|
1037
1064
|
|
|
1065
|
+
#
|
|
1066
|
+
# Enters pick locator mode where hovering over page elements highlights them and shows the corresponding locator.
|
|
1067
|
+
# Once the user clicks an element, the mode is deactivated and the `Locator` for the picked element is returned.
|
|
1068
|
+
#
|
|
1069
|
+
# **Usage**
|
|
1070
|
+
#
|
|
1071
|
+
# ```python sync
|
|
1072
|
+
# locator = page.pick_locator()
|
|
1073
|
+
# print(locator)
|
|
1074
|
+
# ```
|
|
1075
|
+
def pick_locator
|
|
1076
|
+
wrap_impl(@impl.pick_locator)
|
|
1077
|
+
end
|
|
1078
|
+
|
|
1038
1079
|
#
|
|
1039
1080
|
# Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
|
|
1040
1081
|
#
|
|
@@ -1230,6 +1271,8 @@ module Playwright
|
|
|
1230
1271
|
# page.route("/api/**", handle_route)
|
|
1231
1272
|
# ```
|
|
1232
1273
|
#
|
|
1274
|
+
# If a request matches multiple registered routes, the most recently registered route takes precedence.
|
|
1275
|
+
#
|
|
1233
1276
|
# Page routes take precedence over browser context routes (set up with [`method: BrowserContext.route`]) when request
|
|
1234
1277
|
# matches both handlers.
|
|
1235
1278
|
#
|
|
@@ -1429,6 +1472,12 @@ module Playwright
|
|
|
1429
1472
|
end
|
|
1430
1473
|
alias_method :viewport_size=, :set_viewport_size
|
|
1431
1474
|
|
|
1475
|
+
#
|
|
1476
|
+
# Captures the aria snapshot of the page. Read more about [aria snapshots](../aria-snapshots.md).
|
|
1477
|
+
def aria_snapshot(depth: nil, mode: nil, timeout: nil)
|
|
1478
|
+
wrap_impl(@impl.aria_snapshot(depth: unwrap_impl(depth), mode: unwrap_impl(mode), timeout: unwrap_impl(timeout)))
|
|
1479
|
+
end
|
|
1480
|
+
|
|
1432
1481
|
#
|
|
1433
1482
|
# This method taps an element matching `selector` by performing the following steps:
|
|
1434
1483
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
|
@@ -1523,7 +1572,7 @@ module Playwright
|
|
|
1523
1572
|
end
|
|
1524
1573
|
|
|
1525
1574
|
#
|
|
1526
|
-
# Video object associated with this page.
|
|
1575
|
+
# Video object associated with this page. Can be used to access the video file when using the `recordVideo` context option.
|
|
1527
1576
|
def video
|
|
1528
1577
|
wrap_impl(@impl.video)
|
|
1529
1578
|
end
|
|
@@ -1818,13 +1867,8 @@ module Playwright
|
|
|
1818
1867
|
end
|
|
1819
1868
|
|
|
1820
1869
|
# @nodoc
|
|
1821
|
-
def
|
|
1822
|
-
wrap_impl(@impl.
|
|
1823
|
-
end
|
|
1824
|
-
|
|
1825
|
-
# @nodoc
|
|
1826
|
-
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1827
|
-
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1870
|
+
def owned_context=(req)
|
|
1871
|
+
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
|
1828
1872
|
end
|
|
1829
1873
|
|
|
1830
1874
|
# @nodoc
|
|
@@ -1838,8 +1882,8 @@ module Playwright
|
|
|
1838
1882
|
end
|
|
1839
1883
|
|
|
1840
1884
|
# @nodoc
|
|
1841
|
-
def
|
|
1842
|
-
wrap_impl(@impl.
|
|
1885
|
+
def snapshot_for_ai(timeout: nil, depth: nil, _track: nil)
|
|
1886
|
+
wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), depth: unwrap_impl(depth), _track: unwrap_impl(_track)))
|
|
1843
1887
|
end
|
|
1844
1888
|
|
|
1845
1889
|
# @nodoc
|
|
@@ -1847,10 +1891,9 @@ module Playwright
|
|
|
1847
1891
|
wrap_impl(@impl.stop_css_coverage)
|
|
1848
1892
|
end
|
|
1849
1893
|
|
|
1850
|
-
# -- inherited from EventEmitter --
|
|
1851
1894
|
# @nodoc
|
|
1852
|
-
def
|
|
1853
|
-
|
|
1895
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1896
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1854
1897
|
end
|
|
1855
1898
|
|
|
1856
1899
|
# -- inherited from EventEmitter --
|
|
@@ -1865,6 +1908,12 @@ module Playwright
|
|
|
1865
1908
|
event_emitter_proxy.off(event, callback)
|
|
1866
1909
|
end
|
|
1867
1910
|
|
|
1911
|
+
# -- inherited from EventEmitter --
|
|
1912
|
+
# @nodoc
|
|
1913
|
+
def once(event, callback)
|
|
1914
|
+
event_emitter_proxy.once(event, callback)
|
|
1915
|
+
end
|
|
1916
|
+
|
|
1868
1917
|
private def event_emitter_proxy
|
|
1869
1918
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
1870
1919
|
end
|
|
@@ -103,12 +103,6 @@ module Playwright
|
|
|
103
103
|
wrap_impl(@impl.electron)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
# -- inherited from EventEmitter --
|
|
107
|
-
# @nodoc
|
|
108
|
-
def once(event, callback)
|
|
109
|
-
event_emitter_proxy.once(event, callback)
|
|
110
|
-
end
|
|
111
|
-
|
|
112
106
|
# -- inherited from EventEmitter --
|
|
113
107
|
# @nodoc
|
|
114
108
|
def on(event, callback)
|
|
@@ -121,6 +115,12 @@ module Playwright
|
|
|
121
115
|
event_emitter_proxy.off(event, callback)
|
|
122
116
|
end
|
|
123
117
|
|
|
118
|
+
# -- inherited from EventEmitter --
|
|
119
|
+
# @nodoc
|
|
120
|
+
def once(event, callback)
|
|
121
|
+
event_emitter_proxy.once(event, callback)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
124
|
private def event_emitter_proxy
|
|
125
125
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
126
126
|
end
|
|
@@ -166,6 +166,16 @@ module Playwright
|
|
|
166
166
|
wrap_impl(@impl.response)
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
+
#
|
|
170
|
+
# Returns the `Response` object if the response has already been received, `null` otherwise.
|
|
171
|
+
#
|
|
172
|
+
# Unlike [`method: Request.response`], this method does not wait for the response to arrive. It returns
|
|
173
|
+
# immediately with the response object if the response has been received, or `null` if the response
|
|
174
|
+
# has not been received yet.
|
|
175
|
+
def existing_response
|
|
176
|
+
wrap_impl(@impl.existing_response)
|
|
177
|
+
end
|
|
178
|
+
|
|
169
179
|
#
|
|
170
180
|
# The Service `Worker` that is performing the request.
|
|
171
181
|
#
|
|
@@ -217,12 +227,6 @@ module Playwright
|
|
|
217
227
|
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
|
218
228
|
end
|
|
219
229
|
|
|
220
|
-
# -- inherited from EventEmitter --
|
|
221
|
-
# @nodoc
|
|
222
|
-
def once(event, callback)
|
|
223
|
-
event_emitter_proxy.once(event, callback)
|
|
224
|
-
end
|
|
225
|
-
|
|
226
230
|
# -- inherited from EventEmitter --
|
|
227
231
|
# @nodoc
|
|
228
232
|
def on(event, callback)
|
|
@@ -235,6 +239,12 @@ module Playwright
|
|
|
235
239
|
event_emitter_proxy.off(event, callback)
|
|
236
240
|
end
|
|
237
241
|
|
|
242
|
+
# -- inherited from EventEmitter --
|
|
243
|
+
# @nodoc
|
|
244
|
+
def once(event, callback)
|
|
245
|
+
event_emitter_proxy.once(event, callback)
|
|
246
|
+
end
|
|
247
|
+
|
|
238
248
|
private def event_emitter_proxy
|
|
239
249
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
240
250
|
end
|