playwright-ruby-client 1.22.0 → 1.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser.md +16 -0
- data/documentation/docs/api/browser_context.md +15 -2
- data/documentation/docs/api/browser_type.md +4 -0
- data/documentation/docs/api/element_handle.md +0 -5
- data/documentation/docs/api/experimental/android_device.md +4 -0
- data/documentation/docs/api/locator.md +13 -6
- data/documentation/docs/api/page.md +14 -1
- data/documentation/docs/api/request.md +3 -1
- data/documentation/docs/api/response.md +12 -1
- data/documentation/docs/api/route.md +65 -0
- data/documentation/docs/include/api_coverage.md +5 -3
- 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_serializer.rb +3 -4
- data/lib/playwright/javascript.rb +1 -0
- data/lib/playwright/locator_impl.rb +3 -5
- 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_device.rb +5 -1
- data/lib/playwright_api/browser.rb +15 -2
- data/lib/playwright_api/browser_context.rb +16 -6
- data/lib/playwright_api/browser_type.rb +5 -1
- data/lib/playwright_api/element_handle.rb +0 -11
- data/lib/playwright_api/locator.rb +11 -12
- data/lib/playwright_api/page.rb +16 -6
- data/lib/playwright_api/request.rb +8 -1
- data/lib/playwright_api/response.rb +14 -1
- data/lib/playwright_api/route.rb +61 -2
- data/lib/playwright_api/worker.rb +4 -4
- metadata +5 -4
- data/lib/playwright_api/local_utils.rb +0 -9
@@ -18,6 +18,11 @@ 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
|
#
|
@@ -82,19 +87,23 @@ module Playwright
|
|
82
87
|
offline: nil,
|
83
88
|
permissions: nil,
|
84
89
|
proxy: nil,
|
90
|
+
record_har_content: nil,
|
91
|
+
record_har_mode: nil,
|
85
92
|
record_har_omit_content: nil,
|
86
93
|
record_har_path: nil,
|
94
|
+
record_har_url_filter: nil,
|
87
95
|
record_video_dir: nil,
|
88
96
|
record_video_size: nil,
|
89
97
|
reducedMotion: nil,
|
90
98
|
screen: nil,
|
99
|
+
serviceWorkers: nil,
|
91
100
|
storageState: nil,
|
92
101
|
strictSelectors: nil,
|
93
102
|
timezoneId: nil,
|
94
103
|
userAgent: nil,
|
95
104
|
viewport: nil,
|
96
105
|
&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)))
|
106
|
+
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
107
|
end
|
99
108
|
|
100
109
|
# Creates a new page in a new browser context. Closing this page will close the context as well.
|
@@ -121,19 +130,23 @@ module Playwright
|
|
121
130
|
offline: nil,
|
122
131
|
permissions: nil,
|
123
132
|
proxy: nil,
|
133
|
+
record_har_content: nil,
|
134
|
+
record_har_mode: nil,
|
124
135
|
record_har_omit_content: nil,
|
125
136
|
record_har_path: nil,
|
137
|
+
record_har_url_filter: nil,
|
126
138
|
record_video_dir: nil,
|
127
139
|
record_video_size: nil,
|
128
140
|
reducedMotion: nil,
|
129
141
|
screen: nil,
|
142
|
+
serviceWorkers: nil,
|
130
143
|
storageState: nil,
|
131
144
|
strictSelectors: nil,
|
132
145
|
timezoneId: nil,
|
133
146
|
userAgent: nil,
|
134
147
|
viewport: nil,
|
135
148
|
&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)))
|
149
|
+
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
150
|
end
|
138
151
|
|
139
152
|
# > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
@@ -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.
|
@@ -372,13 +382,13 @@ module Playwright
|
|
372
382
|
end
|
373
383
|
|
374
384
|
# @nodoc
|
375
|
-
def
|
376
|
-
wrap_impl(@impl.
|
385
|
+
def pause
|
386
|
+
wrap_impl(@impl.pause)
|
377
387
|
end
|
378
388
|
|
379
389
|
# @nodoc
|
380
|
-
def
|
381
|
-
wrap_impl(@impl.
|
390
|
+
def options=(req)
|
391
|
+
wrap_impl(@impl.options=(unwrap_impl(req)))
|
382
392
|
end
|
383
393
|
|
384
394
|
# @nodoc
|
@@ -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'`.
|
@@ -394,17 +394,6 @@ module Playwright
|
|
394
394
|
# # multiple selection
|
395
395
|
# handle.select_option(value=["red", "green", "blue"])
|
396
396
|
# ```
|
397
|
-
#
|
398
|
-
# ```python sync
|
399
|
-
# # single selection matching the value
|
400
|
-
# handle.select_option("blue")
|
401
|
-
# # single selection matching both the value and the label
|
402
|
-
# handle.select_option(label="blue")
|
403
|
-
# # multiple selection
|
404
|
-
# handle.select_option("red", "green", "blue")
|
405
|
-
# # multiple selection for blue, red and second option
|
406
|
-
# handle.select_option(value="blue", { index: 2 }, "red")
|
407
|
-
# ```
|
408
397
|
def select_option(
|
409
398
|
element: nil,
|
410
399
|
index: nil,
|
@@ -224,7 +224,17 @@ module Playwright
|
|
224
224
|
wrap_impl(@impl.fill(unwrap_impl(value), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
225
225
|
end
|
226
226
|
|
227
|
-
# This method narrows existing locator according to the options, for example filters by text.
|
227
|
+
# This method narrows existing locator according to the options, for example filters by text. It can be chained to filter
|
228
|
+
# multiple times.
|
229
|
+
#
|
230
|
+
# ```python sync
|
231
|
+
# row_locator = page.lsocator("tr")
|
232
|
+
# # ...
|
233
|
+
# row_locator
|
234
|
+
# .filter(has_text="text in column 1")
|
235
|
+
# .filter(has=page.locator("tr", has_text="column 2 button"))
|
236
|
+
# .screenshot()
|
237
|
+
# ```
|
228
238
|
def filter(has: nil, hasText: nil)
|
229
239
|
wrap_impl(@impl.filter(has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
230
240
|
end
|
@@ -418,17 +428,6 @@ module Playwright
|
|
418
428
|
# # multiple selection
|
419
429
|
# element.select_option(value=["red", "green", "blue"])
|
420
430
|
# ```
|
421
|
-
#
|
422
|
-
# ```python sync
|
423
|
-
# # single selection matching the value
|
424
|
-
# element.select_option("blue")
|
425
|
-
# # single selection matching both the value and the label
|
426
|
-
# element.select_option(label="blue")
|
427
|
-
# # multiple selection
|
428
|
-
# element.select_option("red", "green", "blue")
|
429
|
-
# # multiple selection for blue, red and second option
|
430
|
-
# element.select_option(value="blue", { index: 2 }, "red")
|
431
|
-
# ```
|
432
431
|
def select_option(
|
433
432
|
element: nil,
|
434
433
|
index: nil,
|
data/lib/playwright_api/page.rb
CHANGED
@@ -853,7 +853,7 @@ module Playwright
|
|
853
853
|
# > NOTE: The handler will only be called for the first url if the response is a redirect.
|
854
854
|
# > NOTE: [`method: Page.route`] will not intercept requests intercepted by Service Worker. See
|
855
855
|
# [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
|
856
|
-
# request interception
|
856
|
+
# request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
|
857
857
|
#
|
858
858
|
# An example of a naive handler that aborts all image requests:
|
859
859
|
#
|
@@ -895,6 +895,16 @@ module Playwright
|
|
895
895
|
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler), times: unwrap_impl(times)))
|
896
896
|
end
|
897
897
|
|
898
|
+
# If specified the network requests that are made in the page will be served from the HAR file. Read more about
|
899
|
+
# [Replaying from HAR](../network.md#replaying-from-har).
|
900
|
+
#
|
901
|
+
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See
|
902
|
+
# [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
|
903
|
+
# request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
|
904
|
+
def route_from_har(har, notFound: nil, update: nil, url: nil)
|
905
|
+
wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), url: unwrap_impl(url)))
|
906
|
+
end
|
907
|
+
|
898
908
|
# Returns the buffer with the captured screenshot.
|
899
909
|
def screenshot(
|
900
910
|
animations: nil,
|
@@ -1404,6 +1414,11 @@ module Playwright
|
|
1404
1414
|
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1405
1415
|
end
|
1406
1416
|
|
1417
|
+
# @nodoc
|
1418
|
+
def guid
|
1419
|
+
wrap_impl(@impl.guid)
|
1420
|
+
end
|
1421
|
+
|
1407
1422
|
# @nodoc
|
1408
1423
|
def stop_js_coverage
|
1409
1424
|
wrap_impl(@impl.stop_js_coverage)
|
@@ -1419,11 +1434,6 @@ module Playwright
|
|
1419
1434
|
wrap_impl(@impl.stop_css_coverage)
|
1420
1435
|
end
|
1421
1436
|
|
1422
|
-
# @nodoc
|
1423
|
-
def guid
|
1424
|
-
wrap_impl(@impl.guid)
|
1425
|
-
end
|
1426
|
-
|
1427
1437
|
# -- inherited from EventEmitter --
|
1428
1438
|
# @nodoc
|
1429
1439
|
def off(event, callback)
|
@@ -35,7 +35,9 @@ module Playwright
|
|
35
35
|
wrap_impl(@impl.frame)
|
36
36
|
end
|
37
37
|
|
38
|
-
#
|
38
|
+
# An object with the request HTTP headers. The header names are lower-cased. Note that this method does not return
|
39
|
+
# security-related headers, including cookie-related ones. You can use [`method: Request.allHeaders`] for complete list of
|
40
|
+
# headers that include `cookie` information.
|
39
41
|
def headers
|
40
42
|
wrap_impl(@impl.headers)
|
41
43
|
end
|
@@ -149,6 +151,11 @@ module Playwright
|
|
149
151
|
wrap_impl(@impl.url)
|
150
152
|
end
|
151
153
|
|
154
|
+
# @nodoc
|
155
|
+
def apply_fallback_overrides(overrides)
|
156
|
+
wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
|
157
|
+
end
|
158
|
+
|
152
159
|
# @nodoc
|
153
160
|
def header_values(name)
|
154
161
|
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
@@ -22,7 +22,15 @@ module Playwright
|
|
22
22
|
wrap_impl(@impl.frame)
|
23
23
|
end
|
24
24
|
|
25
|
-
#
|
25
|
+
# Indicates whether this Response was fullfilled by a Service Worker's Fetch Handler (i.e. via
|
26
|
+
# [FetchEvent.respondWith](https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)).
|
27
|
+
def from_service_worker
|
28
|
+
wrap_impl(@impl.from_service_worker)
|
29
|
+
end
|
30
|
+
|
31
|
+
# An object with the response HTTP headers. The header names are lower-cased. Note that this method does not return
|
32
|
+
# security-related headers, including cookie-related ones. You can use [`method: Response.allHeaders`] for complete list
|
33
|
+
# of headers that include `cookie` information.
|
26
34
|
def headers
|
27
35
|
wrap_impl(@impl.headers)
|
28
36
|
end
|
@@ -92,6 +100,11 @@ module Playwright
|
|
92
100
|
wrap_impl(@impl.url)
|
93
101
|
end
|
94
102
|
|
103
|
+
# @nodoc
|
104
|
+
def from_service_worker?
|
105
|
+
wrap_impl(@impl.from_service_worker?)
|
106
|
+
end
|
107
|
+
|
95
108
|
# @nodoc
|
96
109
|
def ok?
|
97
110
|
wrap_impl(@impl.ok?)
|
data/lib/playwright_api/route.rb
CHANGED
@@ -17,8 +17,8 @@ module Playwright
|
|
17
17
|
# # override headers
|
18
18
|
# headers = {
|
19
19
|
# **request.headers,
|
20
|
-
# "foo": "
|
21
|
-
# "
|
20
|
+
# "foo": "foo-value" # set "foo" header
|
21
|
+
# "bar": None # remove "bar" header
|
22
22
|
# }
|
23
23
|
# route.continue_(headers=headers)
|
24
24
|
# }
|
@@ -28,6 +28,60 @@ module Playwright
|
|
28
28
|
wrap_impl(@impl.continue(headers: unwrap_impl(headers), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
|
29
29
|
end
|
30
30
|
|
31
|
+
# When several routes match the given pattern, they run in the order opposite to their registration. That way the last
|
32
|
+
# registered route can always override all the previos ones. In the example below, request will be handled by the
|
33
|
+
# bottom-most handler first, then it'll fall back to the previous one and in the end will be aborted by the first
|
34
|
+
# registered route.
|
35
|
+
#
|
36
|
+
# ```python sync
|
37
|
+
# page.route("**/*", lambda route: route.abort()) # Runs last.
|
38
|
+
# page.route("**/*", lambda route: route.fallback()) # Runs second.
|
39
|
+
# page.route("**/*", lambda route: route.fallback()) # Runs first.
|
40
|
+
# ```
|
41
|
+
#
|
42
|
+
# Registering multiple routes is useful when you want separate handlers to handle different kinds of requests, for example
|
43
|
+
# API calls vs page resources or GET requests vs POST requests as in the example below.
|
44
|
+
#
|
45
|
+
# ```python sync
|
46
|
+
# # Handle GET requests.
|
47
|
+
# def handle_post(route):
|
48
|
+
# if route.request.method != "GET":
|
49
|
+
# route.fallback()
|
50
|
+
# return
|
51
|
+
# # Handling GET only.
|
52
|
+
# # ...
|
53
|
+
#
|
54
|
+
# # Handle POST requests.
|
55
|
+
# def handle_post(route):
|
56
|
+
# if route.request.method != "POST":
|
57
|
+
# route.fallback()
|
58
|
+
# return
|
59
|
+
# # Handling POST only.
|
60
|
+
# # ...
|
61
|
+
#
|
62
|
+
# page.route("**/*", handle_get)
|
63
|
+
# page.route("**/*", handle_post)
|
64
|
+
# ```
|
65
|
+
#
|
66
|
+
# One can also modify request while falling back to the subsequent handler, that way intermediate route handler can modify
|
67
|
+
# url, method, headers and postData of the request.
|
68
|
+
#
|
69
|
+
# ```python sync
|
70
|
+
# def handle(route, request):
|
71
|
+
# # override headers
|
72
|
+
# headers = {
|
73
|
+
# **request.headers,
|
74
|
+
# "foo": "foo-value" # set "foo" header
|
75
|
+
# "bar": None # remove "bar" header
|
76
|
+
# }
|
77
|
+
# route.fallback(headers=headers)
|
78
|
+
# }
|
79
|
+
# page.route("**/*", handle)
|
80
|
+
# ```
|
81
|
+
def fallback(headers: nil, method: nil, postData: nil, url: nil)
|
82
|
+
wrap_impl(@impl.fallback(headers: unwrap_impl(headers), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
|
83
|
+
end
|
84
|
+
|
31
85
|
# Fulfills route's request with given response.
|
32
86
|
#
|
33
87
|
# An example of fulfilling all requests with 404 responses:
|
@@ -59,6 +113,11 @@ module Playwright
|
|
59
113
|
wrap_impl(@impl.request)
|
60
114
|
end
|
61
115
|
|
116
|
+
# @nodoc
|
117
|
+
def redirect_navigation_request(url)
|
118
|
+
wrap_impl(@impl.redirect_navigation_request(unwrap_impl(url)))
|
119
|
+
end
|
120
|
+
|
62
121
|
# -- inherited from EventEmitter --
|
63
122
|
# @nodoc
|
64
123
|
def off(event, callback)
|
@@ -44,13 +44,13 @@ module Playwright
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# @nodoc
|
47
|
-
def
|
48
|
-
wrap_impl(@impl.
|
47
|
+
def context=(req)
|
48
|
+
wrap_impl(@impl.context=(unwrap_impl(req)))
|
49
49
|
end
|
50
50
|
|
51
51
|
# @nodoc
|
52
|
-
def
|
53
|
-
wrap_impl(@impl.
|
52
|
+
def page=(req)
|
53
|
+
wrap_impl(@impl.page=(unwrap_impl(req)))
|
54
54
|
end
|
55
55
|
|
56
56
|
# -- inherited from EventEmitter --
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playwright-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -316,10 +316,12 @@ files:
|
|
316
316
|
- lib/playwright/events.rb
|
317
317
|
- lib/playwright/file_chooser_impl.rb
|
318
318
|
- lib/playwright/frame_locator_impl.rb
|
319
|
+
- lib/playwright/har_router.rb
|
319
320
|
- lib/playwright/http_headers.rb
|
320
321
|
- lib/playwright/input_files.rb
|
321
322
|
- lib/playwright/javascript.rb
|
322
323
|
- lib/playwright/javascript/expression.rb
|
324
|
+
- lib/playwright/javascript/regex.rb
|
323
325
|
- lib/playwright/javascript/value_parser.rb
|
324
326
|
- lib/playwright/javascript/value_serializer.rb
|
325
327
|
- lib/playwright/javascript/visitor_info.rb
|
@@ -362,7 +364,6 @@ files:
|
|
362
364
|
- lib/playwright_api/frame_locator.rb
|
363
365
|
- lib/playwright_api/js_handle.rb
|
364
366
|
- lib/playwright_api/keyboard.rb
|
365
|
-
- lib/playwright_api/local_utils.rb
|
366
367
|
- lib/playwright_api/locator.rb
|
367
368
|
- lib/playwright_api/mouse.rb
|
368
369
|
- lib/playwright_api/page.rb
|
@@ -398,5 +399,5 @@ requirements: []
|
|
398
399
|
rubygems_version: 3.3.7
|
399
400
|
signing_key:
|
400
401
|
specification_version: 4
|
401
|
-
summary: The Ruby binding of playwright driver 1.
|
402
|
+
summary: The Ruby binding of playwright driver 1.23.4
|
402
403
|
test_files: []
|