playwright-ruby-client 1.41.2 → 1.42.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_context.md +8 -10
- data/documentation/docs/api/element_handle.md +1 -1
- data/documentation/docs/api/experimental/android.md +0 -6
- data/documentation/docs/api/frame.md +1 -1
- data/documentation/docs/api/keyboard.md +1 -1
- data/documentation/docs/api/locator.md +1 -1
- data/documentation/docs/api/page.md +11 -11
- data/documentation/docs/include/api_coverage.md +1 -0
- data/lib/playwright/channel_owners/browser_context.rb +1 -1
- data/lib/playwright/channel_owners/frame.rb +1 -1
- data/lib/playwright/channel_owners/page.rb +6 -2
- data/lib/playwright/har_router.rb +7 -0
- data/lib/playwright/javascript/source_url.rb +16 -0
- data/lib/playwright/javascript.rb +1 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/waiter.rb +6 -4
- data/lib/playwright_api/android.rb +0 -6
- data/lib/playwright_api/browser_context.rb +1 -1
- data/lib/playwright_api/element_handle.rb +1 -1
- data/lib/playwright_api/frame.rb +1 -1
- data/lib/playwright_api/keyboard.rb +1 -1
- data/lib/playwright_api/locator.rb +1 -1
- data/lib/playwright_api/page.rb +70 -7
- data/lib/playwright_api/request.rb +4 -4
- data/lib/playwright_api/response.rb +4 -4
- data/sig/playwright.rbs +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f0696ad7f67f87dee8a131a434be9889cb7b03ba2b95ca3328eec1b1b6676ac
|
4
|
+
data.tar.gz: 6011f12c7a4afe3fba9685163f4e65d110f7cb71acfe01db680628bd6d97e991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7e789935f337f334a98a29b777e2d48bdc7cef02ec3594a0128ab388962b934d4dfd322c48b344aee25f9d6a16da2919b652635456163a64744d85d9c705a7
|
7
|
+
data.tar.gz: 6cacbb799e67cd76684b9041fec310013d30a97a85668b8fa5041b868f7e3d879a922f684037e5cd7e42d6bbb85a7f5ef265b9d9d8d9b9f2b0cb7871459a8646
|
@@ -311,16 +311,14 @@ page.goto("https://example.com")
|
|
311
311
|
|
312
312
|
It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
|
313
313
|
|
314
|
-
```
|
315
|
-
def handle_route(route
|
316
|
-
if
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
end
|
323
|
-
context.route("/api/**", method(:handle_route))
|
314
|
+
```python sync title=example_c78483d1434363f907c28aecef3a1c6d83c0136d98bb07c2bd326cd19e006aa9.py
|
315
|
+
def handle_route(route: Route):
|
316
|
+
if ("my-string" in route.request.post_data):
|
317
|
+
route.fulfill(body="mocked-data")
|
318
|
+
else:
|
319
|
+
route.continue_()
|
320
|
+
context.route("/api/**", handle_route)
|
321
|
+
|
324
322
|
```
|
325
323
|
|
326
324
|
Page routes (set up with [Page#route](./page#route)) take precedence over browser context routes when request matches both
|
@@ -423,7 +423,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
|
|
423
423
|
If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
424
424
|
respective texts.
|
425
425
|
|
426
|
-
Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
426
|
+
Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
427
427
|
modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
428
428
|
|
429
429
|
## query_selector
|
@@ -22,12 +22,6 @@ Playwright has **experimental** support for Android automation. This includes Ch
|
|
22
22
|
|
23
23
|
An example of the Android automation script would be:
|
24
24
|
|
25
|
-
Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:
|
26
|
-
|
27
|
-
```bash js
|
28
|
-
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
|
29
|
-
```
|
30
|
-
|
31
25
|
## devices
|
32
26
|
|
33
27
|
```
|
@@ -857,7 +857,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
|
|
857
857
|
If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
858
858
|
respective texts.
|
859
859
|
|
860
|
-
Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
860
|
+
Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
861
861
|
modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
862
862
|
|
863
863
|
## query_selector
|
@@ -114,7 +114,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
|
|
114
114
|
If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
115
115
|
respective texts.
|
116
116
|
|
117
|
-
Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
117
|
+
Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
118
118
|
modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
119
119
|
|
120
120
|
**Usage**
|
@@ -1056,7 +1056,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
|
|
1056
1056
|
If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
1057
1057
|
respective texts.
|
1058
1058
|
|
1059
|
-
Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
1059
|
+
Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
1060
1060
|
modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
1061
1061
|
|
1062
1062
|
## press_sequentially
|
@@ -1077,11 +1077,13 @@ def pdf(
|
|
1077
1077
|
height: nil,
|
1078
1078
|
landscape: nil,
|
1079
1079
|
margin: nil,
|
1080
|
+
outline: nil,
|
1080
1081
|
pageRanges: nil,
|
1081
1082
|
path: nil,
|
1082
1083
|
preferCSSPageSize: nil,
|
1083
1084
|
printBackground: nil,
|
1084
1085
|
scale: nil,
|
1086
|
+
tagged: nil,
|
1085
1087
|
width: nil)
|
1086
1088
|
```
|
1087
1089
|
|
@@ -1165,7 +1167,7 @@ Holding down `Shift` will type the text that corresponds to the `key` in the upp
|
|
1165
1167
|
If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
1166
1168
|
respective texts.
|
1167
1169
|
|
1168
|
-
Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
1170
|
+
Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
1169
1171
|
modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
1170
1172
|
|
1171
1173
|
**Usage**
|
@@ -1244,16 +1246,14 @@ page.goto("https://example.com")
|
|
1244
1246
|
|
1245
1247
|
It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
|
1246
1248
|
|
1247
|
-
```
|
1248
|
-
def handle_route(route
|
1249
|
-
if
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
end
|
1256
|
-
page.route("/api/**", method(:handle_route))
|
1249
|
+
```python sync title=example_0ef62eead1348f28a69716a047f3b75c979d3230569d3720d4e7bdd0a22ef647.py
|
1250
|
+
def handle_route(route: Route):
|
1251
|
+
if ("my-string" in route.request.post_data):
|
1252
|
+
route.fulfill(body="mocked-data")
|
1253
|
+
else:
|
1254
|
+
route.continue_()
|
1255
|
+
page.route("/api/**", handle_route)
|
1256
|
+
|
1257
1257
|
```
|
1258
1258
|
|
1259
1259
|
Page routes take precedence over browser context routes (set up with [BrowserContext#route](./browser_context#route)) when request
|
@@ -300,7 +300,7 @@ module Playwright
|
|
300
300
|
url: url,
|
301
301
|
}.compact
|
302
302
|
if path
|
303
|
-
params[:content] =
|
303
|
+
params[:content] = JavaScript::SourceUrl.new(File.read(path), path).to_s
|
304
304
|
end
|
305
305
|
resp = @channel.send_message_to_server('addScriptTag', params)
|
306
306
|
ChannelOwners::ElementHandle.from(resp)
|
@@ -397,7 +397,7 @@ module Playwright
|
|
397
397
|
def add_init_script(path: nil, script: nil)
|
398
398
|
source =
|
399
399
|
if path
|
400
|
-
File.read(path)
|
400
|
+
JavaScript::SourceUrl.new(File.read(path), path).to_s
|
401
401
|
elsif script
|
402
402
|
script
|
403
403
|
else
|
@@ -836,7 +836,9 @@ module Playwright
|
|
836
836
|
preferCSSPageSize: nil,
|
837
837
|
printBackground: nil,
|
838
838
|
scale: nil,
|
839
|
-
width: nil
|
839
|
+
width: nil,
|
840
|
+
tagged: nil,
|
841
|
+
outline: nil)
|
840
842
|
|
841
843
|
params = {
|
842
844
|
displayHeaderFooter: displayHeaderFooter,
|
@@ -851,6 +853,8 @@ module Playwright
|
|
851
853
|
printBackground: printBackground,
|
852
854
|
scale: scale,
|
853
855
|
width: width,
|
856
|
+
tagged: tagged,
|
857
|
+
outline: outline,
|
854
858
|
}.compact
|
855
859
|
encoded_binary = @channel.send_message_to_server('pdf', params)
|
856
860
|
decoded_binary = Base64.strict_decode64(encoded_binary)
|
@@ -46,6 +46,13 @@ module Playwright
|
|
46
46
|
puts "pw:api HAR: #{request.url} redirected to #{redirect_url}" if @debug
|
47
47
|
route.redirect_navigation_request(redirect_url)
|
48
48
|
when 'fulfill'
|
49
|
+
# If the response status is -1, the request was canceled or stalled, so we just stall it here.
|
50
|
+
# See https://github.com/microsoft/playwright/issues/29311.
|
51
|
+
# TODO: it'd be better to abort such requests, but then we likely need to respect the timing,
|
52
|
+
# because the request might have been stalled for a long time until the very end of the
|
53
|
+
# test when HAR was recorded but we'd abort it immediately.
|
54
|
+
return if response['status'] == -1
|
55
|
+
|
49
56
|
route.fulfill(
|
50
57
|
status: response['status'],
|
51
58
|
headers: response['headers'].map { |header| [header['name'], header['value']] }.to_h,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Playwright
|
2
|
+
module JavaScript
|
3
|
+
class SourceUrl
|
4
|
+
# @param source [String]
|
5
|
+
# @param path [String]
|
6
|
+
def initialize(source, path)
|
7
|
+
@source = source
|
8
|
+
@source_url = path.to_s.gsub("\n", '')
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
"#{@source}\n//# sourceURL=#{@source_url}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/playwright/version.rb
CHANGED
data/lib/playwright/waiter.rb
CHANGED
@@ -81,17 +81,19 @@ module Playwright
|
|
81
81
|
|
82
82
|
private def fulfill(result)
|
83
83
|
cleanup
|
84
|
-
|
85
|
-
|
84
|
+
unless @result.resolved?
|
85
|
+
@result.fulfill(result)
|
86
|
+
end
|
86
87
|
wait_for_event_info_after
|
87
88
|
end
|
88
89
|
|
89
90
|
private def reject(error)
|
90
91
|
cleanup
|
91
|
-
return if @result.resolved?
|
92
92
|
klass = error.is_a?(TimeoutError) ? TimeoutError : Error
|
93
93
|
ex = klass.new(message: "#{error.message}#{format_log_recording(@logs)}")
|
94
|
-
@result.
|
94
|
+
unless @result.resolved?
|
95
|
+
@result.reject(ex)
|
96
|
+
end
|
95
97
|
wait_for_event_info_after(error: ex)
|
96
98
|
end
|
97
99
|
|
@@ -16,12 +16,6 @@ module Playwright
|
|
16
16
|
# *How to run*
|
17
17
|
#
|
18
18
|
# An example of the Android automation script would be:
|
19
|
-
#
|
20
|
-
# Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:
|
21
|
-
#
|
22
|
-
# ```bash js
|
23
|
-
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
|
24
|
-
# ```
|
25
19
|
class Android < PlaywrightApi
|
26
20
|
|
27
21
|
#
|
@@ -280,7 +280,7 @@ module Playwright
|
|
280
280
|
# It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
|
281
281
|
#
|
282
282
|
# ```python sync
|
283
|
-
# def handle_route(route):
|
283
|
+
# def handle_route(route: Route):
|
284
284
|
# if ("my-string" in route.request.post_data):
|
285
285
|
# route.fulfill(body="mocked-data")
|
286
286
|
# else:
|
@@ -346,7 +346,7 @@ module Playwright
|
|
346
346
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
347
347
|
# respective texts.
|
348
348
|
#
|
349
|
-
# Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
349
|
+
# Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
350
350
|
# modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
351
351
|
def press(key, delay: nil, noWaitAfter: nil, timeout: nil)
|
352
352
|
wrap_impl(@impl.press(unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -714,7 +714,7 @@ module Playwright
|
|
714
714
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
715
715
|
# respective texts.
|
716
716
|
#
|
717
|
-
# Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
717
|
+
# Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
718
718
|
# modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
719
719
|
def press(
|
720
720
|
selector,
|
@@ -99,7 +99,7 @@ module Playwright
|
|
99
99
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
100
100
|
# respective texts.
|
101
101
|
#
|
102
|
-
# Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
102
|
+
# Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
103
103
|
# modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
104
104
|
#
|
105
105
|
# **Usage**
|
@@ -890,7 +890,7 @@ module Playwright
|
|
890
890
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
891
891
|
# respective texts.
|
892
892
|
#
|
893
|
-
# Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
893
|
+
# Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
894
894
|
# modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
895
895
|
def press(key, delay: nil, noWaitAfter: nil, timeout: nil)
|
896
896
|
wrap_impl(@impl.press(unwrap_impl(key), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
data/lib/playwright_api/page.rb
CHANGED
@@ -1010,13 +1010,15 @@ module Playwright
|
|
1010
1010
|
height: nil,
|
1011
1011
|
landscape: nil,
|
1012
1012
|
margin: nil,
|
1013
|
+
outline: nil,
|
1013
1014
|
pageRanges: nil,
|
1014
1015
|
path: nil,
|
1015
1016
|
preferCSSPageSize: nil,
|
1016
1017
|
printBackground: nil,
|
1017
1018
|
scale: nil,
|
1019
|
+
tagged: nil,
|
1018
1020
|
width: nil)
|
1019
|
-
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), pageRanges: unwrap_impl(pageRanges), path: unwrap_impl(path), preferCSSPageSize: unwrap_impl(preferCSSPageSize), printBackground: unwrap_impl(printBackground), scale: unwrap_impl(scale), width: unwrap_impl(width)))
|
1021
|
+
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)))
|
1020
1022
|
end
|
1021
1023
|
|
1022
1024
|
#
|
@@ -1037,7 +1039,7 @@ module Playwright
|
|
1037
1039
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different
|
1038
1040
|
# respective texts.
|
1039
1041
|
#
|
1040
|
-
# Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
1042
|
+
# Shortcuts such as `key: "Control+o"`, `key: "Control++` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
1041
1043
|
# modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
1042
1044
|
#
|
1043
1045
|
# **Usage**
|
@@ -1077,6 +1079,67 @@ module Playwright
|
|
1077
1079
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
1078
1080
|
end
|
1079
1081
|
|
1082
|
+
#
|
1083
|
+
# Sometimes, the web page can show an overlay that obstructs elements behind it and prevents certain actions, like click, from completing. When such an overlay is shown predictably, we recommend dismissing it as a part of your test flow. However, sometimes such an overlay may appear non-deterministically, for example certain cookies consent dialogs behave this way. In this case, [`method: Page.addLocatorHandler`] allows handling an overlay during an action that it would block.
|
1084
|
+
#
|
1085
|
+
# This method registers a handler for an overlay that is executed once the locator is visible on the page. The handler should get rid of the overlay so that actions blocked by it can proceed. This is useful for nondeterministic interstitial pages or dialogs, like a cookie consent dialog.
|
1086
|
+
#
|
1087
|
+
# Note that execution time of the handler counts towards the timeout of the action/assertion that executed the handler.
|
1088
|
+
#
|
1089
|
+
# You can register multiple handlers. However, only a single handler will be running at a time. Any actions inside a handler must not require another handler to run.
|
1090
|
+
#
|
1091
|
+
# **NOTE**: Running the interceptor will alter your page state mid-test. For example it will change the currently focused element and move the mouse. Make sure that the actions that run after the interceptor are self-contained and do not rely on the focus and mouse state.
|
1092
|
+
# <br />
|
1093
|
+
# <br />
|
1094
|
+
# For example, consider a test that calls [`method: Locator.focus`] followed by [`method: Keyboard.press`]. If your handler clicks a button between these two actions, the focused element most likely will be wrong, and key press will happen on the unexpected element. Use [`method: Locator.press`] instead to avoid this problem.
|
1095
|
+
# <br />
|
1096
|
+
# <br />
|
1097
|
+
# Another example is a series of mouse actions, where [`method: Mouse.move`] is followed by [`method: Mouse.down`]. Again, when the handler runs between these two actions, the mouse position will be wrong during the mouse down. Prefer methods like [`method: Locator.click`] that are self-contained.
|
1098
|
+
#
|
1099
|
+
# **Usage**
|
1100
|
+
#
|
1101
|
+
# An example that closes a cookie dialog when it appears:
|
1102
|
+
#
|
1103
|
+
# ```python sync
|
1104
|
+
# # Setup the handler.
|
1105
|
+
# def handler():
|
1106
|
+
# page.get_by_role("button", name="Reject all cookies").click()
|
1107
|
+
# page.add_locator_handler(page.get_by_role("button", name="Accept all cookies"), handler)
|
1108
|
+
#
|
1109
|
+
# # Write the test as usual.
|
1110
|
+
# page.goto("https://example.com")
|
1111
|
+
# page.get_by_role("button", name="Start here").click()
|
1112
|
+
# ```
|
1113
|
+
#
|
1114
|
+
# An example that skips the "Confirm your security details" page when it is shown:
|
1115
|
+
#
|
1116
|
+
# ```python sync
|
1117
|
+
# # Setup the handler.
|
1118
|
+
# def handler():
|
1119
|
+
# page.get_by_role("button", name="Remind me later").click()
|
1120
|
+
# page.add_locator_handler(page.get_by_text("Confirm your security details"), handler)
|
1121
|
+
#
|
1122
|
+
# # Write the test as usual.
|
1123
|
+
# page.goto("https://example.com")
|
1124
|
+
# page.get_by_role("button", name="Start here").click()
|
1125
|
+
# ```
|
1126
|
+
#
|
1127
|
+
# An example with a custom callback on every actionability check. It uses a `<body>` locator that is always visible, so the handler is called before every actionability check:
|
1128
|
+
#
|
1129
|
+
# ```python sync
|
1130
|
+
# # Setup the handler.
|
1131
|
+
# def handler():
|
1132
|
+
# page.evaluate("window.removeObstructionsForTestIfNeeded()")
|
1133
|
+
# page.add_locator_handler(page.locator("body"), handler)
|
1134
|
+
#
|
1135
|
+
# # Write the test as usual.
|
1136
|
+
# page.goto("https://example.com")
|
1137
|
+
# page.get_by_role("button", name="Start here").click()
|
1138
|
+
# ```
|
1139
|
+
def add_locator_handler(locator, handler)
|
1140
|
+
raise NotImplementedError.new('add_locator_handler is not implemented yet.')
|
1141
|
+
end
|
1142
|
+
|
1080
1143
|
#
|
1081
1144
|
# This method reloads the current page, in the same way as if the user had triggered a browser refresh.
|
1082
1145
|
# Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
|
@@ -1117,7 +1180,7 @@ module Playwright
|
|
1117
1180
|
# It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
|
1118
1181
|
#
|
1119
1182
|
# ```python sync
|
1120
|
-
# def handle_route(route):
|
1183
|
+
# def handle_route(route: Route):
|
1121
1184
|
# if ("my-string" in route.request.post_data):
|
1122
1185
|
# route.fulfill(body="mocked-data")
|
1123
1186
|
# else:
|
@@ -1686,13 +1749,13 @@ module Playwright
|
|
1686
1749
|
end
|
1687
1750
|
|
1688
1751
|
# @nodoc
|
1689
|
-
def
|
1690
|
-
wrap_impl(@impl.
|
1752
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1753
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1691
1754
|
end
|
1692
1755
|
|
1693
1756
|
# @nodoc
|
1694
|
-
def
|
1695
|
-
wrap_impl(@impl.
|
1757
|
+
def stop_css_coverage
|
1758
|
+
wrap_impl(@impl.stop_css_coverage)
|
1696
1759
|
end
|
1697
1760
|
|
1698
1761
|
# @nodoc
|
@@ -196,13 +196,13 @@ module Playwright
|
|
196
196
|
end
|
197
197
|
|
198
198
|
# @nodoc
|
199
|
-
def
|
200
|
-
wrap_impl(@impl.
|
199
|
+
def apply_fallback_overrides(overrides)
|
200
|
+
wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
|
201
201
|
end
|
202
202
|
|
203
203
|
# @nodoc
|
204
|
-
def
|
205
|
-
wrap_impl(@impl.
|
204
|
+
def header_values(name)
|
205
|
+
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
206
206
|
end
|
207
207
|
|
208
208
|
# -- inherited from EventEmitter --
|
@@ -118,13 +118,13 @@ module Playwright
|
|
118
118
|
end
|
119
119
|
|
120
120
|
# @nodoc
|
121
|
-
def
|
122
|
-
wrap_impl(@impl.
|
121
|
+
def from_service_worker?
|
122
|
+
wrap_impl(@impl.from_service_worker?)
|
123
123
|
end
|
124
124
|
|
125
125
|
# @nodoc
|
126
|
-
def
|
127
|
-
wrap_impl(@impl.
|
126
|
+
def ok?
|
127
|
+
wrap_impl(@impl.ok?)
|
128
128
|
end
|
129
129
|
|
130
130
|
# -- inherited from EventEmitter --
|
data/sig/playwright.rbs
CHANGED
@@ -299,7 +299,7 @@ module Playwright
|
|
299
299
|
def main_frame: -> Frame
|
300
300
|
def opener: -> (nil | Page)
|
301
301
|
def pause: -> void
|
302
|
-
def pdf: (?displayHeaderFooter: bool, ?footerTemplate: String, ?format: String, ?headerTemplate: String, ?height: (String | Float), ?landscape: bool, ?margin: Hash[untyped, untyped], ?pageRanges: String, ?path: (String | File), ?preferCSSPageSize: bool, ?printBackground: bool, ?scale: Float, ?width: (String | Float)) -> String
|
302
|
+
def pdf: (?displayHeaderFooter: bool, ?footerTemplate: String, ?format: String, ?headerTemplate: String, ?height: (String | Float), ?landscape: bool, ?margin: Hash[untyped, untyped], ?outline: bool, ?pageRanges: String, ?path: (String | File), ?preferCSSPageSize: bool, ?printBackground: bool, ?scale: Float, ?tagged: bool, ?width: (String | Float)) -> String
|
303
303
|
def press: (String selector, String key, ?delay: Float, ?noWaitAfter: bool, ?strict: bool, ?timeout: Float) -> void
|
304
304
|
def query_selector: (String selector, ?strict: bool) -> (nil | ElementHandle)
|
305
305
|
def query_selector_all: (String selector) -> Array[untyped]
|
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.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -324,6 +324,7 @@ files:
|
|
324
324
|
- lib/playwright/javascript.rb
|
325
325
|
- lib/playwright/javascript/expression.rb
|
326
326
|
- lib/playwright/javascript/regex.rb
|
327
|
+
- lib/playwright/javascript/source_url.rb
|
327
328
|
- lib/playwright/javascript/value_parser.rb
|
328
329
|
- lib/playwright/javascript/value_serializer.rb
|
329
330
|
- lib/playwright/javascript/visitor_info.rb
|
@@ -406,5 +407,5 @@ requirements: []
|
|
406
407
|
rubygems_version: 3.3.26
|
407
408
|
signing_key:
|
408
409
|
specification_version: 4
|
409
|
-
summary: The Ruby binding of playwright driver 1.
|
410
|
+
summary: The Ruby binding of playwright driver 1.42.0
|
410
411
|
test_files: []
|