playwright-ruby-client 1.47.0 → 1.48.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/accessibility.md +6 -0
- data/documentation/docs/api/api_request_context.md +1 -1
- data/documentation/docs/api/browser_context.md +2 -2
- data/documentation/docs/api/element_handle.md +6 -0
- data/documentation/docs/api/frame.md +12 -0
- data/documentation/docs/api/frame_locator.md +23 -5
- data/documentation/docs/api/locator.md +9 -1
- data/documentation/docs/api/page.md +15 -4
- data/documentation/docs/include/api_coverage.md +3 -0
- data/lib/playwright/test.rb +15 -9
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/accessibility.rb +2 -0
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +6 -6
- data/lib/playwright_api/api_request_context.rb +7 -7
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +34 -8
- data/lib/playwright_api/browser_type.rb +6 -6
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +8 -6
- data/lib/playwright_api/frame.rb +10 -6
- data/lib/playwright_api/frame_locator.rb +11 -5
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +5 -1
- data/lib/playwright_api/page.rb +55 -14
- data/lib/playwright_api/playwright.rb +8 -8
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/tracing.rb +6 -6
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2395db25eb38153f747d215212bc8256364e3b705a1aa674e486e25b75e19f2
|
4
|
+
data.tar.gz: b253eb7836baa12a6a9caebc9a3a96d982d49063324631a4cba6a8fa9a2eaaca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e323743b057fbd6c736e78a1c74d9a7f728a998c3f94771b62a58ddd2c203541f0376cd53947e644232f2614d328d9c09165823a0676b5a0a95778afa72eb044
|
7
|
+
data.tar.gz: 67367108051427ecd042eac7d241b5452ccd8b53ee69644eec6700e1b12e1b2899712e88d94808f387d10eeb2dc5512e44d92ea4cfc5b09d5fd6947193c82e19
|
@@ -25,6 +25,12 @@ assistive technologies themselves. By default, Playwright tries to approximate t
|
|
25
25
|
def snapshot(interestingOnly: nil, root: nil)
|
26
26
|
```
|
27
27
|
|
28
|
+
:::warning
|
29
|
+
|
30
|
+
This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
|
31
|
+
|
32
|
+
:::
|
33
|
+
|
28
34
|
|
29
35
|
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
|
30
36
|
page.
|
@@ -122,7 +122,7 @@ data = {
|
|
122
122
|
api_request_context.fetch("https://example.com/api/create_book", method: 'post', data: data)
|
123
123
|
```
|
124
124
|
|
125
|
-
The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding
|
125
|
+
The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding, by specifiying the `multipart` parameter:
|
126
126
|
|
127
127
|
```ruby
|
128
128
|
api_request_context.fetch(
|
@@ -273,7 +273,7 @@ def route(url, handler, times: nil)
|
|
273
273
|
Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
|
274
274
|
is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
275
275
|
|
276
|
-
**NOTE**: [BrowserContext#route](./browser_context#route) will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
276
|
+
**NOTE**: [BrowserContext#route](./browser_context#route) will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
277
277
|
|
278
278
|
**Usage**
|
279
279
|
|
@@ -331,7 +331,7 @@ def route_from_har(
|
|
331
331
|
|
332
332
|
If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](https://playwright.dev/python/docs/mock#replaying-from-har).
|
333
333
|
|
334
|
-
Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
334
|
+
Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
335
335
|
|
336
336
|
## service_workers
|
337
337
|
|
@@ -609,6 +609,12 @@ Returns the `node.textContent`.
|
|
609
609
|
def type(text, delay: nil, noWaitAfter: nil, timeout: nil)
|
610
610
|
```
|
611
611
|
|
612
|
+
:::warning
|
613
|
+
|
614
|
+
In most cases, you should use [Locator#fill](./locator#fill) instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [Locator#press_sequentially](./locator#press_sequentially).
|
615
|
+
|
616
|
+
:::
|
617
|
+
|
612
618
|
|
613
619
|
Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
|
614
620
|
|
@@ -1032,6 +1032,12 @@ def type(
|
|
1032
1032
|
timeout: nil)
|
1033
1033
|
```
|
1034
1034
|
|
1035
|
+
:::warning
|
1036
|
+
|
1037
|
+
In most cases, you should use [Locator#fill](./locator#fill) instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [Locator#press_sequentially](./locator#press_sequentially).
|
1038
|
+
|
1039
|
+
:::
|
1040
|
+
|
1035
1041
|
|
1036
1042
|
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to
|
1037
1043
|
send fine-grained keyboard events. To fill values in form fields, use [Frame#fill](./frame#fill).
|
@@ -1126,6 +1132,12 @@ frame.wait_for_load_state # the promise resolves after "load" event.
|
|
1126
1132
|
def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
|
1127
1133
|
```
|
1128
1134
|
|
1135
|
+
:::warning
|
1136
|
+
|
1137
|
+
This method is inherently racy, please use [Frame#wait_for_url](./frame#wait_for_url) instead.
|
1138
|
+
|
1139
|
+
:::
|
1140
|
+
|
1129
1141
|
|
1130
1142
|
Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation
|
1131
1143
|
will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to
|
@@ -5,10 +5,10 @@ sidebar_position: 10
|
|
5
5
|
# FrameLocator
|
6
6
|
|
7
7
|
|
8
|
-
FrameLocator represents a view to the `iframe` on the page. It captures the logic sufficient to retrieve the `iframe` and locate elements in that iframe. FrameLocator can be created with either [Page#frame_locator](./page#frame_locator) or [Locator#frame_locator](./locator#frame_locator) method.
|
8
|
+
FrameLocator represents a view to the `iframe` on the page. It captures the logic sufficient to retrieve the `iframe` and locate elements in that iframe. FrameLocator can be created with either [Locator#content_frame](./locator#content_frame), [Page#frame_locator](./page#frame_locator) or [Locator#frame_locator](./locator#frame_locator) method.
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
locator = page.
|
11
|
+
locator = page.locator("my-frame").content_frame.get_by_text("Submit")
|
12
12
|
locator.click
|
13
13
|
```
|
14
14
|
|
@@ -18,10 +18,10 @@ Frame locators are strict. This means that all operations on frame locators will
|
|
18
18
|
|
19
19
|
```ruby
|
20
20
|
# Throws if there are several frames in DOM:
|
21
|
-
page.
|
21
|
+
page.locator('.result-frame').content_frame.get_by_role('button').click
|
22
22
|
|
23
23
|
# Works because we explicitly tell locator to pick the first frame:
|
24
|
-
page.
|
24
|
+
page.locator('.result-frame').first.content_frame.get_by_role('button').click
|
25
25
|
```
|
26
26
|
|
27
27
|
**Converting Locator to FrameLocator**
|
@@ -38,6 +38,12 @@ If you have a [FrameLocator](./frame_locator) object it can be converted to [Loc
|
|
38
38
|
def first
|
39
39
|
```
|
40
40
|
|
41
|
+
:::warning
|
42
|
+
|
43
|
+
Use [Locator#first](./locator#first) followed by [Locator#content_frame](./locator#content_frame) instead.
|
44
|
+
|
45
|
+
:::
|
46
|
+
|
41
47
|
|
42
48
|
Returns locator to the first matching frame.
|
43
49
|
|
@@ -278,6 +284,12 @@ page.get_by_title("Issues count").text_content # => "25 issues"
|
|
278
284
|
def last
|
279
285
|
```
|
280
286
|
|
287
|
+
:::warning
|
288
|
+
|
289
|
+
Use [Locator#last](./locator#last) followed by [Locator#content_frame](./locator#content_frame) instead.
|
290
|
+
|
291
|
+
:::
|
292
|
+
|
281
293
|
|
282
294
|
Returns locator to the last matching frame.
|
283
295
|
|
@@ -303,6 +315,12 @@ The method finds an element matching the specified selector in the locator's sub
|
|
303
315
|
def nth(index)
|
304
316
|
```
|
305
317
|
|
318
|
+
:::warning
|
319
|
+
|
320
|
+
Use [Locator#nth](./locator#nth) followed by [Locator#content_frame](./locator#content_frame) instead.
|
321
|
+
|
322
|
+
:::
|
323
|
+
|
306
324
|
|
307
325
|
Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
|
308
326
|
|
@@ -322,7 +340,7 @@ For a reverse operation, use [Locator#content_frame](./locator#content_frame).
|
|
322
340
|
**Usage**
|
323
341
|
|
324
342
|
```ruby
|
325
|
-
frame_locator = page.
|
343
|
+
frame_locator = page.locator('iframe[name="embedded"]').content_frame
|
326
344
|
# ...
|
327
345
|
locator = frame_locator.owner
|
328
346
|
locator.get_attribute('src') # => frame1.html
|
@@ -1016,7 +1016,9 @@ def or(locator)
|
|
1016
1016
|
```
|
1017
1017
|
|
1018
1018
|
|
1019
|
-
Creates a locator that
|
1019
|
+
Creates a locator matching all elements that match one or both of the two locators.
|
1020
|
+
|
1021
|
+
Note that when both locators match something, the resulting locator will have multiple matches and violate [locator strictness](https://playwright.dev/python/docs/locators#strictness) guidelines.
|
1020
1022
|
|
1021
1023
|
**Usage**
|
1022
1024
|
|
@@ -1335,6 +1337,12 @@ Returns the [`node.textContent`](https://developer.mozilla.org/en-US/docs/Web/AP
|
|
1335
1337
|
def type(text, delay: nil, noWaitAfter: nil, timeout: nil)
|
1336
1338
|
```
|
1337
1339
|
|
1340
|
+
:::warning
|
1341
|
+
|
1342
|
+
In most cases, you should use [Locator#fill](./locator#fill) instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [Locator#press_sequentially](./locator#press_sequentially).
|
1343
|
+
|
1344
|
+
:::
|
1345
|
+
|
1338
1346
|
|
1339
1347
|
Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
|
1340
1348
|
|
@@ -1038,8 +1038,7 @@ button in the page overlay or to call `playwright.resume()` in the DevTools cons
|
|
1038
1038
|
User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from
|
1039
1039
|
the place it was paused.
|
1040
1040
|
|
1041
|
-
**NOTE**: This method requires Playwright to be started in a headed mode, with a falsy `headless`
|
1042
|
-
the [BrowserType#launch](./browser_type#launch).
|
1041
|
+
**NOTE**: This method requires Playwright to be started in a headed mode, with a falsy `headless` option.
|
1043
1042
|
|
1044
1043
|
## pdf
|
1045
1044
|
|
@@ -1202,7 +1201,7 @@ Once routing is enabled, every request matching the url pattern will stall unles
|
|
1202
1201
|
|
1203
1202
|
**NOTE**: The handler will only be called for the first url if the response is a redirect.
|
1204
1203
|
|
1205
|
-
**NOTE**: [Page#route](./page#route) will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
1204
|
+
**NOTE**: [Page#route](./page#route) will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
1206
1205
|
|
1207
1206
|
**NOTE**: [Page#route](./page#route) will not intercept the first request of a popup page. Use [BrowserContext#route](./browser_context#route) instead.
|
1208
1207
|
|
@@ -1258,7 +1257,7 @@ def route_from_har(
|
|
1258
1257
|
|
1259
1258
|
If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](https://playwright.dev/python/docs/mock#replaying-from-har).
|
1260
1259
|
|
1261
|
-
Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
1260
|
+
Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
1262
1261
|
|
1263
1262
|
## screenshot
|
1264
1263
|
|
@@ -1494,6 +1493,12 @@ def type(
|
|
1494
1493
|
timeout: nil)
|
1495
1494
|
```
|
1496
1495
|
|
1496
|
+
:::warning
|
1497
|
+
|
1498
|
+
In most cases, you should use [Locator#fill](./locator#fill) instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [Locator#press_sequentially](./locator#press_sequentially).
|
1499
|
+
|
1500
|
+
:::
|
1501
|
+
|
1497
1502
|
|
1498
1503
|
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send
|
1499
1504
|
fine-grained keyboard events. To fill values in form fields, use [Page#fill](./page#fill).
|
@@ -1684,6 +1689,12 @@ puts popup.title # popup is ready to use.
|
|
1684
1689
|
def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
|
1685
1690
|
```
|
1686
1691
|
|
1692
|
+
:::warning
|
1693
|
+
|
1694
|
+
This method is inherently racy, please use [Page#wait_for_url](./page#wait_for_url) instead.
|
1695
|
+
|
1696
|
+
:::
|
1697
|
+
|
1687
1698
|
|
1688
1699
|
Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the navigation
|
1689
1700
|
will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to
|
@@ -288,6 +288,7 @@
|
|
288
288
|
* get_by_title
|
289
289
|
* go_back
|
290
290
|
* go_forward
|
291
|
+
* ~~request_gc~~
|
291
292
|
* goto
|
292
293
|
* hover
|
293
294
|
* inner_html
|
@@ -313,6 +314,7 @@
|
|
313
314
|
* reload
|
314
315
|
* route
|
315
316
|
* route_from_har
|
317
|
+
* ~~route_web_socket~~
|
316
318
|
* screenshot
|
317
319
|
* select_option
|
318
320
|
* set_checked
|
@@ -375,6 +377,7 @@
|
|
375
377
|
* pages
|
376
378
|
* route
|
377
379
|
* route_from_har
|
380
|
+
* ~~route_web_socket~~
|
378
381
|
* service_workers
|
379
382
|
* set_default_navigation_timeout
|
380
383
|
* set_default_timeout
|
data/lib/playwright/test.rb
CHANGED
@@ -8,15 +8,15 @@ module Playwright
|
|
8
8
|
@timeout_settings = TimeoutSettings.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(actual,
|
11
|
+
def call(actual, is_not)
|
12
12
|
case actual
|
13
13
|
when Page
|
14
14
|
PageAssertions.new(
|
15
15
|
PageAssertionsImpl.new(
|
16
16
|
actual,
|
17
17
|
@timeout_settings.timeout,
|
18
|
-
|
19
|
-
|
18
|
+
is_not,
|
19
|
+
nil,
|
20
20
|
)
|
21
21
|
)
|
22
22
|
when Locator
|
@@ -24,8 +24,8 @@ module Playwright
|
|
24
24
|
LocatorAssertionsImpl.new(
|
25
25
|
actual,
|
26
26
|
@timeout_settings.timeout,
|
27
|
-
|
28
|
-
|
27
|
+
is_not,
|
28
|
+
nil,
|
29
29
|
)
|
30
30
|
)
|
31
31
|
else
|
@@ -43,7 +43,15 @@ module Playwright
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def matches?(actual)
|
46
|
-
Expect.new.call(actual).send(@method, *@args, **@kwargs)
|
46
|
+
Expect.new.call(actual, false).send(@method, *@args, **@kwargs)
|
47
|
+
true
|
48
|
+
rescue AssertionError => e
|
49
|
+
@failure_message = e.full_message
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
def does_not_match?(actual)
|
54
|
+
Expect.new.call(actual, true).send(@method, *@args, **@kwargs)
|
47
55
|
true
|
48
56
|
rescue AssertionError => e
|
49
57
|
@failure_message = e.full_message
|
@@ -54,10 +62,8 @@ module Playwright
|
|
54
62
|
@failure_message
|
55
63
|
end
|
56
64
|
|
57
|
-
# we have to invert the message again here because RSpec wants to control
|
58
|
-
# its own negation
|
59
65
|
def failure_message_when_negated
|
60
|
-
@failure_message
|
66
|
+
@failure_message
|
61
67
|
end
|
62
68
|
end
|
63
69
|
end
|
data/lib/playwright/version.rb
CHANGED
@@ -48,6 +48,8 @@ module Playwright
|
|
48
48
|
# if node:
|
49
49
|
# print(node["name"])
|
50
50
|
# ```
|
51
|
+
#
|
52
|
+
# @deprecated This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
|
51
53
|
def snapshot(interestingOnly: nil, root: nil)
|
52
54
|
wrap_impl(@impl.snapshot(interestingOnly: unwrap_impl(interestingOnly), root: unwrap_impl(root)))
|
53
55
|
end
|
@@ -38,12 +38,6 @@ module Playwright
|
|
38
38
|
end
|
39
39
|
alias_method :default_timeout=, :set_default_timeout
|
40
40
|
|
41
|
-
# -- inherited from EventEmitter --
|
42
|
-
# @nodoc
|
43
|
-
def once(event, callback)
|
44
|
-
event_emitter_proxy.once(event, callback)
|
45
|
-
end
|
46
|
-
|
47
41
|
# -- inherited from EventEmitter --
|
48
42
|
# @nodoc
|
49
43
|
def on(event, callback)
|
@@ -56,6 +50,12 @@ module Playwright
|
|
56
50
|
event_emitter_proxy.off(event, callback)
|
57
51
|
end
|
58
52
|
|
53
|
+
# -- inherited from EventEmitter --
|
54
|
+
# @nodoc
|
55
|
+
def once(event, callback)
|
56
|
+
event_emitter_proxy.once(event, callback)
|
57
|
+
end
|
58
|
+
|
59
59
|
private def event_emitter_proxy
|
60
60
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
61
61
|
end
|
@@ -203,12 +203,6 @@ module Playwright
|
|
203
203
|
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
204
204
|
end
|
205
205
|
|
206
|
-
# -- inherited from EventEmitter --
|
207
|
-
# @nodoc
|
208
|
-
def once(event, callback)
|
209
|
-
event_emitter_proxy.once(event, callback)
|
210
|
-
end
|
211
|
-
|
212
206
|
# -- inherited from EventEmitter --
|
213
207
|
# @nodoc
|
214
208
|
def on(event, callback)
|
@@ -221,6 +215,12 @@ module Playwright
|
|
221
215
|
event_emitter_proxy.off(event, callback)
|
222
216
|
end
|
223
217
|
|
218
|
+
# -- inherited from EventEmitter --
|
219
|
+
# @nodoc
|
220
|
+
def once(event, callback)
|
221
|
+
event_emitter_proxy.once(event, callback)
|
222
|
+
end
|
223
|
+
|
224
224
|
private def event_emitter_proxy
|
225
225
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
226
226
|
end
|
@@ -108,7 +108,7 @@ module Playwright
|
|
108
108
|
# api_request_context.fetch("https://example.com/api/createBook", method="post", data=data)
|
109
109
|
# ```
|
110
110
|
#
|
111
|
-
# The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding
|
111
|
+
# The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding, by specifiying the `multipart` parameter:
|
112
112
|
#
|
113
113
|
# ```python
|
114
114
|
# api_request_context.fetch(
|
@@ -286,12 +286,6 @@ module Playwright
|
|
286
286
|
raise NotImplementedError.new('storage_state is not implemented yet.')
|
287
287
|
end
|
288
288
|
|
289
|
-
# -- inherited from EventEmitter --
|
290
|
-
# @nodoc
|
291
|
-
def once(event, callback)
|
292
|
-
event_emitter_proxy.once(event, callback)
|
293
|
-
end
|
294
|
-
|
295
289
|
# -- inherited from EventEmitter --
|
296
290
|
# @nodoc
|
297
291
|
def on(event, callback)
|
@@ -304,6 +298,12 @@ module Playwright
|
|
304
298
|
event_emitter_proxy.off(event, callback)
|
305
299
|
end
|
306
300
|
|
301
|
+
# -- inherited from EventEmitter --
|
302
|
+
# @nodoc
|
303
|
+
def once(event, callback)
|
304
|
+
event_emitter_proxy.once(event, callback)
|
305
|
+
end
|
306
|
+
|
307
307
|
private def event_emitter_proxy
|
308
308
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
309
309
|
end
|
@@ -201,12 +201,6 @@ module Playwright
|
|
201
201
|
wrap_impl(@impl.version)
|
202
202
|
end
|
203
203
|
|
204
|
-
# -- inherited from EventEmitter --
|
205
|
-
# @nodoc
|
206
|
-
def once(event, callback)
|
207
|
-
event_emitter_proxy.once(event, callback)
|
208
|
-
end
|
209
|
-
|
210
204
|
# -- inherited from EventEmitter --
|
211
205
|
# @nodoc
|
212
206
|
def on(event, callback)
|
@@ -219,6 +213,12 @@ module Playwright
|
|
219
213
|
event_emitter_proxy.off(event, callback)
|
220
214
|
end
|
221
215
|
|
216
|
+
# -- inherited from EventEmitter --
|
217
|
+
# @nodoc
|
218
|
+
def once(event, callback)
|
219
|
+
event_emitter_proxy.once(event, callback)
|
220
|
+
end
|
221
|
+
|
222
222
|
private def event_emitter_proxy
|
223
223
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
224
224
|
end
|
@@ -250,7 +250,7 @@ module Playwright
|
|
250
250
|
# Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
|
251
251
|
# is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
252
252
|
#
|
253
|
-
# **NOTE**: [`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
253
|
+
# **NOTE**: [`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
254
254
|
#
|
255
255
|
# **Usage**
|
256
256
|
#
|
@@ -300,7 +300,7 @@ module Playwright
|
|
300
300
|
#
|
301
301
|
# If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](../mock.md#replaying-from-har).
|
302
302
|
#
|
303
|
-
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
303
|
+
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
304
304
|
def route_from_har(
|
305
305
|
har,
|
306
306
|
notFound: nil,
|
@@ -311,6 +311,32 @@ module Playwright
|
|
311
311
|
wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), updateContent: unwrap_impl(updateContent), updateMode: unwrap_impl(updateMode), url: unwrap_impl(url)))
|
312
312
|
end
|
313
313
|
|
314
|
+
#
|
315
|
+
# This method allows to modify websocket connections that are made by any page in the browser context.
|
316
|
+
#
|
317
|
+
# Note that only `WebSocket`s created after this method was called will be routed. It is recommended to call this method before creating any pages.
|
318
|
+
#
|
319
|
+
# **Usage**
|
320
|
+
#
|
321
|
+
# Below is an example of a simple handler that blocks some websocket messages.
|
322
|
+
# See `WebSocketRoute` for more details and examples.
|
323
|
+
#
|
324
|
+
# ```python sync
|
325
|
+
# def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
|
326
|
+
# if message == "to-be-blocked":
|
327
|
+
# return
|
328
|
+
# ws.send(message)
|
329
|
+
#
|
330
|
+
# def handler(ws: WebSocketRoute):
|
331
|
+
# ws.route_send(lambda message: message_handler(ws, message))
|
332
|
+
# ws.connect()
|
333
|
+
#
|
334
|
+
# context.route_web_socket("/ws", handler)
|
335
|
+
# ```
|
336
|
+
def route_web_socket(url, handler)
|
337
|
+
raise NotImplementedError.new('route_web_socket is not implemented yet.')
|
338
|
+
end
|
339
|
+
|
314
340
|
#
|
315
341
|
# **NOTE**: Service workers are only supported on Chromium-based browsers.
|
316
342
|
#
|
@@ -462,12 +488,6 @@ module Playwright
|
|
462
488
|
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
463
489
|
end
|
464
490
|
|
465
|
-
# -- inherited from EventEmitter --
|
466
|
-
# @nodoc
|
467
|
-
def once(event, callback)
|
468
|
-
event_emitter_proxy.once(event, callback)
|
469
|
-
end
|
470
|
-
|
471
491
|
# -- inherited from EventEmitter --
|
472
492
|
# @nodoc
|
473
493
|
def on(event, callback)
|
@@ -480,6 +500,12 @@ module Playwright
|
|
480
500
|
event_emitter_proxy.off(event, callback)
|
481
501
|
end
|
482
502
|
|
503
|
+
# -- inherited from EventEmitter --
|
504
|
+
# @nodoc
|
505
|
+
def once(event, callback)
|
506
|
+
event_emitter_proxy.once(event, callback)
|
507
|
+
end
|
508
|
+
|
483
509
|
private def event_emitter_proxy
|
484
510
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
485
511
|
end
|
@@ -175,12 +175,6 @@ module Playwright
|
|
175
175
|
wrap_impl(@impl.name)
|
176
176
|
end
|
177
177
|
|
178
|
-
# -- inherited from EventEmitter --
|
179
|
-
# @nodoc
|
180
|
-
def once(event, callback)
|
181
|
-
event_emitter_proxy.once(event, callback)
|
182
|
-
end
|
183
|
-
|
184
178
|
# -- inherited from EventEmitter --
|
185
179
|
# @nodoc
|
186
180
|
def on(event, callback)
|
@@ -193,6 +187,12 @@ module Playwright
|
|
193
187
|
event_emitter_proxy.off(event, callback)
|
194
188
|
end
|
195
189
|
|
190
|
+
# -- inherited from EventEmitter --
|
191
|
+
# @nodoc
|
192
|
+
def once(event, callback)
|
193
|
+
event_emitter_proxy.once(event, callback)
|
194
|
+
end
|
195
|
+
|
196
196
|
private def event_emitter_proxy
|
197
197
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
198
198
|
end
|
@@ -31,12 +31,6 @@ module Playwright
|
|
31
31
|
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
32
32
|
end
|
33
33
|
|
34
|
-
# -- inherited from EventEmitter --
|
35
|
-
# @nodoc
|
36
|
-
def once(event, callback)
|
37
|
-
event_emitter_proxy.once(event, callback)
|
38
|
-
end
|
39
|
-
|
40
34
|
# -- inherited from EventEmitter --
|
41
35
|
# @nodoc
|
42
36
|
def on(event, callback)
|
@@ -49,6 +43,12 @@ module Playwright
|
|
49
43
|
event_emitter_proxy.off(event, callback)
|
50
44
|
end
|
51
45
|
|
46
|
+
# -- inherited from EventEmitter --
|
47
|
+
# @nodoc
|
48
|
+
def once(event, callback)
|
49
|
+
event_emitter_proxy.once(event, callback)
|
50
|
+
end
|
51
|
+
|
52
52
|
private def event_emitter_proxy
|
53
53
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
54
54
|
end
|
@@ -68,12 +68,6 @@ module Playwright
|
|
68
68
|
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
69
69
|
end
|
70
70
|
|
71
|
-
# -- inherited from EventEmitter --
|
72
|
-
# @nodoc
|
73
|
-
def once(event, callback)
|
74
|
-
event_emitter_proxy.once(event, callback)
|
75
|
-
end
|
76
|
-
|
77
71
|
# -- inherited from EventEmitter --
|
78
72
|
# @nodoc
|
79
73
|
def on(event, callback)
|
@@ -86,6 +80,12 @@ module Playwright
|
|
86
80
|
event_emitter_proxy.off(event, callback)
|
87
81
|
end
|
88
82
|
|
83
|
+
# -- inherited from EventEmitter --
|
84
|
+
# @nodoc
|
85
|
+
def once(event, callback)
|
86
|
+
event_emitter_proxy.once(event, callback)
|
87
|
+
end
|
88
|
+
|
89
89
|
private def event_emitter_proxy
|
90
90
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
91
91
|
end
|
@@ -505,6 +505,8 @@ module Playwright
|
|
505
505
|
# To press a special key, like `Control` or `ArrowDown`, use [`method: ElementHandle.press`].
|
506
506
|
#
|
507
507
|
# **Usage**
|
508
|
+
#
|
509
|
+
# @deprecated In most cases, you should use [`method: Locator.fill`] instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [`method: Locator.pressSequentially`].
|
508
510
|
def type(text, delay: nil, noWaitAfter: nil, timeout: nil)
|
509
511
|
wrap_impl(@impl.type(unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
510
512
|
end
|
@@ -570,12 +572,6 @@ module Playwright
|
|
570
572
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
571
573
|
end
|
572
574
|
|
573
|
-
# -- inherited from EventEmitter --
|
574
|
-
# @nodoc
|
575
|
-
def once(event, callback)
|
576
|
-
event_emitter_proxy.once(event, callback)
|
577
|
-
end
|
578
|
-
|
579
575
|
# -- inherited from EventEmitter --
|
580
576
|
# @nodoc
|
581
577
|
def on(event, callback)
|
@@ -588,6 +584,12 @@ module Playwright
|
|
588
584
|
event_emitter_proxy.off(event, callback)
|
589
585
|
end
|
590
586
|
|
587
|
+
# -- inherited from EventEmitter --
|
588
|
+
# @nodoc
|
589
|
+
def once(event, callback)
|
590
|
+
event_emitter_proxy.once(event, callback)
|
591
|
+
end
|
592
|
+
|
591
593
|
private def event_emitter_proxy
|
592
594
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
593
595
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -866,6 +866,8 @@ module Playwright
|
|
866
866
|
# To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].
|
867
867
|
#
|
868
868
|
# **Usage**
|
869
|
+
#
|
870
|
+
# @deprecated In most cases, you should use [`method: Locator.fill`] instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [`method: Locator.pressSequentially`].
|
869
871
|
def type(
|
870
872
|
selector,
|
871
873
|
text,
|
@@ -972,6 +974,8 @@ module Playwright
|
|
972
974
|
#
|
973
975
|
# **NOTE**: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered
|
974
976
|
# a navigation.
|
977
|
+
#
|
978
|
+
# @deprecated This method is inherently racy, please use [`method: Frame.waitForURL`] instead.
|
975
979
|
def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
|
976
980
|
wrap_impl(@impl.expect_navigation(timeout: unwrap_impl(timeout), url: unwrap_impl(url), waitUntil: unwrap_impl(waitUntil), &wrap_block_call(block)))
|
977
981
|
end
|
@@ -1044,12 +1048,6 @@ module Playwright
|
|
1044
1048
|
wrap_impl(@impl.highlight(unwrap_impl(selector)))
|
1045
1049
|
end
|
1046
1050
|
|
1047
|
-
# -- inherited from EventEmitter --
|
1048
|
-
# @nodoc
|
1049
|
-
def once(event, callback)
|
1050
|
-
event_emitter_proxy.once(event, callback)
|
1051
|
-
end
|
1052
|
-
|
1053
1051
|
# -- inherited from EventEmitter --
|
1054
1052
|
# @nodoc
|
1055
1053
|
def on(event, callback)
|
@@ -1062,6 +1060,12 @@ module Playwright
|
|
1062
1060
|
event_emitter_proxy.off(event, callback)
|
1063
1061
|
end
|
1064
1062
|
|
1063
|
+
# -- inherited from EventEmitter --
|
1064
|
+
# @nodoc
|
1065
|
+
def once(event, callback)
|
1066
|
+
event_emitter_proxy.once(event, callback)
|
1067
|
+
end
|
1068
|
+
|
1065
1069
|
private def event_emitter_proxy
|
1066
1070
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1067
1071
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Playwright
|
2
2
|
#
|
3
|
-
# FrameLocator represents a view to the `iframe` on the page. It captures the logic sufficient to retrieve the `iframe` and locate elements in that iframe. FrameLocator can be created with either [`method: Page.frameLocator`] or [`method: Locator.frameLocator`] method.
|
3
|
+
# FrameLocator represents a view to the `iframe` on the page. It captures the logic sufficient to retrieve the `iframe` and locate elements in that iframe. FrameLocator can be created with either [`method: Locator.contentFrame`], [`method: Page.frameLocator`] or [`method: Locator.frameLocator`] method.
|
4
4
|
#
|
5
5
|
# ```python sync
|
6
|
-
# locator = page.
|
6
|
+
# locator = page.locator("my-frame").content_frame.get_by_text("Submit")
|
7
7
|
# locator.click()
|
8
8
|
# ```
|
9
9
|
#
|
@@ -13,10 +13,10 @@ module Playwright
|
|
13
13
|
#
|
14
14
|
# ```python sync
|
15
15
|
# # Throws if there are several frames in DOM:
|
16
|
-
# page.
|
16
|
+
# page.locator('.result-frame').content_frame.get_by_role('button').click()
|
17
17
|
#
|
18
18
|
# # Works because we explicitly tell locator to pick the first frame:
|
19
|
-
# page.
|
19
|
+
# page.locator('.result-frame').first.content_frame.get_by_role('button').click()
|
20
20
|
# ```
|
21
21
|
#
|
22
22
|
# **Converting Locator to FrameLocator**
|
@@ -30,6 +30,8 @@ module Playwright
|
|
30
30
|
|
31
31
|
#
|
32
32
|
# Returns locator to the first matching frame.
|
33
|
+
#
|
34
|
+
# @deprecated Use [`method: Locator.first`] followed by [`method: Locator.contentFrame`] instead.
|
33
35
|
def first
|
34
36
|
wrap_impl(@impl.first)
|
35
37
|
end
|
@@ -233,6 +235,8 @@ module Playwright
|
|
233
235
|
|
234
236
|
#
|
235
237
|
# Returns locator to the last matching frame.
|
238
|
+
#
|
239
|
+
# @deprecated Use [`method: Locator.last`] followed by [`method: Locator.contentFrame`] instead.
|
236
240
|
def last
|
237
241
|
wrap_impl(@impl.last)
|
238
242
|
end
|
@@ -252,6 +256,8 @@ module Playwright
|
|
252
256
|
|
253
257
|
#
|
254
258
|
# Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
|
259
|
+
#
|
260
|
+
# @deprecated Use [`method: Locator.nth`] followed by [`method: Locator.contentFrame`] instead.
|
255
261
|
def nth(index)
|
256
262
|
wrap_impl(@impl.nth(unwrap_impl(index)))
|
257
263
|
end
|
@@ -266,7 +272,7 @@ module Playwright
|
|
266
272
|
# **Usage**
|
267
273
|
#
|
268
274
|
# ```python sync
|
269
|
-
# frame_locator = page.
|
275
|
+
# frame_locator = page.locator("iframe[name=\"embedded\"]").content_frame
|
270
276
|
# # ...
|
271
277
|
# locator = frame_locator.owner
|
272
278
|
# expect(locator).to_be_visible()
|
@@ -98,12 +98,6 @@ module Playwright
|
|
98
98
|
wrap_impl(@impl.to_s)
|
99
99
|
end
|
100
100
|
|
101
|
-
# -- inherited from EventEmitter --
|
102
|
-
# @nodoc
|
103
|
-
def once(event, callback)
|
104
|
-
event_emitter_proxy.once(event, callback)
|
105
|
-
end
|
106
|
-
|
107
101
|
# -- inherited from EventEmitter --
|
108
102
|
# @nodoc
|
109
103
|
def on(event, callback)
|
@@ -116,6 +110,12 @@ module Playwright
|
|
116
110
|
event_emitter_proxy.off(event, callback)
|
117
111
|
end
|
118
112
|
|
113
|
+
# -- inherited from EventEmitter --
|
114
|
+
# @nodoc
|
115
|
+
def once(event, callback)
|
116
|
+
event_emitter_proxy.once(event, callback)
|
117
|
+
end
|
118
|
+
|
119
119
|
private def event_emitter_proxy
|
120
120
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
121
121
|
end
|
@@ -854,7 +854,9 @@ module Playwright
|
|
854
854
|
end
|
855
855
|
|
856
856
|
#
|
857
|
-
# Creates a locator that
|
857
|
+
# Creates a locator matching all elements that match one or both of the two locators.
|
858
|
+
#
|
859
|
+
# Note that when both locators match something, the resulting locator will have multiple matches and violate [locator strictness](../locators.md#strictness) guidelines.
|
858
860
|
#
|
859
861
|
# **Usage**
|
860
862
|
#
|
@@ -1148,6 +1150,8 @@ module Playwright
|
|
1148
1150
|
# To press a special key, like `Control` or `ArrowDown`, use [`method: Locator.press`].
|
1149
1151
|
#
|
1150
1152
|
# **Usage**
|
1153
|
+
#
|
1154
|
+
# @deprecated In most cases, you should use [`method: Locator.fill`] instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [`method: Locator.pressSequentially`].
|
1151
1155
|
def type(text, delay: nil, noWaitAfter: nil, timeout: nil)
|
1152
1156
|
wrap_impl(@impl.type(unwrap_impl(text), delay: unwrap_impl(delay), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
1153
1157
|
end
|
data/lib/playwright_api/page.rb
CHANGED
@@ -793,6 +793,23 @@ module Playwright
|
|
793
793
|
wrap_impl(@impl.go_forward(timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
|
794
794
|
end
|
795
795
|
|
796
|
+
#
|
797
|
+
# Request the page to perform garbage collection. Note that there is no guarantee that all unreachable objects will be collected.
|
798
|
+
#
|
799
|
+
# This is useful to help detect memory leaks. For example, if your page has a large object `'suspect'` that might be leaked, you can check that it does not leak by using a [`WeakRef`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef).
|
800
|
+
#
|
801
|
+
# ```python sync
|
802
|
+
# # 1. In your page, save a WeakRef for the "suspect".
|
803
|
+
# page.evaluate("globalThis.suspectWeakRef = new WeakRef(suspect)")
|
804
|
+
# # 2. Request garbage collection.
|
805
|
+
# page.request_gc()
|
806
|
+
# # 3. Check that weak ref does not deref to the original object.
|
807
|
+
# assert page.evaluate("!globalThis.suspectWeakRef.deref()")
|
808
|
+
# ```
|
809
|
+
def request_gc
|
810
|
+
raise NotImplementedError.new('request_gc is not implemented yet.')
|
811
|
+
end
|
812
|
+
|
796
813
|
#
|
797
814
|
# Returns the main resource response. In case of multiple redirects, the navigation will resolve with the first
|
798
815
|
# non-redirect response.
|
@@ -933,8 +950,7 @@ module Playwright
|
|
933
950
|
# User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from
|
934
951
|
# the place it was paused.
|
935
952
|
#
|
936
|
-
# **NOTE**: This method requires Playwright to be started in a headed mode, with a falsy `headless`
|
937
|
-
# the [`method: BrowserType.launch`].
|
953
|
+
# **NOTE**: This method requires Playwright to be started in a headed mode, with a falsy `headless` option.
|
938
954
|
def pause
|
939
955
|
wrap_impl(@impl.pause)
|
940
956
|
end
|
@@ -1079,11 +1095,9 @@ module Playwright
|
|
1079
1095
|
# - You can register multiple handlers. However, only a single handler will be running at a time. Make sure the actions within a handler don't depend on another handler.
|
1080
1096
|
#
|
1081
1097
|
# **NOTE**: Running the handler will alter your page state mid-test. For example it will change the currently focused element and move the mouse. Make sure that actions that run after the handler are self-contained and do not rely on the focus and mouse state being unchanged.
|
1082
|
-
#
|
1083
|
-
# <br />
|
1098
|
+
#
|
1084
1099
|
# 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.
|
1085
|
-
#
|
1086
|
-
# <br />
|
1100
|
+
#
|
1087
1101
|
# 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 self-contained actions like [`method: Locator.click`] that do not rely on the state being unchanged by a handler.
|
1088
1102
|
#
|
1089
1103
|
# **Usage**
|
@@ -1159,7 +1173,7 @@ module Playwright
|
|
1159
1173
|
#
|
1160
1174
|
# **NOTE**: The handler will only be called for the first url if the response is a redirect.
|
1161
1175
|
#
|
1162
|
-
# **NOTE**: [`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
1176
|
+
# **NOTE**: [`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
1163
1177
|
#
|
1164
1178
|
# **NOTE**: [`method: Page.route`] will not intercept the first request of a popup page. Use [`method: BrowserContext.route`] instead.
|
1165
1179
|
#
|
@@ -1207,7 +1221,7 @@ module Playwright
|
|
1207
1221
|
#
|
1208
1222
|
# If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](../mock.md#replaying-from-har).
|
1209
1223
|
#
|
1210
|
-
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `
|
1224
|
+
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `serviceWorkers` to `'block'`.
|
1211
1225
|
def route_from_har(
|
1212
1226
|
har,
|
1213
1227
|
notFound: nil,
|
@@ -1218,6 +1232,29 @@ module Playwright
|
|
1218
1232
|
wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), updateContent: unwrap_impl(updateContent), updateMode: unwrap_impl(updateMode), url: unwrap_impl(url)))
|
1219
1233
|
end
|
1220
1234
|
|
1235
|
+
#
|
1236
|
+
# This method allows to modify websocket connections that are made by the page.
|
1237
|
+
#
|
1238
|
+
# Note that only `WebSocket`s created after this method was called will be routed. It is recommended to call this method before navigating the page.
|
1239
|
+
#
|
1240
|
+
# **Usage**
|
1241
|
+
#
|
1242
|
+
# Below is an example of a simple mock that responds to a single message. See `WebSocketRoute` for more details and examples.
|
1243
|
+
#
|
1244
|
+
# ```python sync
|
1245
|
+
# def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
|
1246
|
+
# if message == "request":
|
1247
|
+
# ws.send("response")
|
1248
|
+
#
|
1249
|
+
# def handler(ws: WebSocketRoute):
|
1250
|
+
# ws.on_message(lambda message: message_handler(ws, message))
|
1251
|
+
#
|
1252
|
+
# page.route_web_socket("/ws", handler)
|
1253
|
+
# ```
|
1254
|
+
def route_web_socket(url, handler)
|
1255
|
+
raise NotImplementedError.new('route_web_socket is not implemented yet.')
|
1256
|
+
end
|
1257
|
+
|
1221
1258
|
#
|
1222
1259
|
# Returns the buffer with the captured screenshot.
|
1223
1260
|
def screenshot(
|
@@ -1412,6 +1449,8 @@ module Playwright
|
|
1412
1449
|
# To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].
|
1413
1450
|
#
|
1414
1451
|
# **Usage**
|
1452
|
+
#
|
1453
|
+
# @deprecated In most cases, you should use [`method: Locator.fill`] instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [`method: Locator.pressSequentially`].
|
1415
1454
|
def type(
|
1416
1455
|
selector,
|
1417
1456
|
text,
|
@@ -1589,6 +1628,8 @@ module Playwright
|
|
1589
1628
|
#
|
1590
1629
|
# **NOTE**: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered
|
1591
1630
|
# a navigation.
|
1631
|
+
#
|
1632
|
+
# @deprecated This method is inherently racy, please use [`method: Page.waitForURL`] instead.
|
1592
1633
|
def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
|
1593
1634
|
wrap_impl(@impl.expect_navigation(timeout: unwrap_impl(timeout), url: unwrap_impl(url), waitUntil: unwrap_impl(waitUntil), &wrap_block_call(block)))
|
1594
1635
|
end
|
@@ -1779,12 +1820,6 @@ module Playwright
|
|
1779
1820
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
1780
1821
|
end
|
1781
1822
|
|
1782
|
-
# -- inherited from EventEmitter --
|
1783
|
-
# @nodoc
|
1784
|
-
def once(event, callback)
|
1785
|
-
event_emitter_proxy.once(event, callback)
|
1786
|
-
end
|
1787
|
-
|
1788
1823
|
# -- inherited from EventEmitter --
|
1789
1824
|
# @nodoc
|
1790
1825
|
def on(event, callback)
|
@@ -1797,6 +1832,12 @@ module Playwright
|
|
1797
1832
|
event_emitter_proxy.off(event, callback)
|
1798
1833
|
end
|
1799
1834
|
|
1835
|
+
# -- inherited from EventEmitter --
|
1836
|
+
# @nodoc
|
1837
|
+
def once(event, callback)
|
1838
|
+
event_emitter_proxy.once(event, callback)
|
1839
|
+
end
|
1840
|
+
|
1800
1841
|
private def event_emitter_proxy
|
1801
1842
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1802
1843
|
end
|
@@ -93,20 +93,14 @@ module Playwright
|
|
93
93
|
raise NotImplementedError.new('stop is not implemented yet.')
|
94
94
|
end
|
95
95
|
|
96
|
-
# @nodoc
|
97
|
-
def electron
|
98
|
-
wrap_impl(@impl.electron)
|
99
|
-
end
|
100
|
-
|
101
96
|
# @nodoc
|
102
97
|
def android
|
103
98
|
wrap_impl(@impl.android)
|
104
99
|
end
|
105
100
|
|
106
|
-
# -- inherited from EventEmitter --
|
107
101
|
# @nodoc
|
108
|
-
def
|
109
|
-
|
102
|
+
def electron
|
103
|
+
wrap_impl(@impl.electron)
|
110
104
|
end
|
111
105
|
|
112
106
|
# -- inherited from EventEmitter --
|
@@ -121,6 +115,12 @@ module Playwright
|
|
121
115
|
event_emitter_proxy.off(event, callback)
|
122
116
|
end
|
123
117
|
|
118
|
+
# -- inherited from EventEmitter --
|
119
|
+
# @nodoc
|
120
|
+
def once(event, callback)
|
121
|
+
event_emitter_proxy.once(event, callback)
|
122
|
+
end
|
123
|
+
|
124
124
|
private def event_emitter_proxy
|
125
125
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
126
126
|
end
|
@@ -205,12 +205,6 @@ module Playwright
|
|
205
205
|
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
206
206
|
end
|
207
207
|
|
208
|
-
# -- inherited from EventEmitter --
|
209
|
-
# @nodoc
|
210
|
-
def once(event, callback)
|
211
|
-
event_emitter_proxy.once(event, callback)
|
212
|
-
end
|
213
|
-
|
214
208
|
# -- inherited from EventEmitter --
|
215
209
|
# @nodoc
|
216
210
|
def on(event, callback)
|
@@ -223,6 +217,12 @@ module Playwright
|
|
223
217
|
event_emitter_proxy.off(event, callback)
|
224
218
|
end
|
225
219
|
|
220
|
+
# -- inherited from EventEmitter --
|
221
|
+
# @nodoc
|
222
|
+
def once(event, callback)
|
223
|
+
event_emitter_proxy.once(event, callback)
|
224
|
+
end
|
225
|
+
|
226
226
|
private def event_emitter_proxy
|
227
227
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
228
228
|
end
|
@@ -127,12 +127,6 @@ module Playwright
|
|
127
127
|
wrap_impl(@impl.from_service_worker?)
|
128
128
|
end
|
129
129
|
|
130
|
-
# -- inherited from EventEmitter --
|
131
|
-
# @nodoc
|
132
|
-
def once(event, callback)
|
133
|
-
event_emitter_proxy.once(event, callback)
|
134
|
-
end
|
135
|
-
|
136
130
|
# -- inherited from EventEmitter --
|
137
131
|
# @nodoc
|
138
132
|
def on(event, callback)
|
@@ -145,6 +139,12 @@ module Playwright
|
|
145
139
|
event_emitter_proxy.off(event, callback)
|
146
140
|
end
|
147
141
|
|
142
|
+
# -- inherited from EventEmitter --
|
143
|
+
# @nodoc
|
144
|
+
def once(event, callback)
|
145
|
+
event_emitter_proxy.once(event, callback)
|
146
|
+
end
|
147
|
+
|
148
148
|
private def event_emitter_proxy
|
149
149
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
150
150
|
end
|
data/lib/playwright_api/route.rb
CHANGED
@@ -172,12 +172,6 @@ module Playwright
|
|
172
172
|
wrap_impl(@impl.redirect_navigation_request(unwrap_impl(url)))
|
173
173
|
end
|
174
174
|
|
175
|
-
# -- inherited from EventEmitter --
|
176
|
-
# @nodoc
|
177
|
-
def once(event, callback)
|
178
|
-
event_emitter_proxy.once(event, callback)
|
179
|
-
end
|
180
|
-
|
181
175
|
# -- inherited from EventEmitter --
|
182
176
|
# @nodoc
|
183
177
|
def on(event, callback)
|
@@ -190,6 +184,12 @@ module Playwright
|
|
190
184
|
event_emitter_proxy.off(event, callback)
|
191
185
|
end
|
192
186
|
|
187
|
+
# -- inherited from EventEmitter --
|
188
|
+
# @nodoc
|
189
|
+
def once(event, callback)
|
190
|
+
event_emitter_proxy.once(event, callback)
|
191
|
+
end
|
192
|
+
|
193
193
|
private def event_emitter_proxy
|
194
194
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
195
195
|
end
|
@@ -61,12 +61,6 @@ module Playwright
|
|
61
61
|
wrap_impl(@impl.text_id_attribute=(unwrap_impl(attribute_name)))
|
62
62
|
end
|
63
63
|
|
64
|
-
# -- inherited from EventEmitter --
|
65
|
-
# @nodoc
|
66
|
-
def once(event, callback)
|
67
|
-
event_emitter_proxy.once(event, callback)
|
68
|
-
end
|
69
|
-
|
70
64
|
# -- inherited from EventEmitter --
|
71
65
|
# @nodoc
|
72
66
|
def on(event, callback)
|
@@ -79,6 +73,12 @@ module Playwright
|
|
79
73
|
event_emitter_proxy.off(event, callback)
|
80
74
|
end
|
81
75
|
|
76
|
+
# -- inherited from EventEmitter --
|
77
|
+
# @nodoc
|
78
|
+
def once(event, callback)
|
79
|
+
event_emitter_proxy.once(event, callback)
|
80
|
+
end
|
81
|
+
|
82
82
|
private def event_emitter_proxy
|
83
83
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
84
84
|
end
|
@@ -70,12 +70,6 @@ module Playwright
|
|
70
70
|
wrap_impl(@impl.stop_chunk(path: unwrap_impl(path)))
|
71
71
|
end
|
72
72
|
|
73
|
-
# -- inherited from EventEmitter --
|
74
|
-
# @nodoc
|
75
|
-
def once(event, callback)
|
76
|
-
event_emitter_proxy.once(event, callback)
|
77
|
-
end
|
78
|
-
|
79
73
|
# -- inherited from EventEmitter --
|
80
74
|
# @nodoc
|
81
75
|
def on(event, callback)
|
@@ -88,6 +82,12 @@ module Playwright
|
|
88
82
|
event_emitter_proxy.off(event, callback)
|
89
83
|
end
|
90
84
|
|
85
|
+
# -- inherited from EventEmitter --
|
86
|
+
# @nodoc
|
87
|
+
def once(event, callback)
|
88
|
+
event_emitter_proxy.once(event, callback)
|
89
|
+
end
|
90
|
+
|
91
91
|
private def event_emitter_proxy
|
92
92
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
93
93
|
end
|
@@ -32,12 +32,6 @@ module Playwright
|
|
32
32
|
wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
33
33
|
end
|
34
34
|
|
35
|
-
# -- inherited from EventEmitter --
|
36
|
-
# @nodoc
|
37
|
-
def once(event, callback)
|
38
|
-
event_emitter_proxy.once(event, callback)
|
39
|
-
end
|
40
|
-
|
41
35
|
# -- inherited from EventEmitter --
|
42
36
|
# @nodoc
|
43
37
|
def on(event, callback)
|
@@ -50,6 +44,12 @@ module Playwright
|
|
50
44
|
event_emitter_proxy.off(event, callback)
|
51
45
|
end
|
52
46
|
|
47
|
+
# -- inherited from EventEmitter --
|
48
|
+
# @nodoc
|
49
|
+
def once(event, callback)
|
50
|
+
event_emitter_proxy.once(event, callback)
|
51
|
+
end
|
52
|
+
|
53
53
|
private def event_emitter_proxy
|
54
54
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
55
55
|
end
|
@@ -56,12 +56,6 @@ module Playwright
|
|
56
56
|
wrap_impl(@impl.page=(unwrap_impl(req)))
|
57
57
|
end
|
58
58
|
|
59
|
-
# -- inherited from EventEmitter --
|
60
|
-
# @nodoc
|
61
|
-
def once(event, callback)
|
62
|
-
event_emitter_proxy.once(event, callback)
|
63
|
-
end
|
64
|
-
|
65
59
|
# -- inherited from EventEmitter --
|
66
60
|
# @nodoc
|
67
61
|
def on(event, callback)
|
@@ -74,6 +68,12 @@ module Playwright
|
|
74
68
|
event_emitter_proxy.off(event, callback)
|
75
69
|
end
|
76
70
|
|
71
|
+
# -- inherited from EventEmitter --
|
72
|
+
# @nodoc
|
73
|
+
def once(event, callback)
|
74
|
+
event_emitter_proxy.once(event, callback)
|
75
|
+
end
|
76
|
+
|
77
77
|
private def event_emitter_proxy
|
78
78
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
79
79
|
end
|
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.48.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-
|
11
|
+
date: 2024-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -413,5 +413,5 @@ requirements: []
|
|
413
413
|
rubygems_version: 3.3.27
|
414
414
|
signing_key:
|
415
415
|
specification_version: 4
|
416
|
-
summary: The Ruby binding of playwright driver 1.
|
416
|
+
summary: The Ruby binding of playwright driver 1.48.2
|
417
417
|
test_files: []
|