playwright-ruby-client 1.42.0 → 1.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/documentation/docs/api/browser_context.md +22 -10
- data/documentation/docs/api/frame_locator.md +26 -4
- data/documentation/docs/api/locator.md +22 -0
- data/documentation/docs/api/page.md +10 -8
- data/documentation/docs/article/guides/download_playwright_driver.md +7 -10
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +3 -1
- data/documentation/docs/include/api_coverage.md +2 -0
- data/documentation/docusaurus.config.js +6 -0
- data/documentation/package.json +2 -2
- data/documentation/yarn.lock +1732 -1815
- data/lib/playwright/channel_owners/browser_context.rb +31 -2
- data/lib/playwright/channel_owners/js_handle.rb +4 -0
- data/lib/playwright/channel_owners/request.rb +1 -1
- data/lib/playwright/connection.rb +3 -0
- data/lib/playwright/frame_locator_impl.rb +8 -0
- data/lib/playwright/locator_impl.rb +8 -0
- data/lib/playwright/transport.rb +6 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/waiter.rb +4 -6
- data/lib/playwright/web_socket_transport.rb +8 -0
- data/lib/playwright.rb +1 -1
- 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 +6 -6
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +24 -14
- 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 +6 -6
- data/lib/playwright_api/frame.rb +6 -6
- data/lib/playwright_api/frame_locator.rb +23 -4
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +19 -0
- data/lib/playwright_api/page.rb +26 -22
- data/lib/playwright_api/playwright.rb +6 -6
- 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
- data/sig/playwright.rbs +3 -1
- metadata +3 -3
data/lib/playwright_api/page.rb
CHANGED
@@ -1080,31 +1080,35 @@ module Playwright
|
|
1080
1080
|
end
|
1081
1081
|
|
1082
1082
|
#
|
1083
|
-
#
|
1083
|
+
# **NOTE**: This method is experimental and its behavior may change in the upcoming releases.
|
1084
1084
|
#
|
1085
|
-
#
|
1085
|
+
# When testing a web page, sometimes unexpected overlays like a "Sign up" dialog appear and block actions you want to automate, e.g. clicking a button. These overlays don't always show up in the same way or at the same time, making them tricky to handle in automated tests.
|
1086
1086
|
#
|
1087
|
-
#
|
1087
|
+
# This method lets you set up a special function, called a handler, that activates when it detects that overlay is visible. The handler's job is to remove the overlay, allowing your test to continue as if the overlay wasn't there.
|
1088
1088
|
#
|
1089
|
-
#
|
1089
|
+
# Things to keep in mind:
|
1090
|
+
# - When an overlay is shown predictably, we recommend explicitly waiting for it in your test and dismissing it as a part of your normal test flow, instead of using [`method: Page.addLocatorHandler`].
|
1091
|
+
# - Playwright checks for the overlay every time before executing or retrying an action that requires an [actionability check](../actionability.md), or before performing an auto-waiting assertion check. When overlay is visible, Playwright calls the handler first, and then proceeds with the action/assertion. Note that the handler is only called when you perform an action/assertion - if the overlay becomes visible but you don't perform any actions, the handler will not be triggered.
|
1092
|
+
# - The execution time of the handler counts towards the timeout of the action/assertion that executed the handler. If your handler takes too long, it might cause timeouts.
|
1093
|
+
# - 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.
|
1090
1094
|
#
|
1091
|
-
# **NOTE**: Running the
|
1095
|
+
# **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.
|
1092
1096
|
# <br />
|
1093
1097
|
# <br />
|
1094
1098
|
# 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
1099
|
# <br />
|
1096
1100
|
# <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
|
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.
|
1098
1102
|
#
|
1099
1103
|
# **Usage**
|
1100
1104
|
#
|
1101
|
-
# An example that closes a
|
1105
|
+
# An example that closes a "Sign up to the newsletter" dialog when it appears:
|
1102
1106
|
#
|
1103
1107
|
# ```python sync
|
1104
1108
|
# # Setup the handler.
|
1105
1109
|
# def handler():
|
1106
|
-
# page.get_by_role("button", name="
|
1107
|
-
# page.add_locator_handler(page.
|
1110
|
+
# page.get_by_role("button", name="No thanks").click()
|
1111
|
+
# page.add_locator_handler(page.get_by_text("Sign up to the newsletter"), handler)
|
1108
1112
|
#
|
1109
1113
|
# # Write the test as usual.
|
1110
1114
|
# page.goto("https://example.com")
|
@@ -1743,6 +1747,16 @@ module Playwright
|
|
1743
1747
|
raise NotImplementedError.new('wait_for_event is not implemented yet.')
|
1744
1748
|
end
|
1745
1749
|
|
1750
|
+
# @nodoc
|
1751
|
+
def owned_context=(req)
|
1752
|
+
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
1753
|
+
end
|
1754
|
+
|
1755
|
+
# @nodoc
|
1756
|
+
def guid
|
1757
|
+
wrap_impl(@impl.guid)
|
1758
|
+
end
|
1759
|
+
|
1746
1760
|
# @nodoc
|
1747
1761
|
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1748
1762
|
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
@@ -1763,14 +1777,10 @@ module Playwright
|
|
1763
1777
|
wrap_impl(@impl.stop_js_coverage)
|
1764
1778
|
end
|
1765
1779
|
|
1780
|
+
# -- inherited from EventEmitter --
|
1766
1781
|
# @nodoc
|
1767
|
-
def
|
1768
|
-
|
1769
|
-
end
|
1770
|
-
|
1771
|
-
# @nodoc
|
1772
|
-
def guid
|
1773
|
-
wrap_impl(@impl.guid)
|
1782
|
+
def on(event, callback)
|
1783
|
+
event_emitter_proxy.on(event, callback)
|
1774
1784
|
end
|
1775
1785
|
|
1776
1786
|
# -- inherited from EventEmitter --
|
@@ -1785,12 +1795,6 @@ module Playwright
|
|
1785
1795
|
event_emitter_proxy.once(event, callback)
|
1786
1796
|
end
|
1787
1797
|
|
1788
|
-
# -- inherited from EventEmitter --
|
1789
|
-
# @nodoc
|
1790
|
-
def on(event, callback)
|
1791
|
-
event_emitter_proxy.on(event, callback)
|
1792
|
-
end
|
1793
|
-
|
1794
1798
|
private def event_emitter_proxy
|
1795
1799
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1796
1800
|
end
|
@@ -105,20 +105,20 @@ module Playwright
|
|
105
105
|
|
106
106
|
# -- inherited from EventEmitter --
|
107
107
|
# @nodoc
|
108
|
-
def
|
109
|
-
event_emitter_proxy.
|
108
|
+
def on(event, callback)
|
109
|
+
event_emitter_proxy.on(event, callback)
|
110
110
|
end
|
111
111
|
|
112
112
|
# -- inherited from EventEmitter --
|
113
113
|
# @nodoc
|
114
|
-
def
|
115
|
-
event_emitter_proxy.
|
114
|
+
def off(event, callback)
|
115
|
+
event_emitter_proxy.off(event, callback)
|
116
116
|
end
|
117
117
|
|
118
118
|
# -- inherited from EventEmitter --
|
119
119
|
# @nodoc
|
120
|
-
def
|
121
|
-
event_emitter_proxy.
|
120
|
+
def once(event, callback)
|
121
|
+
event_emitter_proxy.once(event, callback)
|
122
122
|
end
|
123
123
|
|
124
124
|
private def event_emitter_proxy
|
@@ -207,20 +207,20 @@ module Playwright
|
|
207
207
|
|
208
208
|
# -- inherited from EventEmitter --
|
209
209
|
# @nodoc
|
210
|
-
def
|
211
|
-
event_emitter_proxy.
|
210
|
+
def on(event, callback)
|
211
|
+
event_emitter_proxy.on(event, callback)
|
212
212
|
end
|
213
213
|
|
214
214
|
# -- inherited from EventEmitter --
|
215
215
|
# @nodoc
|
216
|
-
def
|
217
|
-
event_emitter_proxy.
|
216
|
+
def off(event, callback)
|
217
|
+
event_emitter_proxy.off(event, callback)
|
218
218
|
end
|
219
219
|
|
220
220
|
# -- inherited from EventEmitter --
|
221
221
|
# @nodoc
|
222
|
-
def
|
223
|
-
event_emitter_proxy.
|
222
|
+
def once(event, callback)
|
223
|
+
event_emitter_proxy.once(event, callback)
|
224
224
|
end
|
225
225
|
|
226
226
|
private def event_emitter_proxy
|
@@ -129,20 +129,20 @@ module Playwright
|
|
129
129
|
|
130
130
|
# -- inherited from EventEmitter --
|
131
131
|
# @nodoc
|
132
|
-
def
|
133
|
-
event_emitter_proxy.
|
132
|
+
def on(event, callback)
|
133
|
+
event_emitter_proxy.on(event, callback)
|
134
134
|
end
|
135
135
|
|
136
136
|
# -- inherited from EventEmitter --
|
137
137
|
# @nodoc
|
138
|
-
def
|
139
|
-
event_emitter_proxy.
|
138
|
+
def off(event, callback)
|
139
|
+
event_emitter_proxy.off(event, callback)
|
140
140
|
end
|
141
141
|
|
142
142
|
# -- inherited from EventEmitter --
|
143
143
|
# @nodoc
|
144
|
-
def
|
145
|
-
event_emitter_proxy.
|
144
|
+
def once(event, callback)
|
145
|
+
event_emitter_proxy.once(event, callback)
|
146
146
|
end
|
147
147
|
|
148
148
|
private def event_emitter_proxy
|
data/lib/playwright_api/route.rb
CHANGED
@@ -167,20 +167,20 @@ module Playwright
|
|
167
167
|
|
168
168
|
# -- inherited from EventEmitter --
|
169
169
|
# @nodoc
|
170
|
-
def
|
171
|
-
event_emitter_proxy.
|
170
|
+
def on(event, callback)
|
171
|
+
event_emitter_proxy.on(event, callback)
|
172
172
|
end
|
173
173
|
|
174
174
|
# -- inherited from EventEmitter --
|
175
175
|
# @nodoc
|
176
|
-
def
|
177
|
-
event_emitter_proxy.
|
176
|
+
def off(event, callback)
|
177
|
+
event_emitter_proxy.off(event, callback)
|
178
178
|
end
|
179
179
|
|
180
180
|
# -- inherited from EventEmitter --
|
181
181
|
# @nodoc
|
182
|
-
def
|
183
|
-
event_emitter_proxy.
|
182
|
+
def once(event, callback)
|
183
|
+
event_emitter_proxy.once(event, callback)
|
184
184
|
end
|
185
185
|
|
186
186
|
private def event_emitter_proxy
|
@@ -63,20 +63,20 @@ module Playwright
|
|
63
63
|
|
64
64
|
# -- inherited from EventEmitter --
|
65
65
|
# @nodoc
|
66
|
-
def
|
67
|
-
event_emitter_proxy.
|
66
|
+
def on(event, callback)
|
67
|
+
event_emitter_proxy.on(event, callback)
|
68
68
|
end
|
69
69
|
|
70
70
|
# -- inherited from EventEmitter --
|
71
71
|
# @nodoc
|
72
|
-
def
|
73
|
-
event_emitter_proxy.
|
72
|
+
def off(event, callback)
|
73
|
+
event_emitter_proxy.off(event, callback)
|
74
74
|
end
|
75
75
|
|
76
76
|
# -- inherited from EventEmitter --
|
77
77
|
# @nodoc
|
78
|
-
def
|
79
|
-
event_emitter_proxy.
|
78
|
+
def once(event, callback)
|
79
|
+
event_emitter_proxy.once(event, callback)
|
80
80
|
end
|
81
81
|
|
82
82
|
private def event_emitter_proxy
|
@@ -72,20 +72,20 @@ module Playwright
|
|
72
72
|
|
73
73
|
# -- inherited from EventEmitter --
|
74
74
|
# @nodoc
|
75
|
-
def
|
76
|
-
event_emitter_proxy.
|
75
|
+
def on(event, callback)
|
76
|
+
event_emitter_proxy.on(event, callback)
|
77
77
|
end
|
78
78
|
|
79
79
|
# -- inherited from EventEmitter --
|
80
80
|
# @nodoc
|
81
|
-
def
|
82
|
-
event_emitter_proxy.
|
81
|
+
def off(event, callback)
|
82
|
+
event_emitter_proxy.off(event, callback)
|
83
83
|
end
|
84
84
|
|
85
85
|
# -- inherited from EventEmitter --
|
86
86
|
# @nodoc
|
87
|
-
def
|
88
|
-
event_emitter_proxy.
|
87
|
+
def once(event, callback)
|
88
|
+
event_emitter_proxy.once(event, callback)
|
89
89
|
end
|
90
90
|
|
91
91
|
private def event_emitter_proxy
|
@@ -34,20 +34,20 @@ module Playwright
|
|
34
34
|
|
35
35
|
# -- inherited from EventEmitter --
|
36
36
|
# @nodoc
|
37
|
-
def
|
38
|
-
event_emitter_proxy.
|
37
|
+
def on(event, callback)
|
38
|
+
event_emitter_proxy.on(event, callback)
|
39
39
|
end
|
40
40
|
|
41
41
|
# -- inherited from EventEmitter --
|
42
42
|
# @nodoc
|
43
|
-
def
|
44
|
-
event_emitter_proxy.
|
43
|
+
def off(event, callback)
|
44
|
+
event_emitter_proxy.off(event, callback)
|
45
45
|
end
|
46
46
|
|
47
47
|
# -- inherited from EventEmitter --
|
48
48
|
# @nodoc
|
49
|
-
def
|
50
|
-
event_emitter_proxy.
|
49
|
+
def once(event, callback)
|
50
|
+
event_emitter_proxy.once(event, callback)
|
51
51
|
end
|
52
52
|
|
53
53
|
private def event_emitter_proxy
|
@@ -58,20 +58,20 @@ module Playwright
|
|
58
58
|
|
59
59
|
# -- inherited from EventEmitter --
|
60
60
|
# @nodoc
|
61
|
-
def
|
62
|
-
event_emitter_proxy.
|
61
|
+
def on(event, callback)
|
62
|
+
event_emitter_proxy.on(event, callback)
|
63
63
|
end
|
64
64
|
|
65
65
|
# -- inherited from EventEmitter --
|
66
66
|
# @nodoc
|
67
|
-
def
|
68
|
-
event_emitter_proxy.
|
67
|
+
def off(event, callback)
|
68
|
+
event_emitter_proxy.off(event, callback)
|
69
69
|
end
|
70
70
|
|
71
71
|
# -- inherited from EventEmitter --
|
72
72
|
# @nodoc
|
73
|
-
def
|
74
|
-
event_emitter_proxy.
|
73
|
+
def once(event, callback)
|
74
|
+
event_emitter_proxy.once(event, callback)
|
75
75
|
end
|
76
76
|
|
77
77
|
private def event_emitter_proxy
|
data/sig/playwright.rbs
CHANGED
@@ -360,7 +360,7 @@ module Playwright
|
|
360
360
|
def add_init_script: (?path: (String | File), ?script: String) -> void
|
361
361
|
def background_pages: -> Array[untyped]
|
362
362
|
def browser: -> (nil | Browser)
|
363
|
-
def clear_cookies: -> void
|
363
|
+
def clear_cookies: (?domain: (String | Regexp), ?name: (String | Regexp), ?path: (String | Regexp)) -> void
|
364
364
|
def clear_permissions: -> void
|
365
365
|
def close: (?reason: String) -> void
|
366
366
|
def cookies: (?urls: (String | Array[untyped])) -> Array[untyped]
|
@@ -451,6 +451,7 @@ module Playwright
|
|
451
451
|
def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
452
452
|
def element_handle: (?timeout: Float) -> ElementHandle
|
453
453
|
def element_handles: -> Array[untyped]
|
454
|
+
def content_frame: -> FrameLocator
|
454
455
|
def evaluate: (String expression, ?arg: untyped, ?timeout: Float) -> untyped
|
455
456
|
def evaluate_all: (String expression, ?arg: untyped) -> untyped
|
456
457
|
def evaluate_handle: (String expression, ?arg: untyped, ?timeout: Float) -> JSHandle
|
@@ -514,6 +515,7 @@ module Playwright
|
|
514
515
|
def last: -> FrameLocator
|
515
516
|
def locator: ((String | Locator) selectorOrLocator, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
516
517
|
def nth: (Integer index) -> FrameLocator
|
518
|
+
def owner: -> Locator
|
517
519
|
end
|
518
520
|
|
519
521
|
class APIResponse
|
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.43.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-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -407,5 +407,5 @@ requirements: []
|
|
407
407
|
rubygems_version: 3.3.26
|
408
408
|
signing_key:
|
409
409
|
specification_version: 4
|
410
|
-
summary: The Ruby binding of playwright driver 1.
|
410
|
+
summary: The Ruby binding of playwright driver 1.43.1
|
411
411
|
test_files: []
|