playwright-ruby-client 1.18.0 → 1.19.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/api_request.md +7 -0
- data/documentation/docs/api/api_request_context.md +167 -45
- data/documentation/docs/api/api_response.md +104 -0
- data/documentation/docs/api/browser_context.md +4 -0
- data/documentation/docs/api/frame.md +1 -1
- data/documentation/docs/api/frame_locator.md +1 -1
- data/documentation/docs/api/locator.md +10 -2
- data/documentation/docs/api/page.md +9 -1
- data/documentation/docs/api/route.md +1 -0
- data/documentation/docs/api/tracing.md +6 -1
- data/documentation/docs/include/api_coverage.md +32 -14
- data/lib/playwright/api_response_impl.rb +77 -0
- data/lib/playwright/channel_owner.rb +4 -0
- data/lib/playwright/channel_owners/api_request_context.rb +236 -0
- data/lib/playwright/channel_owners/browser_context.rb +13 -10
- data/lib/playwright/channel_owners/frame.rb +2 -2
- data/lib/playwright/channel_owners/page.rb +15 -5
- data/lib/playwright/channel_owners/route.rb +18 -4
- data/lib/playwright/{tracing_impl.rb → channel_owners/tracing.rb} +4 -8
- data/lib/playwright/frame_locator_impl.rb +2 -1
- data/lib/playwright/locator_impl.rb +42 -15
- data/lib/playwright/route_handler.rb +11 -8
- data/lib/playwright/transport.rb +1 -1
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +6 -6
- data/lib/playwright_api/api_request.rb +20 -0
- data/lib/playwright_api/api_request_context.rb +16 -16
- data/lib/playwright_api/api_response.rb +81 -0
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +9 -9
- data/lib/playwright_api/browser_type.rb +6 -6
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +8 -8
- data/lib/playwright_api/frame_locator.rb +2 -2
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +8 -3
- data/lib/playwright_api/page.rb +18 -18
- 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 +8 -7
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/tracing.rb +29 -2
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +6 -6
- metadata +10 -5
@@ -16,13 +16,13 @@ module Playwright
|
|
16
16
|
# # This will launch a new browser, create a context and page. When making HTTP
|
17
17
|
# # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)
|
18
18
|
# # it will automatically set the cookies to the browser page and vise versa.
|
19
|
-
# browser =
|
19
|
+
# browser = p.chromium.launch()
|
20
20
|
# context = browser.new_context(base_url="https://api.github.com")
|
21
21
|
# api_request_context = context.request
|
22
22
|
# page = context.new_page()
|
23
23
|
#
|
24
24
|
# # Alternatively you can create a APIRequestContext manually without having a browser context attached:
|
25
|
-
# # api_request_context =
|
25
|
+
# # api_request_context = p.request.new_context(base_url="https://api.github.com")
|
26
26
|
#
|
27
27
|
#
|
28
28
|
# # Create a repository.
|
@@ -65,14 +65,14 @@ module Playwright
|
|
65
65
|
multipart: nil,
|
66
66
|
params: nil,
|
67
67
|
timeout: nil)
|
68
|
-
|
68
|
+
wrap_impl(@impl.delete(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
69
69
|
end
|
70
70
|
|
71
71
|
# All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you
|
72
72
|
# can later call [`method: APIResponse.body`]. This method discards all stored responses, and makes
|
73
73
|
# [`method: APIResponse.body`] throw "Response disposed" error.
|
74
74
|
def dispose
|
75
|
-
|
75
|
+
wrap_impl(@impl.dispose)
|
76
76
|
end
|
77
77
|
|
78
78
|
# Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
|
@@ -88,7 +88,7 @@ module Playwright
|
|
88
88
|
multipart: nil,
|
89
89
|
params: nil,
|
90
90
|
timeout: nil)
|
91
|
-
|
91
|
+
wrap_impl(@impl.fetch(unwrap_impl(urlOrRequest), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), method: unwrap_impl(method), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
92
92
|
end
|
93
93
|
|
94
94
|
# Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The
|
@@ -101,7 +101,7 @@ module Playwright
|
|
101
101
|
ignoreHTTPSErrors: nil,
|
102
102
|
params: nil,
|
103
103
|
timeout: nil)
|
104
|
-
|
104
|
+
wrap_impl(@impl.get(unwrap_impl(url), failOnStatusCode: unwrap_impl(failOnStatusCode), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
105
105
|
end
|
106
106
|
|
107
107
|
# Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.
|
@@ -114,7 +114,7 @@ module Playwright
|
|
114
114
|
ignoreHTTPSErrors: nil,
|
115
115
|
params: nil,
|
116
116
|
timeout: nil)
|
117
|
-
|
117
|
+
wrap_impl(@impl.head(unwrap_impl(url), failOnStatusCode: unwrap_impl(failOnStatusCode), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
118
118
|
end
|
119
119
|
|
120
120
|
# Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.
|
@@ -130,7 +130,7 @@ module Playwright
|
|
130
130
|
multipart: nil,
|
131
131
|
params: nil,
|
132
132
|
timeout: nil)
|
133
|
-
|
133
|
+
wrap_impl(@impl.patch(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
134
134
|
end
|
135
135
|
|
136
136
|
# Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
|
@@ -146,7 +146,7 @@ module Playwright
|
|
146
146
|
multipart: nil,
|
147
147
|
params: nil,
|
148
148
|
timeout: nil)
|
149
|
-
|
149
|
+
wrap_impl(@impl.post(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
150
150
|
end
|
151
151
|
|
152
152
|
# Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The
|
@@ -162,7 +162,7 @@ module Playwright
|
|
162
162
|
multipart: nil,
|
163
163
|
params: nil,
|
164
164
|
timeout: nil)
|
165
|
-
|
165
|
+
wrap_impl(@impl.put(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
|
166
166
|
end
|
167
167
|
|
168
168
|
# Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to
|
@@ -173,20 +173,20 @@ module Playwright
|
|
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
|
# -- inherited from EventEmitter --
|
187
187
|
# @nodoc
|
188
|
-
def
|
189
|
-
event_emitter_proxy.
|
188
|
+
def on(event, callback)
|
189
|
+
event_emitter_proxy.on(event, callback)
|
190
190
|
end
|
191
191
|
|
192
192
|
private def event_emitter_proxy
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Playwright
|
2
|
+
# `APIResponse` class represents responses returned by [`method: APIRequestContext.get`] and similar methods.
|
3
|
+
#
|
4
|
+
# ```python sync
|
5
|
+
# from playwright.sync_api import sync_playwright
|
6
|
+
#
|
7
|
+
# with sync_playwright() as p:
|
8
|
+
# context = playwright.request.new_context()
|
9
|
+
# response = context.get("https://example.com/user/repos")
|
10
|
+
# assert response.ok
|
11
|
+
# assert response.status == 200
|
12
|
+
# assert response.headers["content-type"] == "application/json; charset=utf-8"
|
13
|
+
# assert response.json()["name"] == "foobar"
|
14
|
+
# assert response.body() == '{"status": "ok"}'
|
15
|
+
# ```
|
16
|
+
class APIResponse < PlaywrightApi
|
17
|
+
|
18
|
+
# Returns the buffer with response body.
|
19
|
+
def body
|
20
|
+
wrap_impl(@impl.body)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Disposes the body of this response. If not called then the body will stay in memory until the context closes.
|
24
|
+
def dispose
|
25
|
+
wrap_impl(@impl.dispose)
|
26
|
+
end
|
27
|
+
|
28
|
+
# An object with all the response HTTP headers associated with this response.
|
29
|
+
def headers
|
30
|
+
wrap_impl(@impl.headers)
|
31
|
+
end
|
32
|
+
|
33
|
+
# An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with
|
34
|
+
# multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
35
|
+
def headers_array
|
36
|
+
wrap_impl(@impl.headers_array)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the JSON representation of response body.
|
40
|
+
#
|
41
|
+
# This method will throw if the response body is not parsable via `JSON.parse`.
|
42
|
+
def json
|
43
|
+
wrap_impl(@impl.json)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
|
47
|
+
def ok
|
48
|
+
wrap_impl(@impl.ok)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Contains the status code of the response (e.g., 200 for a success).
|
52
|
+
def status
|
53
|
+
wrap_impl(@impl.status)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Contains the status text of the response (e.g. usually an "OK" for a success).
|
57
|
+
def status_text
|
58
|
+
wrap_impl(@impl.status_text)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns the text representation of response body.
|
62
|
+
def text
|
63
|
+
wrap_impl(@impl.text)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Contains the URL of the response.
|
67
|
+
def url
|
68
|
+
wrap_impl(@impl.url)
|
69
|
+
end
|
70
|
+
|
71
|
+
# @nodoc
|
72
|
+
def ok?
|
73
|
+
wrap_impl(@impl.ok?)
|
74
|
+
end
|
75
|
+
|
76
|
+
# @nodoc
|
77
|
+
def to_s
|
78
|
+
wrap_impl(@impl.to_s)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -168,20 +168,20 @@ module Playwright
|
|
168
168
|
|
169
169
|
# -- inherited from EventEmitter --
|
170
170
|
# @nodoc
|
171
|
-
def
|
172
|
-
event_emitter_proxy.
|
171
|
+
def off(event, callback)
|
172
|
+
event_emitter_proxy.off(event, callback)
|
173
173
|
end
|
174
174
|
|
175
175
|
# -- inherited from EventEmitter --
|
176
176
|
# @nodoc
|
177
|
-
def
|
178
|
-
event_emitter_proxy.
|
177
|
+
def once(event, callback)
|
178
|
+
event_emitter_proxy.once(event, callback)
|
179
179
|
end
|
180
180
|
|
181
181
|
# -- inherited from EventEmitter --
|
182
182
|
# @nodoc
|
183
|
-
def
|
184
|
-
event_emitter_proxy.
|
183
|
+
def on(event, callback)
|
184
|
+
event_emitter_proxy.on(event, callback)
|
185
185
|
end
|
186
186
|
|
187
187
|
private def event_emitter_proxy
|
@@ -22,7 +22,7 @@ module Playwright
|
|
22
22
|
|
23
23
|
# API testing helper associated with this context. Requests made with this API will use context cookies.
|
24
24
|
def request # property
|
25
|
-
|
25
|
+
wrap_impl(@impl.request)
|
26
26
|
end
|
27
27
|
|
28
28
|
def tracing # property
|
@@ -376,6 +376,11 @@ module Playwright
|
|
376
376
|
wrap_impl(@impl.pause)
|
377
377
|
end
|
378
378
|
|
379
|
+
# @nodoc
|
380
|
+
def enable_debug_console!
|
381
|
+
wrap_impl(@impl.enable_debug_console!)
|
382
|
+
end
|
383
|
+
|
379
384
|
# @nodoc
|
380
385
|
def browser=(req)
|
381
386
|
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
@@ -391,9 +396,10 @@ module Playwright
|
|
391
396
|
wrap_impl(@impl.options=(unwrap_impl(req)))
|
392
397
|
end
|
393
398
|
|
399
|
+
# -- inherited from EventEmitter --
|
394
400
|
# @nodoc
|
395
|
-
def
|
396
|
-
|
401
|
+
def off(event, callback)
|
402
|
+
event_emitter_proxy.off(event, callback)
|
397
403
|
end
|
398
404
|
|
399
405
|
# -- inherited from EventEmitter --
|
@@ -408,12 +414,6 @@ module Playwright
|
|
408
414
|
event_emitter_proxy.on(event, callback)
|
409
415
|
end
|
410
416
|
|
411
|
-
# -- inherited from EventEmitter --
|
412
|
-
# @nodoc
|
413
|
-
def off(event, callback)
|
414
|
-
event_emitter_proxy.off(event, callback)
|
415
|
-
end
|
416
|
-
|
417
417
|
private def event_emitter_proxy
|
418
418
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
419
419
|
end
|
@@ -148,20 +148,20 @@ module Playwright
|
|
148
148
|
|
149
149
|
# -- inherited from EventEmitter --
|
150
150
|
# @nodoc
|
151
|
-
def
|
152
|
-
event_emitter_proxy.
|
151
|
+
def off(event, callback)
|
152
|
+
event_emitter_proxy.off(event, callback)
|
153
153
|
end
|
154
154
|
|
155
155
|
# -- inherited from EventEmitter --
|
156
156
|
# @nodoc
|
157
|
-
def
|
158
|
-
event_emitter_proxy.
|
157
|
+
def once(event, callback)
|
158
|
+
event_emitter_proxy.once(event, callback)
|
159
159
|
end
|
160
160
|
|
161
161
|
# -- inherited from EventEmitter --
|
162
162
|
# @nodoc
|
163
|
-
def
|
164
|
-
event_emitter_proxy.
|
163
|
+
def on(event, callback)
|
164
|
+
event_emitter_proxy.on(event, callback)
|
165
165
|
end
|
166
166
|
|
167
167
|
private def event_emitter_proxy
|
@@ -35,20 +35,20 @@ module Playwright
|
|
35
35
|
|
36
36
|
# -- inherited from EventEmitter --
|
37
37
|
# @nodoc
|
38
|
-
def
|
39
|
-
event_emitter_proxy.
|
38
|
+
def off(event, callback)
|
39
|
+
event_emitter_proxy.off(event, callback)
|
40
40
|
end
|
41
41
|
|
42
42
|
# -- inherited from EventEmitter --
|
43
43
|
# @nodoc
|
44
|
-
def
|
45
|
-
event_emitter_proxy.
|
44
|
+
def once(event, callback)
|
45
|
+
event_emitter_proxy.once(event, callback)
|
46
46
|
end
|
47
47
|
|
48
48
|
# -- inherited from EventEmitter --
|
49
49
|
# @nodoc
|
50
|
-
def
|
51
|
-
event_emitter_proxy.
|
50
|
+
def on(event, callback)
|
51
|
+
event_emitter_proxy.on(event, callback)
|
52
52
|
end
|
53
53
|
|
54
54
|
private def event_emitter_proxy
|
@@ -25,20 +25,20 @@ module Playwright
|
|
25
25
|
|
26
26
|
# -- inherited from EventEmitter --
|
27
27
|
# @nodoc
|
28
|
-
def
|
29
|
-
event_emitter_proxy.
|
28
|
+
def off(event, callback)
|
29
|
+
event_emitter_proxy.off(event, callback)
|
30
30
|
end
|
31
31
|
|
32
32
|
# -- inherited from EventEmitter --
|
33
33
|
# @nodoc
|
34
|
-
def
|
35
|
-
event_emitter_proxy.
|
34
|
+
def once(event, callback)
|
35
|
+
event_emitter_proxy.once(event, callback)
|
36
36
|
end
|
37
37
|
|
38
38
|
# -- inherited from EventEmitter --
|
39
39
|
# @nodoc
|
40
|
-
def
|
41
|
-
event_emitter_proxy.
|
40
|
+
def on(event, callback)
|
41
|
+
event_emitter_proxy.on(event, callback)
|
42
42
|
end
|
43
43
|
|
44
44
|
private def event_emitter_proxy
|
@@ -60,20 +60,20 @@ module Playwright
|
|
60
60
|
|
61
61
|
# -- inherited from EventEmitter --
|
62
62
|
# @nodoc
|
63
|
-
def
|
64
|
-
event_emitter_proxy.
|
63
|
+
def off(event, callback)
|
64
|
+
event_emitter_proxy.off(event, callback)
|
65
65
|
end
|
66
66
|
|
67
67
|
# -- inherited from EventEmitter --
|
68
68
|
# @nodoc
|
69
|
-
def
|
70
|
-
event_emitter_proxy.
|
69
|
+
def once(event, callback)
|
70
|
+
event_emitter_proxy.once(event, callback)
|
71
71
|
end
|
72
72
|
|
73
73
|
# -- inherited from EventEmitter --
|
74
74
|
# @nodoc
|
75
|
-
def
|
76
|
-
event_emitter_proxy.
|
75
|
+
def on(event, callback)
|
76
|
+
event_emitter_proxy.on(event, callback)
|
77
77
|
end
|
78
78
|
|
79
79
|
private def event_emitter_proxy
|
@@ -553,20 +553,20 @@ module Playwright
|
|
553
553
|
|
554
554
|
# -- inherited from EventEmitter --
|
555
555
|
# @nodoc
|
556
|
-
def
|
557
|
-
event_emitter_proxy.
|
556
|
+
def off(event, callback)
|
557
|
+
event_emitter_proxy.off(event, callback)
|
558
558
|
end
|
559
559
|
|
560
560
|
# -- inherited from EventEmitter --
|
561
561
|
# @nodoc
|
562
|
-
def
|
563
|
-
event_emitter_proxy.
|
562
|
+
def once(event, callback)
|
563
|
+
event_emitter_proxy.once(event, callback)
|
564
564
|
end
|
565
565
|
|
566
566
|
# -- inherited from EventEmitter --
|
567
567
|
# @nodoc
|
568
|
-
def
|
569
|
-
event_emitter_proxy.
|
568
|
+
def on(event, callback)
|
569
|
+
event_emitter_proxy.on(event, callback)
|
570
570
|
end
|
571
571
|
|
572
572
|
private def event_emitter_proxy
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -445,8 +445,8 @@ module Playwright
|
|
445
445
|
# The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
446
446
|
# element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
447
447
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
448
|
-
def locator(selector, hasText: nil)
|
449
|
-
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
448
|
+
def locator(selector, has: nil, hasText: nil)
|
449
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
450
450
|
end
|
451
451
|
|
452
452
|
# Returns frame's name attribute as specified in the tag.
|
@@ -790,20 +790,20 @@ module Playwright
|
|
790
790
|
|
791
791
|
# -- inherited from EventEmitter --
|
792
792
|
# @nodoc
|
793
|
-
def
|
794
|
-
event_emitter_proxy.
|
793
|
+
def off(event, callback)
|
794
|
+
event_emitter_proxy.off(event, callback)
|
795
795
|
end
|
796
796
|
|
797
797
|
# -- inherited from EventEmitter --
|
798
798
|
# @nodoc
|
799
|
-
def
|
800
|
-
event_emitter_proxy.
|
799
|
+
def once(event, callback)
|
800
|
+
event_emitter_proxy.once(event, callback)
|
801
801
|
end
|
802
802
|
|
803
803
|
# -- inherited from EventEmitter --
|
804
804
|
# @nodoc
|
805
|
-
def
|
806
|
-
event_emitter_proxy.
|
805
|
+
def on(event, callback)
|
806
|
+
event_emitter_proxy.on(event, callback)
|
807
807
|
end
|
808
808
|
|
809
809
|
private def event_emitter_proxy
|
@@ -48,8 +48,8 @@ module Playwright
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# The method finds an element matching the specified selector in the FrameLocator's subtree.
|
51
|
-
def locator(selector, hasText: nil)
|
52
|
-
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
51
|
+
def locator(selector, has: nil, hasText: nil)
|
52
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns locator to the n-th matching frame.
|
@@ -90,20 +90,20 @@ module Playwright
|
|
90
90
|
|
91
91
|
# -- inherited from EventEmitter --
|
92
92
|
# @nodoc
|
93
|
-
def
|
94
|
-
event_emitter_proxy.
|
93
|
+
def off(event, callback)
|
94
|
+
event_emitter_proxy.off(event, callback)
|
95
95
|
end
|
96
96
|
|
97
97
|
# -- inherited from EventEmitter --
|
98
98
|
# @nodoc
|
99
|
-
def
|
100
|
-
event_emitter_proxy.
|
99
|
+
def once(event, callback)
|
100
|
+
event_emitter_proxy.once(event, callback)
|
101
101
|
end
|
102
102
|
|
103
103
|
# -- inherited from EventEmitter --
|
104
104
|
# @nodoc
|
105
|
-
def
|
106
|
-
event_emitter_proxy.
|
105
|
+
def on(event, callback)
|
106
|
+
event_emitter_proxy.on(event, callback)
|
107
107
|
end
|
108
108
|
|
109
109
|
private def event_emitter_proxy
|
@@ -238,7 +238,7 @@ module Playwright
|
|
238
238
|
# that iframe:
|
239
239
|
#
|
240
240
|
# ```python sync
|
241
|
-
# locator = page.frame_locator("
|
241
|
+
# locator = page.frame_locator("iframe").locator("text=Submit")
|
242
242
|
# locator.click()
|
243
243
|
# ```
|
244
244
|
def frame_locator(selector)
|
@@ -320,8 +320,8 @@ module Playwright
|
|
320
320
|
end
|
321
321
|
|
322
322
|
# The method finds an element matching the specified selector in the `Locator`'s subtree.
|
323
|
-
def locator(selector, hasText: nil)
|
324
|
-
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
323
|
+
def locator(selector, has: nil, hasText: nil)
|
324
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
325
325
|
end
|
326
326
|
|
327
327
|
# Returns locator to the n-th matching element.
|
@@ -329,6 +329,11 @@ module Playwright
|
|
329
329
|
wrap_impl(@impl.nth(unwrap_impl(index)))
|
330
330
|
end
|
331
331
|
|
332
|
+
# A page this locator belongs to.
|
333
|
+
def page
|
334
|
+
wrap_impl(@impl.page)
|
335
|
+
end
|
336
|
+
|
332
337
|
# Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
|
333
338
|
#
|
334
339
|
# `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
|
data/lib/playwright_api/page.rb
CHANGED
@@ -58,7 +58,7 @@ module Playwright
|
|
58
58
|
|
59
59
|
# API testing helper associated with this page. Requests made with this API will use page cookies.
|
60
60
|
def request # property
|
61
|
-
|
61
|
+
wrap_impl(@impl.request)
|
62
62
|
end
|
63
63
|
|
64
64
|
def touchscreen # property
|
@@ -686,8 +686,8 @@ module Playwright
|
|
686
686
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
687
687
|
#
|
688
688
|
# Shortcut for main frame's [`method: Frame.locator`].
|
689
|
-
def locator(selector, hasText: nil)
|
690
|
-
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
689
|
+
def locator(selector, has: nil, hasText: nil)
|
690
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
691
691
|
end
|
692
692
|
|
693
693
|
# The page's main frame. Page is guaranteed to have a main frame which persists during navigations.
|
@@ -1282,7 +1282,7 @@ module Playwright
|
|
1282
1282
|
# return response.ok
|
1283
1283
|
#
|
1284
1284
|
# # or with a lambda
|
1285
|
-
# with page.expect_response(lambda response: response.url == "https://example.com" and response.status
|
1285
|
+
# with page.expect_response(lambda response: response.url == "https://example.com" and response.status == 200) as response_info:
|
1286
1286
|
# page.click("input")
|
1287
1287
|
# response = response_info.value
|
1288
1288
|
# return response.ok
|
@@ -1387,23 +1387,23 @@ module Playwright
|
|
1387
1387
|
end
|
1388
1388
|
|
1389
1389
|
# @nodoc
|
1390
|
-
def
|
1391
|
-
wrap_impl(@impl.
|
1390
|
+
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1391
|
+
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1392
1392
|
end
|
1393
1393
|
|
1394
1394
|
# @nodoc
|
1395
|
-
def
|
1396
|
-
wrap_impl(@impl.
|
1395
|
+
def stop_css_coverage
|
1396
|
+
wrap_impl(@impl.stop_css_coverage)
|
1397
1397
|
end
|
1398
1398
|
|
1399
1399
|
# @nodoc
|
1400
|
-
def
|
1401
|
-
wrap_impl(@impl.
|
1400
|
+
def stop_js_coverage
|
1401
|
+
wrap_impl(@impl.stop_js_coverage)
|
1402
1402
|
end
|
1403
1403
|
|
1404
1404
|
# @nodoc
|
1405
|
-
def
|
1406
|
-
wrap_impl(@impl.
|
1405
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1406
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1407
1407
|
end
|
1408
1408
|
|
1409
1409
|
# @nodoc
|
@@ -1413,20 +1413,20 @@ module Playwright
|
|
1413
1413
|
|
1414
1414
|
# -- inherited from EventEmitter --
|
1415
1415
|
# @nodoc
|
1416
|
-
def
|
1417
|
-
event_emitter_proxy.
|
1416
|
+
def off(event, callback)
|
1417
|
+
event_emitter_proxy.off(event, callback)
|
1418
1418
|
end
|
1419
1419
|
|
1420
1420
|
# -- inherited from EventEmitter --
|
1421
1421
|
# @nodoc
|
1422
|
-
def
|
1423
|
-
event_emitter_proxy.
|
1422
|
+
def once(event, callback)
|
1423
|
+
event_emitter_proxy.once(event, callback)
|
1424
1424
|
end
|
1425
1425
|
|
1426
1426
|
# -- inherited from EventEmitter --
|
1427
1427
|
# @nodoc
|
1428
|
-
def
|
1429
|
-
event_emitter_proxy.
|
1428
|
+
def on(event, callback)
|
1429
|
+
event_emitter_proxy.on(event, callback)
|
1430
1430
|
end
|
1431
1431
|
|
1432
1432
|
private def event_emitter_proxy
|
@@ -86,14 +86,20 @@ module Playwright
|
|
86
86
|
raise NotImplementedError.new('stop is not implemented yet.')
|
87
87
|
end
|
88
88
|
|
89
|
+
# @nodoc
|
90
|
+
def electron
|
91
|
+
wrap_impl(@impl.electron)
|
92
|
+
end
|
93
|
+
|
89
94
|
# @nodoc
|
90
95
|
def android
|
91
96
|
wrap_impl(@impl.android)
|
92
97
|
end
|
93
98
|
|
99
|
+
# -- inherited from EventEmitter --
|
94
100
|
# @nodoc
|
95
|
-
def
|
96
|
-
|
101
|
+
def off(event, callback)
|
102
|
+
event_emitter_proxy.off(event, callback)
|
97
103
|
end
|
98
104
|
|
99
105
|
# -- inherited from EventEmitter --
|
@@ -108,12 +114,6 @@ module Playwright
|
|
108
114
|
event_emitter_proxy.on(event, callback)
|
109
115
|
end
|
110
116
|
|
111
|
-
# -- inherited from EventEmitter --
|
112
|
-
# @nodoc
|
113
|
-
def off(event, callback)
|
114
|
-
event_emitter_proxy.off(event, callback)
|
115
|
-
end
|
116
|
-
|
117
117
|
private def event_emitter_proxy
|
118
118
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
119
119
|
end
|
@@ -156,20 +156,20 @@ module Playwright
|
|
156
156
|
|
157
157
|
# -- inherited from EventEmitter --
|
158
158
|
# @nodoc
|
159
|
-
def
|
160
|
-
event_emitter_proxy.
|
159
|
+
def off(event, callback)
|
160
|
+
event_emitter_proxy.off(event, callback)
|
161
161
|
end
|
162
162
|
|
163
163
|
# -- inherited from EventEmitter --
|
164
164
|
# @nodoc
|
165
|
-
def
|
166
|
-
event_emitter_proxy.
|
165
|
+
def once(event, callback)
|
166
|
+
event_emitter_proxy.once(event, callback)
|
167
167
|
end
|
168
168
|
|
169
169
|
# -- inherited from EventEmitter --
|
170
170
|
# @nodoc
|
171
|
-
def
|
172
|
-
event_emitter_proxy.
|
171
|
+
def on(event, callback)
|
172
|
+
event_emitter_proxy.on(event, callback)
|
173
173
|
end
|
174
174
|
|
175
175
|
private def event_emitter_proxy
|