playwright-ruby-client 1.21.0 → 1.24.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/documentation/docs/api/browser.md +30 -5
- data/documentation/docs/api/browser_context.md +20 -7
- data/documentation/docs/api/browser_type.md +4 -0
- data/documentation/docs/api/download.md +1 -1
- data/documentation/docs/api/element_handle.md +20 -12
- data/documentation/docs/api/experimental/android.md +1 -1
- data/documentation/docs/api/experimental/android_device.md +4 -0
- data/documentation/docs/api/file_chooser.md +2 -2
- data/documentation/docs/api/frame.md +12 -5
- data/documentation/docs/api/locator.md +43 -13
- data/documentation/docs/api/page.md +31 -11
- data/documentation/docs/api/request.md +3 -1
- data/documentation/docs/api/response.md +12 -1
- data/documentation/docs/api/route.md +67 -0
- data/documentation/docs/api/selectors.md +2 -2
- data/documentation/docs/api/tracing.md +1 -1
- data/documentation/docs/include/api_coverage.md +6 -3
- data/documentation/package.json +4 -4
- data/documentation/yarn.lock +1876 -1304
- data/lib/playwright/channel.rb +1 -3
- data/lib/playwright/channel_owners/browser.rb +13 -0
- data/lib/playwright/channel_owners/browser_context.rb +81 -13
- data/lib/playwright/channel_owners/browser_type.rb +4 -0
- data/lib/playwright/channel_owners/frame.rb +16 -2
- data/lib/playwright/channel_owners/local_utils.rb +29 -0
- data/lib/playwright/channel_owners/page.rb +43 -15
- data/lib/playwright/channel_owners/request.rb +31 -6
- data/lib/playwright/channel_owners/response.rb +6 -0
- data/lib/playwright/channel_owners/route.rb +104 -45
- data/lib/playwright/connection.rb +6 -1
- data/lib/playwright/har_router.rb +82 -0
- data/lib/playwright/http_headers.rb +1 -1
- data/lib/playwright/javascript/regex.rb +23 -0
- data/lib/playwright/javascript/value_parser.rb +21 -2
- data/lib/playwright/javascript/value_serializer.rb +18 -6
- data/lib/playwright/javascript/visitor_info.rb +26 -0
- data/lib/playwright/javascript.rb +1 -0
- data/lib/playwright/locator_impl.rb +13 -5
- data/lib/playwright/playwright_api.rb +26 -6
- data/lib/playwright/route_handler.rb +2 -6
- data/lib/playwright/utils.rb +31 -6
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright.rb +2 -0
- data/lib/playwright_api/android.rb +8 -8
- data/lib/playwright_api/android_device.rb +11 -7
- data/lib/playwright_api/api_request_context.rb +6 -6
- data/lib/playwright_api/browser.rb +34 -8
- data/lib/playwright_api/browser_context.rb +21 -11
- data/lib/playwright_api/browser_type.rb +11 -7
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/download.rb +1 -1
- data/lib/playwright_api/element_handle.rb +26 -24
- data/lib/playwright_api/file_chooser.rb +2 -2
- data/lib/playwright_api/frame.rb +18 -11
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +38 -19
- data/lib/playwright_api/page.rb +33 -16
- data/lib/playwright_api/playwright.rb +8 -8
- data/lib/playwright_api/request.rb +14 -7
- data/lib/playwright_api/response.rb +20 -7
- data/lib/playwright_api/route.rb +69 -8
- data/lib/playwright_api/selectors.rb +7 -7
- data/lib/playwright_api/tracing.rb +7 -7
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- metadata +6 -4
- data/lib/playwright_api/local_utils.rb +0 -9
|
@@ -18,12 +18,21 @@ module Playwright
|
|
|
18
18
|
# ```
|
|
19
19
|
class Browser < PlaywrightApi
|
|
20
20
|
|
|
21
|
+
# Get the browser type (chromium, firefox or webkit) that the browser belongs to.
|
|
22
|
+
def browser_type
|
|
23
|
+
wrap_impl(@impl.browser_type)
|
|
24
|
+
end
|
|
25
|
+
|
|
21
26
|
# In case this browser is obtained using [`method: BrowserType.launch`], closes the browser and all of its pages (if any
|
|
22
27
|
# were opened).
|
|
23
28
|
#
|
|
24
29
|
# In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
|
|
25
30
|
# browser server.
|
|
26
31
|
#
|
|
32
|
+
# > NOTE: This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on
|
|
33
|
+
# any `BrowserContext`'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling
|
|
34
|
+
# [`method: Browser.close`].
|
|
35
|
+
#
|
|
27
36
|
# The `Browser` object itself is considered to be disposed and cannot be used anymore.
|
|
28
37
|
def close
|
|
29
38
|
wrap_impl(@impl.close)
|
|
@@ -55,6 +64,11 @@ module Playwright
|
|
|
55
64
|
|
|
56
65
|
# Creates a new browser context. It won't share cookies/cache with other browser contexts.
|
|
57
66
|
#
|
|
67
|
+
# > NOTE: If directly using this method to create `BrowserContext`s, it is best practice to explicilty close the returned
|
|
68
|
+
# context via [`method: BrowserContext.close`] when your code is done with the `BrowserContext`, and before calling
|
|
69
|
+
# [`method: Browser.close`]. This will ensure the `context` is closed gracefully and any artifacts—like HARs and
|
|
70
|
+
# videos—are fully flushed and saved.
|
|
71
|
+
#
|
|
58
72
|
# ```python sync
|
|
59
73
|
# browser = playwright.firefox.launch() # or "chromium" or "webkit".
|
|
60
74
|
# # create a new incognito browser context.
|
|
@@ -62,6 +76,10 @@ module Playwright
|
|
|
62
76
|
# # create a new page in a pristine context.
|
|
63
77
|
# page = context.new_page()
|
|
64
78
|
# page.goto("https://example.com")
|
|
79
|
+
#
|
|
80
|
+
# # gracefully close up everything
|
|
81
|
+
# context.close()
|
|
82
|
+
# browser.close()
|
|
65
83
|
# ```
|
|
66
84
|
def new_context(
|
|
67
85
|
acceptDownloads: nil,
|
|
@@ -82,19 +100,23 @@ module Playwright
|
|
|
82
100
|
offline: nil,
|
|
83
101
|
permissions: nil,
|
|
84
102
|
proxy: nil,
|
|
103
|
+
record_har_content: nil,
|
|
104
|
+
record_har_mode: nil,
|
|
85
105
|
record_har_omit_content: nil,
|
|
86
106
|
record_har_path: nil,
|
|
107
|
+
record_har_url_filter: nil,
|
|
87
108
|
record_video_dir: nil,
|
|
88
109
|
record_video_size: nil,
|
|
89
110
|
reducedMotion: nil,
|
|
90
111
|
screen: nil,
|
|
112
|
+
serviceWorkers: nil,
|
|
91
113
|
storageState: nil,
|
|
92
114
|
strictSelectors: nil,
|
|
93
115
|
timezoneId: nil,
|
|
94
116
|
userAgent: nil,
|
|
95
117
|
viewport: nil,
|
|
96
118
|
&block)
|
|
97
|
-
wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
119
|
+
wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
98
120
|
end
|
|
99
121
|
|
|
100
122
|
# Creates a new page in a new browser context. Closing this page will close the context as well.
|
|
@@ -121,19 +143,23 @@ module Playwright
|
|
|
121
143
|
offline: nil,
|
|
122
144
|
permissions: nil,
|
|
123
145
|
proxy: nil,
|
|
146
|
+
record_har_content: nil,
|
|
147
|
+
record_har_mode: nil,
|
|
124
148
|
record_har_omit_content: nil,
|
|
125
149
|
record_har_path: nil,
|
|
150
|
+
record_har_url_filter: nil,
|
|
126
151
|
record_video_dir: nil,
|
|
127
152
|
record_video_size: nil,
|
|
128
153
|
reducedMotion: nil,
|
|
129
154
|
screen: nil,
|
|
155
|
+
serviceWorkers: nil,
|
|
130
156
|
storageState: nil,
|
|
131
157
|
strictSelectors: nil,
|
|
132
158
|
timezoneId: nil,
|
|
133
159
|
userAgent: nil,
|
|
134
160
|
viewport: nil,
|
|
135
161
|
&block)
|
|
136
|
-
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
162
|
+
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
137
163
|
end
|
|
138
164
|
|
|
139
165
|
# > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
|
@@ -168,20 +194,20 @@ module Playwright
|
|
|
168
194
|
|
|
169
195
|
# -- inherited from EventEmitter --
|
|
170
196
|
# @nodoc
|
|
171
|
-
def
|
|
172
|
-
event_emitter_proxy.
|
|
197
|
+
def off(event, callback)
|
|
198
|
+
event_emitter_proxy.off(event, callback)
|
|
173
199
|
end
|
|
174
200
|
|
|
175
201
|
# -- inherited from EventEmitter --
|
|
176
202
|
# @nodoc
|
|
177
|
-
def
|
|
178
|
-
event_emitter_proxy.
|
|
203
|
+
def once(event, callback)
|
|
204
|
+
event_emitter_proxy.once(event, callback)
|
|
179
205
|
end
|
|
180
206
|
|
|
181
207
|
# -- inherited from EventEmitter --
|
|
182
208
|
# @nodoc
|
|
183
|
-
def
|
|
184
|
-
event_emitter_proxy.
|
|
209
|
+
def on(event, callback)
|
|
210
|
+
event_emitter_proxy.on(event, callback)
|
|
185
211
|
end
|
|
186
212
|
|
|
187
213
|
private def event_emitter_proxy
|
|
@@ -131,7 +131,7 @@ module Playwright
|
|
|
131
131
|
# <button onclick="onClick()">Click me</button>
|
|
132
132
|
# <div></div>
|
|
133
133
|
# """)
|
|
134
|
-
# page.
|
|
134
|
+
# page.locator("button").click()
|
|
135
135
|
#
|
|
136
136
|
# with sync_playwright() as playwright:
|
|
137
137
|
# run(playwright)
|
|
@@ -190,7 +190,7 @@ module Playwright
|
|
|
190
190
|
# <button onclick="onClick()">Click me</button>
|
|
191
191
|
# <div></div>
|
|
192
192
|
# """)
|
|
193
|
-
# page.
|
|
193
|
+
# page.locator("button").click()
|
|
194
194
|
#
|
|
195
195
|
# with sync_playwright() as playwright:
|
|
196
196
|
# run(playwright)
|
|
@@ -225,9 +225,9 @@ module Playwright
|
|
|
225
225
|
# Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
|
|
226
226
|
# is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
|
227
227
|
#
|
|
228
|
-
# > NOTE: [`method:
|
|
228
|
+
# > NOTE: [`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See
|
|
229
229
|
# [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
|
|
230
|
-
# request interception
|
|
230
|
+
# request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
|
|
231
231
|
#
|
|
232
232
|
# An example of a naive handler that aborts all image requests:
|
|
233
233
|
#
|
|
@@ -273,6 +273,16 @@ module Playwright
|
|
|
273
273
|
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler), times: unwrap_impl(times)))
|
|
274
274
|
end
|
|
275
275
|
|
|
276
|
+
# If specified the network requests that are made in the context will be served from the HAR file. Read more about
|
|
277
|
+
# [Replaying from HAR](../network.md#replaying-from-har).
|
|
278
|
+
#
|
|
279
|
+
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See
|
|
280
|
+
# [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
|
|
281
|
+
# request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
|
|
282
|
+
def route_from_har(har, notFound: nil, update: nil, url: nil)
|
|
283
|
+
wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), url: unwrap_impl(url)))
|
|
284
|
+
end
|
|
285
|
+
|
|
276
286
|
# > NOTE: Service workers are only supported on Chromium-based browsers.
|
|
277
287
|
#
|
|
278
288
|
# All existing service workers in the context.
|
|
@@ -348,7 +358,7 @@ module Playwright
|
|
|
348
358
|
#
|
|
349
359
|
# ```python sync
|
|
350
360
|
# with context.expect_event("page") as event_info:
|
|
351
|
-
# page.
|
|
361
|
+
# page.locator("button").click()
|
|
352
362
|
# page = event_info.value
|
|
353
363
|
# ```
|
|
354
364
|
def expect_event(event, predicate: nil, timeout: nil, &block)
|
|
@@ -398,20 +408,20 @@ module Playwright
|
|
|
398
408
|
|
|
399
409
|
# -- inherited from EventEmitter --
|
|
400
410
|
# @nodoc
|
|
401
|
-
def
|
|
402
|
-
event_emitter_proxy.
|
|
411
|
+
def off(event, callback)
|
|
412
|
+
event_emitter_proxy.off(event, callback)
|
|
403
413
|
end
|
|
404
414
|
|
|
405
415
|
# -- inherited from EventEmitter --
|
|
406
416
|
# @nodoc
|
|
407
|
-
def
|
|
408
|
-
event_emitter_proxy.
|
|
417
|
+
def once(event, callback)
|
|
418
|
+
event_emitter_proxy.once(event, callback)
|
|
409
419
|
end
|
|
410
420
|
|
|
411
421
|
# -- inherited from EventEmitter --
|
|
412
422
|
# @nodoc
|
|
413
|
-
def
|
|
414
|
-
event_emitter_proxy.
|
|
423
|
+
def on(event, callback)
|
|
424
|
+
event_emitter_proxy.on(event, callback)
|
|
415
425
|
end
|
|
416
426
|
|
|
417
427
|
private def event_emitter_proxy
|
|
@@ -124,12 +124,16 @@ module Playwright
|
|
|
124
124
|
offline: nil,
|
|
125
125
|
permissions: nil,
|
|
126
126
|
proxy: nil,
|
|
127
|
+
record_har_content: nil,
|
|
128
|
+
record_har_mode: nil,
|
|
127
129
|
record_har_omit_content: nil,
|
|
128
130
|
record_har_path: nil,
|
|
131
|
+
record_har_url_filter: nil,
|
|
129
132
|
record_video_dir: nil,
|
|
130
133
|
record_video_size: nil,
|
|
131
134
|
reducedMotion: nil,
|
|
132
135
|
screen: nil,
|
|
136
|
+
serviceWorkers: nil,
|
|
133
137
|
slowMo: nil,
|
|
134
138
|
strictSelectors: nil,
|
|
135
139
|
timeout: nil,
|
|
@@ -138,7 +142,7 @@ module Playwright
|
|
|
138
142
|
userAgent: nil,
|
|
139
143
|
viewport: nil,
|
|
140
144
|
&block)
|
|
141
|
-
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), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), 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)))
|
|
145
|
+
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), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), 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)))
|
|
142
146
|
end
|
|
143
147
|
|
|
144
148
|
# Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
|
@@ -148,20 +152,20 @@ module Playwright
|
|
|
148
152
|
|
|
149
153
|
# -- inherited from EventEmitter --
|
|
150
154
|
# @nodoc
|
|
151
|
-
def
|
|
152
|
-
event_emitter_proxy.
|
|
155
|
+
def off(event, callback)
|
|
156
|
+
event_emitter_proxy.off(event, callback)
|
|
153
157
|
end
|
|
154
158
|
|
|
155
159
|
# -- inherited from EventEmitter --
|
|
156
160
|
# @nodoc
|
|
157
|
-
def
|
|
158
|
-
event_emitter_proxy.
|
|
161
|
+
def once(event, callback)
|
|
162
|
+
event_emitter_proxy.once(event, callback)
|
|
159
163
|
end
|
|
160
164
|
|
|
161
165
|
# -- inherited from EventEmitter --
|
|
162
166
|
# @nodoc
|
|
163
|
-
def
|
|
164
|
-
event_emitter_proxy.
|
|
167
|
+
def on(event, callback)
|
|
168
|
+
event_emitter_proxy.on(event, callback)
|
|
165
169
|
end
|
|
166
170
|
|
|
167
171
|
private def event_emitter_proxy
|
|
@@ -35,20 +35,20 @@ module Playwright
|
|
|
35
35
|
|
|
36
36
|
# -- inherited from EventEmitter --
|
|
37
37
|
# @nodoc
|
|
38
|
-
def
|
|
39
|
-
event_emitter_proxy.
|
|
38
|
+
def off(event, callback)
|
|
39
|
+
event_emitter_proxy.off(event, callback)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# -- inherited from EventEmitter --
|
|
43
43
|
# @nodoc
|
|
44
|
-
def
|
|
45
|
-
event_emitter_proxy.
|
|
44
|
+
def once(event, callback)
|
|
45
|
+
event_emitter_proxy.once(event, callback)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# -- inherited from EventEmitter --
|
|
49
49
|
# @nodoc
|
|
50
|
-
def
|
|
51
|
-
event_emitter_proxy.
|
|
50
|
+
def on(event, callback)
|
|
51
|
+
event_emitter_proxy.on(event, callback)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
private def event_emitter_proxy
|
|
@@ -44,20 +44,20 @@ module Playwright
|
|
|
44
44
|
|
|
45
45
|
# -- inherited from EventEmitter --
|
|
46
46
|
# @nodoc
|
|
47
|
-
def
|
|
48
|
-
event_emitter_proxy.
|
|
47
|
+
def off(event, callback)
|
|
48
|
+
event_emitter_proxy.off(event, callback)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# -- inherited from EventEmitter --
|
|
52
52
|
# @nodoc
|
|
53
|
-
def
|
|
54
|
-
event_emitter_proxy.
|
|
53
|
+
def once(event, callback)
|
|
54
|
+
event_emitter_proxy.once(event, callback)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
# -- inherited from EventEmitter --
|
|
58
58
|
# @nodoc
|
|
59
|
-
def
|
|
60
|
-
event_emitter_proxy.
|
|
59
|
+
def on(event, callback)
|
|
60
|
+
event_emitter_proxy.on(event, callback)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
private def event_emitter_proxy
|
|
@@ -60,20 +60,20 @@ module Playwright
|
|
|
60
60
|
|
|
61
61
|
# -- inherited from EventEmitter --
|
|
62
62
|
# @nodoc
|
|
63
|
-
def
|
|
64
|
-
event_emitter_proxy.
|
|
63
|
+
def off(event, callback)
|
|
64
|
+
event_emitter_proxy.off(event, callback)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
# -- inherited from EventEmitter --
|
|
68
68
|
# @nodoc
|
|
69
|
-
def
|
|
70
|
-
event_emitter_proxy.
|
|
69
|
+
def once(event, callback)
|
|
70
|
+
event_emitter_proxy.once(event, callback)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# -- inherited from EventEmitter --
|
|
74
74
|
# @nodoc
|
|
75
|
-
def
|
|
76
|
-
event_emitter_proxy.
|
|
75
|
+
def on(event, callback)
|
|
76
|
+
event_emitter_proxy.on(event, callback)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
private def event_emitter_proxy
|
|
@@ -45,7 +45,7 @@ module Playwright
|
|
|
45
45
|
# This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
|
|
46
46
|
# calculated relative to the main frame viewport - which is usually the same as the browser window.
|
|
47
47
|
#
|
|
48
|
-
# Scrolling affects the returned
|
|
48
|
+
# Scrolling affects the returned bounding box, similarly to
|
|
49
49
|
# [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
|
|
50
50
|
# means `x` and/or `y` may be negative.
|
|
51
51
|
#
|
|
@@ -267,7 +267,10 @@ module Playwright
|
|
|
267
267
|
wrap_impl(@impl.inner_text)
|
|
268
268
|
end
|
|
269
269
|
|
|
270
|
-
# Returns `input.value` for `<input>` or `<textarea>` or `<select>` element.
|
|
270
|
+
# Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
|
271
|
+
#
|
|
272
|
+
# Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
|
|
273
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
|
|
271
274
|
def input_value(timeout: nil)
|
|
272
275
|
wrap_impl(@impl.input_value(timeout: unwrap_impl(timeout)))
|
|
273
276
|
end
|
|
@@ -341,10 +344,14 @@ module Playwright
|
|
|
341
344
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
|
342
345
|
end
|
|
343
346
|
|
|
344
|
-
#
|
|
347
|
+
# This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
|
|
348
|
+
# element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable
|
|
349
|
+
# container, only the currently scrolled content will be visible on the screenshot.
|
|
345
350
|
#
|
|
346
351
|
# This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a
|
|
347
352
|
# screenshot. If the element is detached from DOM, the method throws an error.
|
|
353
|
+
#
|
|
354
|
+
# Returns the buffer with the captured screenshot.
|
|
348
355
|
def screenshot(
|
|
349
356
|
animations: nil,
|
|
350
357
|
caret: nil,
|
|
@@ -387,17 +394,6 @@ module Playwright
|
|
|
387
394
|
# # multiple selection
|
|
388
395
|
# handle.select_option(value=["red", "green", "blue"])
|
|
389
396
|
# ```
|
|
390
|
-
#
|
|
391
|
-
# ```python sync
|
|
392
|
-
# # single selection matching the value
|
|
393
|
-
# handle.select_option("blue")
|
|
394
|
-
# # single selection matching both the value and the label
|
|
395
|
-
# handle.select_option(label="blue")
|
|
396
|
-
# # multiple selection
|
|
397
|
-
# handle.select_option("red", "green", "blue")
|
|
398
|
-
# # multiple selection for blue, red and second option
|
|
399
|
-
# handle.select_option(value="blue", { index: 2 }, "red")
|
|
400
|
-
# ```
|
|
401
397
|
def select_option(
|
|
402
398
|
element: nil,
|
|
403
399
|
index: nil,
|
|
@@ -411,6 +407,10 @@ module Playwright
|
|
|
411
407
|
|
|
412
408
|
# This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
|
|
413
409
|
# content.
|
|
410
|
+
#
|
|
411
|
+
# If the element is inside the `<label>` element that has an associated
|
|
412
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), focuses and selects text in the
|
|
413
|
+
# control instead.
|
|
414
414
|
def select_text(force: nil, timeout: nil)
|
|
415
415
|
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
|
416
416
|
end
|
|
@@ -438,11 +438,13 @@ module Playwright
|
|
|
438
438
|
end
|
|
439
439
|
alias_method :checked=, :set_checked
|
|
440
440
|
|
|
441
|
-
# This method expects `elementHandle` to point to an
|
|
442
|
-
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
443
|
-
#
|
|
444
441
|
# Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
|
|
445
|
-
# are resolved relative to the
|
|
442
|
+
# are resolved relative to the current working directory. For empty array, clears the selected files.
|
|
443
|
+
#
|
|
444
|
+
# This method expects `ElementHandle` to point to an
|
|
445
|
+
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
|
|
446
|
+
# `<label>` element that has an associated
|
|
447
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
|
|
446
448
|
def set_input_files(files, noWaitAfter: nil, timeout: nil)
|
|
447
449
|
wrap_impl(@impl.set_input_files(unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
|
448
450
|
end
|
|
@@ -557,20 +559,20 @@ module Playwright
|
|
|
557
559
|
|
|
558
560
|
# -- inherited from EventEmitter --
|
|
559
561
|
# @nodoc
|
|
560
|
-
def
|
|
561
|
-
event_emitter_proxy.
|
|
562
|
+
def off(event, callback)
|
|
563
|
+
event_emitter_proxy.off(event, callback)
|
|
562
564
|
end
|
|
563
565
|
|
|
564
566
|
# -- inherited from EventEmitter --
|
|
565
567
|
# @nodoc
|
|
566
|
-
def
|
|
567
|
-
event_emitter_proxy.
|
|
568
|
+
def once(event, callback)
|
|
569
|
+
event_emitter_proxy.once(event, callback)
|
|
568
570
|
end
|
|
569
571
|
|
|
570
572
|
# -- inherited from EventEmitter --
|
|
571
573
|
# @nodoc
|
|
572
|
-
def
|
|
573
|
-
event_emitter_proxy.
|
|
574
|
+
def on(event, callback)
|
|
575
|
+
event_emitter_proxy.on(event, callback)
|
|
574
576
|
end
|
|
575
577
|
|
|
576
578
|
private def event_emitter_proxy
|
|
@@ -3,7 +3,7 @@ module Playwright
|
|
|
3
3
|
#
|
|
4
4
|
# ```python sync
|
|
5
5
|
# with page.expect_file_chooser() as fc_info:
|
|
6
|
-
# page.
|
|
6
|
+
# page.locator("upload").click()
|
|
7
7
|
# file_chooser = fc_info.value
|
|
8
8
|
# file_chooser.set_files("myfile.pdf")
|
|
9
9
|
# ```
|
|
@@ -25,7 +25,7 @@ module Playwright
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then
|
|
28
|
-
# they are resolved relative to the
|
|
28
|
+
# they are resolved relative to the current working directory. For empty array, clears the selected files.
|
|
29
29
|
def set_files(files, noWaitAfter: nil, timeout: nil)
|
|
30
30
|
wrap_impl(@impl.set_files(unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
|
31
31
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
|
@@ -400,7 +400,10 @@ module Playwright
|
|
|
400
400
|
wrap_impl(@impl.inner_text(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
401
401
|
end
|
|
402
402
|
|
|
403
|
-
# Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
|
403
|
+
# Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
|
404
|
+
#
|
|
405
|
+
# Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
|
|
406
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
|
|
404
407
|
def input_value(selector, strict: nil, timeout: nil)
|
|
405
408
|
wrap_impl(@impl.input_value(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
406
409
|
end
|
|
@@ -445,6 +448,8 @@ module Playwright
|
|
|
445
448
|
# The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
|
446
449
|
# element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
|
447
450
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
|
451
|
+
#
|
|
452
|
+
# [Learn more about locators](../locators.md).
|
|
448
453
|
def locator(selector, has: nil, hasText: nil)
|
|
449
454
|
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
|
450
455
|
end
|
|
@@ -576,11 +581,13 @@ module Playwright
|
|
|
576
581
|
end
|
|
577
582
|
alias_method :content=, :set_content
|
|
578
583
|
|
|
579
|
-
# This method expects `selector` to point to an
|
|
580
|
-
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
581
|
-
#
|
|
582
584
|
# Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
|
|
583
|
-
# are resolved relative to the
|
|
585
|
+
# are resolved relative to the current working directory. For empty array, clears the selected files.
|
|
586
|
+
#
|
|
587
|
+
# This method expects `selector` to point to an
|
|
588
|
+
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
|
|
589
|
+
# `<label>` element that has an associated
|
|
590
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
|
|
584
591
|
def set_input_files(
|
|
585
592
|
selector,
|
|
586
593
|
files,
|
|
@@ -795,20 +802,20 @@ module Playwright
|
|
|
795
802
|
|
|
796
803
|
# -- inherited from EventEmitter --
|
|
797
804
|
# @nodoc
|
|
798
|
-
def
|
|
799
|
-
event_emitter_proxy.
|
|
805
|
+
def off(event, callback)
|
|
806
|
+
event_emitter_proxy.off(event, callback)
|
|
800
807
|
end
|
|
801
808
|
|
|
802
809
|
# -- inherited from EventEmitter --
|
|
803
810
|
# @nodoc
|
|
804
|
-
def
|
|
805
|
-
event_emitter_proxy.
|
|
811
|
+
def once(event, callback)
|
|
812
|
+
event_emitter_proxy.once(event, callback)
|
|
806
813
|
end
|
|
807
814
|
|
|
808
815
|
# -- inherited from EventEmitter --
|
|
809
816
|
# @nodoc
|
|
810
|
-
def
|
|
811
|
-
event_emitter_proxy.
|
|
817
|
+
def on(event, callback)
|
|
818
|
+
event_emitter_proxy.on(event, callback)
|
|
812
819
|
end
|
|
813
820
|
|
|
814
821
|
private def event_emitter_proxy
|
|
@@ -90,20 +90,20 @@ module Playwright
|
|
|
90
90
|
|
|
91
91
|
# -- inherited from EventEmitter --
|
|
92
92
|
# @nodoc
|
|
93
|
-
def
|
|
94
|
-
event_emitter_proxy.
|
|
93
|
+
def off(event, callback)
|
|
94
|
+
event_emitter_proxy.off(event, callback)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
# -- inherited from EventEmitter --
|
|
98
98
|
# @nodoc
|
|
99
|
-
def
|
|
100
|
-
event_emitter_proxy.
|
|
99
|
+
def once(event, callback)
|
|
100
|
+
event_emitter_proxy.once(event, callback)
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
# -- inherited from EventEmitter --
|
|
104
104
|
# @nodoc
|
|
105
|
-
def
|
|
106
|
-
event_emitter_proxy.
|
|
105
|
+
def on(event, callback)
|
|
106
|
+
event_emitter_proxy.on(event, callback)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
private def event_emitter_proxy
|