playwright-ruby-client 1.17.0 → 1.18.beta1
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_context.md +49 -0
- data/documentation/docs/api/download.md +1 -3
- data/documentation/docs/api/frame.md +1 -1
- data/documentation/docs/api/frame_locator.md +10 -1
- data/documentation/docs/api/locator.md +19 -47
- data/documentation/docs/api/page.md +1 -1
- data/documentation/docs/include/api_coverage.md +5 -0
- data/lib/playwright/channel_owners/browser_context.rb +5 -0
- data/lib/playwright/channel_owners/frame.rb +2 -2
- data/lib/playwright/channel_owners/local_utils.rb +14 -0
- data/lib/playwright/channel_owners/page.rb +2 -2
- data/lib/playwright/frame_locator_impl.rb +2 -1
- data/lib/playwright/locator_impl.rb +62 -3
- data/lib/playwright/tracing_impl.rb +21 -7
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +8 -8
- data/lib/playwright_api/api_request_context.rb +53 -6
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +10 -10
- 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/download.rb +0 -4
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +8 -8
- data/lib/playwright_api/frame_locator.rb +11 -2
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/local_utils.rb +9 -0
- data/lib/playwright_api/locator.rb +16 -46
- data/lib/playwright_api/page.rb +17 -12
- 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/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- data/playwright.gemspec +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36a3c1f293b4d9a4a27ac780ebce4eb4098af2cefeba6d4e66f4ddb8c49490d7
|
4
|
+
data.tar.gz: 3520c8afc689c71a27d9af6516461cb1871a206bc6c416aee5f99742217191c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a7ff8c2880d9ce5bad599f102e5a0c4e710eaa25f9d5c9323cbd579cfaac6a4252eef9321a0ee453f0200fb2ac985f79f00c5ddb5717549a8d78c5f3348afe
|
7
|
+
data.tar.gz: b589f69e462f5dfba205af8ee98cb58a6bcb35b4ea6742fa8bd3f3bc26e4783e9ee7cbed2fe8dced6272c64de144465d767b00859e32f602ecb08b28b2cfc399
|
@@ -8,3 +8,52 @@ This API is used for the Web API testing. You can use it to trigger API endpoint
|
|
8
8
|
environment or the service to your e2e test. When used on [Page](./page) or a [BrowserContext](./browser_context), this API will automatically use
|
9
9
|
the cookies from the corresponding [BrowserContext](./browser_context). This means that if you log in using this API, your e2e test will be
|
10
10
|
logged in and vice versa.
|
11
|
+
|
12
|
+
```python sync title=example_6db210740dd2dcb4551c2207b3204fde7127b24c7850226b273d15c0d6624ba5.py
|
13
|
+
import os
|
14
|
+
from playwright.sync_api import sync_playwright
|
15
|
+
|
16
|
+
REPO = "test-repo-1"
|
17
|
+
USER = "github-username"
|
18
|
+
API_TOKEN = os.getenv("GITHUB_API_TOKEN")
|
19
|
+
|
20
|
+
with sync_playwright() as p:
|
21
|
+
# This will launch a new browser, create a context and page. When making HTTP
|
22
|
+
# requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)
|
23
|
+
# it will automatically set the cookies to the browser page and vise versa.
|
24
|
+
browser = playwright.chromium.launch()
|
25
|
+
context = browser.new_context(base_url="https://api.github.com")
|
26
|
+
api_request_context = context.request
|
27
|
+
page = context.new_page()
|
28
|
+
|
29
|
+
# Alternatively you can create a APIRequestContext manually without having a browser context attached:
|
30
|
+
# api_request_context = playwright.request.new_context(base_url="https://api.github.com")
|
31
|
+
|
32
|
+
|
33
|
+
# Create a repository.
|
34
|
+
response = api_request_context.post(
|
35
|
+
"/user/repos",
|
36
|
+
headers={
|
37
|
+
"Accept": "application/vnd.github.v3+json",
|
38
|
+
# Add GitHub personal access token.
|
39
|
+
"Authorization": f"token {API_TOKEN}",
|
40
|
+
},
|
41
|
+
data={"name": REPO},
|
42
|
+
)
|
43
|
+
assert response.ok
|
44
|
+
assert response.json()["name"] == REPO
|
45
|
+
|
46
|
+
# Delete a repository.
|
47
|
+
response = api_request_context.delete(
|
48
|
+
f"/repos/{USER}/{REPO}",
|
49
|
+
headers={
|
50
|
+
"Accept": "application/vnd.github.v3+json",
|
51
|
+
# Add GitHub personal access token.
|
52
|
+
"Authorization": f"token {API_TOKEN}",
|
53
|
+
},
|
54
|
+
)
|
55
|
+
assert response.ok
|
56
|
+
assert await response.body() == '{"status": "ok"}'
|
57
|
+
|
58
|
+
```
|
59
|
+
|
@@ -19,9 +19,7 @@ end
|
|
19
19
|
path = download.path
|
20
20
|
```
|
21
21
|
|
22
|
-
|
23
|
-
downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not
|
24
|
-
performed and user has no access to the downloaded files.
|
22
|
+
|
25
23
|
|
26
24
|
## cancel
|
27
25
|
|
@@ -26,6 +26,15 @@ page.frame_locator('.result-frame').locator('button').click
|
|
26
26
|
page.frame_locator('.result-frame').first.locator('button').click
|
27
27
|
```
|
28
28
|
|
29
|
+
**Converting Locator to FrameLocator**
|
30
|
+
|
31
|
+
If you have a [Locator](./locator) object pointing to an `iframe` it can be converted to [FrameLocator](./frame_locator) using
|
32
|
+
[`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) CSS selector:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
frame_locator = locator.frame_locator(':scope')
|
36
|
+
```
|
37
|
+
|
29
38
|
|
30
39
|
|
31
40
|
## first
|
@@ -56,7 +65,7 @@ Returns locator to the last matching frame.
|
|
56
65
|
## locator
|
57
66
|
|
58
67
|
```
|
59
|
-
def locator(selector)
|
68
|
+
def locator(selector, hasText: nil)
|
60
69
|
```
|
61
70
|
|
62
71
|
The method finds an element matching the specified selector in the FrameLocator's subtree.
|
@@ -4,53 +4,10 @@ sidebar_position: 10
|
|
4
4
|
|
5
5
|
# Locator
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
locator = page.locator("text=Submit")
|
12
|
-
locator.click
|
13
|
-
```
|
14
|
-
|
15
|
-
The difference between the Locator and [ElementHandle](./element_handle) is that the latter points to a particular element, while Locator
|
16
|
-
captures the logic of how to retrieve that element.
|
17
|
-
|
18
|
-
In the example below, handle points to a particular DOM element on page. If that element changes text or is used by
|
19
|
-
React to render an entirely different component, handle is still pointing to that very DOM element. This can lead to
|
20
|
-
unexpected behaviors.
|
21
|
-
|
22
|
-
```ruby
|
23
|
-
handle = page.query_selector("text=Submit")
|
24
|
-
handle.hover
|
25
|
-
handle.click
|
26
|
-
```
|
27
|
-
|
28
|
-
With the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So
|
29
|
-
in the snippet below, underlying DOM element is going to be located twice.
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
locator = page.locator("text=Submit")
|
33
|
-
locator.hover
|
34
|
-
locator.click
|
35
|
-
```
|
36
|
-
|
37
|
-
**Strictness**
|
38
|
-
|
39
|
-
Locators are strict. This means that all operations on locators that imply some target DOM element will throw if more
|
40
|
-
than one element matches given selector.
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
# Throws if there are several buttons in DOM:
|
44
|
-
page.locator('button').click
|
45
|
-
|
46
|
-
# Works because we explicitly tell locator to pick the first element:
|
47
|
-
page.locator('button').first.click
|
48
|
-
|
49
|
-
# Works because count knows what to do with multiple matches:
|
50
|
-
page.locator('button').count
|
51
|
-
```
|
52
|
-
|
7
|
+
Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent a way
|
8
|
+
to find element(s) on the page at any moment. Locator can be created with the [Page#locator](./page#locator) method.
|
53
9
|
|
10
|
+
[Learn more about locators](https://playwright.dev/python/docs/locators).
|
54
11
|
|
55
12
|
## all_inner_texts
|
56
13
|
|
@@ -220,6 +177,21 @@ element.dispatch_event("dragstart", eventInit: { dataTransfer: data_transfer })
|
|
220
177
|
|
221
178
|
|
222
179
|
|
180
|
+
## drag_to
|
181
|
+
|
182
|
+
```
|
183
|
+
def drag_to(
|
184
|
+
target,
|
185
|
+
force: nil,
|
186
|
+
noWaitAfter: nil,
|
187
|
+
sourcePosition: nil,
|
188
|
+
targetPosition: nil,
|
189
|
+
timeout: nil,
|
190
|
+
trial: nil)
|
191
|
+
```
|
192
|
+
|
193
|
+
|
194
|
+
|
223
195
|
## element_handle
|
224
196
|
|
225
197
|
```
|
@@ -458,7 +430,7 @@ Returns locator to the last matching element.
|
|
458
430
|
## locator
|
459
431
|
|
460
432
|
```
|
461
|
-
def locator(selector)
|
433
|
+
def locator(selector, hasText: nil)
|
462
434
|
```
|
463
435
|
|
464
436
|
The method finds an element matching the specified selector in the [Locator](./locator)'s subtree.
|
@@ -331,6 +331,7 @@
|
|
331
331
|
* accessibility
|
332
332
|
* keyboard
|
333
333
|
* mouse
|
334
|
+
* ~~request~~
|
334
335
|
* touchscreen
|
335
336
|
|
336
337
|
## BrowserContext
|
@@ -417,6 +418,7 @@
|
|
417
418
|
* count
|
418
419
|
* dblclick
|
419
420
|
* dispatch_event
|
421
|
+
* drag_to
|
420
422
|
* element_handle
|
421
423
|
* element_handles
|
422
424
|
* evaluate
|
@@ -461,6 +463,9 @@
|
|
461
463
|
* locator
|
462
464
|
* nth
|
463
465
|
|
466
|
+
## LocalUtils
|
467
|
+
|
468
|
+
|
464
469
|
## Android
|
465
470
|
|
466
471
|
* devices
|
@@ -400,8 +400,8 @@ module Playwright
|
|
400
400
|
nil
|
401
401
|
end
|
402
402
|
|
403
|
-
def locator(selector)
|
404
|
-
LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector)
|
403
|
+
def locator(selector, hasText: nil)
|
404
|
+
LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector, hasText: hasText)
|
405
405
|
end
|
406
406
|
|
407
407
|
def frame_locator(selector)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Playwright
|
2
|
+
define_channel_owner :LocalUtils do
|
3
|
+
# @param zip_file [String]
|
4
|
+
# @param name_value_array [Array<Hash<{name: string, value: string}>>]
|
5
|
+
def zip(zip_file, name_value_array)
|
6
|
+
params = {
|
7
|
+
zipFile: zip_file,
|
8
|
+
entries: name_value_array,
|
9
|
+
}
|
10
|
+
@channel.send_message_to_server('zip', params)
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -6,11 +6,12 @@ module Playwright
|
|
6
6
|
@frame_selector = frame_selector
|
7
7
|
end
|
8
8
|
|
9
|
-
def locator(selector)
|
9
|
+
def locator(selector, hasText: nil)
|
10
10
|
LocatorImpl.new(
|
11
11
|
frame: @frame,
|
12
12
|
timeout_settings: @timeout_settings,
|
13
13
|
selector: "#{@frame_selector} >> control=enter-frame >> #{selector}",
|
14
|
+
hasText: hasText,
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
@@ -1,9 +1,46 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Playwright
|
4
|
+
class EscapeWithQuotes
|
5
|
+
def initialize(text, char = "'")
|
6
|
+
stringified = text.to_json
|
7
|
+
escaped_text = stringified[1...-1].gsub(/\\"/, '"')
|
8
|
+
|
9
|
+
case char
|
10
|
+
when '"'
|
11
|
+
text = escaped_text.gsub(/["]/, '\\"')
|
12
|
+
@text = "\"#{text}\""
|
13
|
+
when "'"
|
14
|
+
text = escaped_text.gsub(/[']/, '\\\'')
|
15
|
+
@text = "'#{text}'"
|
16
|
+
else
|
17
|
+
raise ArgumentError.new('Invalid escape char')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
@text
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
2
26
|
define_api_implementation :LocatorImpl do
|
3
|
-
def initialize(frame:, timeout_settings:, selector:)
|
27
|
+
def initialize(frame:, timeout_settings:, selector:, hasText: nil)
|
4
28
|
@frame = frame
|
5
29
|
@timeout_settings = timeout_settings
|
6
|
-
@selector =
|
30
|
+
@selector =
|
31
|
+
case hasText
|
32
|
+
when Regexp
|
33
|
+
source = EscapeWithQuotes.new(hasText.source, '"')
|
34
|
+
flags = []
|
35
|
+
flags << 'ms' if (hasText.options & Regexp::MULTILINE) != 0
|
36
|
+
flags << 'i' if (hasText.options & Regexp::IGNORECASE) != 0
|
37
|
+
"#{selector} >> :scope:text-matches(#{source}, \"#{flags.join('')}\")"
|
38
|
+
when String
|
39
|
+
text = EscapeWithQuotes.new(hasText, '"')
|
40
|
+
"#{selector} >> :scope:has-text(#{text})"
|
41
|
+
else
|
42
|
+
selector
|
43
|
+
end
|
7
44
|
end
|
8
45
|
|
9
46
|
def to_s
|
@@ -102,6 +139,27 @@ module Playwright
|
|
102
139
|
@frame.dispatch_event(@selector, type, strict: true, eventInit: eventInit, timeout: timeout)
|
103
140
|
end
|
104
141
|
|
142
|
+
def drag_to(target,
|
143
|
+
force: nil,
|
144
|
+
noWaitAfter: nil,
|
145
|
+
sourcePosition: nil,
|
146
|
+
targetPosition: nil,
|
147
|
+
timeout: nil,
|
148
|
+
trial: nil)
|
149
|
+
|
150
|
+
@frame.drag_and_drop(
|
151
|
+
@selector,
|
152
|
+
target.instance_variable_get(:@selector),
|
153
|
+
force: force,
|
154
|
+
noWaitAfter: noWaitAfter,
|
155
|
+
sourcePosition: sourcePosition,
|
156
|
+
targetPosition: targetPosition,
|
157
|
+
timeout: timeout,
|
158
|
+
trial: trial,
|
159
|
+
strict: true,
|
160
|
+
)
|
161
|
+
end
|
162
|
+
|
105
163
|
def evaluate(expression, arg: nil, timeout: nil)
|
106
164
|
with_element(timeout: timeout) do |handle|
|
107
165
|
handle.evaluate(expression, arg: arg)
|
@@ -122,11 +180,12 @@ module Playwright
|
|
122
180
|
@frame.fill(@selector, value, strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
|
123
181
|
end
|
124
182
|
|
125
|
-
def locator(selector)
|
183
|
+
def locator(selector, hasText: nil)
|
126
184
|
LocatorImpl.new(
|
127
185
|
frame: @frame,
|
128
186
|
timeout_settings: @timeout_settings,
|
129
187
|
selector: "#{@selector} >> #{selector}",
|
188
|
+
hasText: hasText,
|
130
189
|
)
|
131
190
|
end
|
132
191
|
|
@@ -20,21 +20,35 @@ module Playwright
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def stop_chunk(path: nil)
|
23
|
-
do_stop_chunk(
|
23
|
+
do_stop_chunk(file_path: path)
|
24
24
|
end
|
25
25
|
|
26
26
|
def stop(path: nil)
|
27
|
-
do_stop_chunk(
|
27
|
+
do_stop_chunk(file_path: path)
|
28
28
|
@channel.send_message_to_server('tracingStop')
|
29
29
|
end
|
30
30
|
|
31
|
-
private def do_stop_chunk(
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
private def do_stop_chunk(file_path:)
|
32
|
+
mode = 'doNotSave'
|
33
|
+
if file_path
|
34
|
+
if @context.send(:remote_connection?)
|
35
|
+
mode = 'compressTrace'
|
36
|
+
else
|
37
|
+
mode = 'compressTraceAndSources'
|
38
|
+
end
|
39
|
+
end
|
35
40
|
|
36
|
-
|
41
|
+
result = @channel.send_message_to_server_result('tracingStopChunk', mode: mode)
|
42
|
+
return unless file_path # Not interested in artifacts.
|
43
|
+
return unless result['artifact'] # The artifact may be missing if the browser closed while stopping tracing.
|
44
|
+
|
45
|
+
artifact = ChannelOwners::Artifact.from(result['artifact'])
|
46
|
+
artifact.save_as(file_path)
|
37
47
|
artifact.delete
|
48
|
+
|
49
|
+
# // Add local sources to the remote trace if necessary.
|
50
|
+
# if (result.sourceEntries?.length)
|
51
|
+
# await this._context._localUtils.zip(filePath, result.sourceEntries);
|
38
52
|
end
|
39
53
|
end
|
40
54
|
end
|
data/lib/playwright/version.rb
CHANGED
@@ -36,12 +36,6 @@ module Playwright
|
|
36
36
|
end
|
37
37
|
alias_method :default_timeout=, :set_default_timeout
|
38
38
|
|
39
|
-
# -- inherited from EventEmitter --
|
40
|
-
# @nodoc
|
41
|
-
def off(event, callback)
|
42
|
-
event_emitter_proxy.off(event, callback)
|
43
|
-
end
|
44
|
-
|
45
39
|
# -- inherited from EventEmitter --
|
46
40
|
# @nodoc
|
47
41
|
def once(event, callback)
|
@@ -54,6 +48,12 @@ module Playwright
|
|
54
48
|
event_emitter_proxy.on(event, callback)
|
55
49
|
end
|
56
50
|
|
51
|
+
# -- inherited from EventEmitter --
|
52
|
+
# @nodoc
|
53
|
+
def off(event, callback)
|
54
|
+
event_emitter_proxy.off(event, callback)
|
55
|
+
end
|
56
|
+
|
57
57
|
private def event_emitter_proxy
|
58
58
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
59
59
|
end
|
@@ -164,20 +164,14 @@ module Playwright
|
|
164
164
|
raise NotImplementedError.new('web_views is not implemented yet.')
|
165
165
|
end
|
166
166
|
|
167
|
-
# @nodoc
|
168
|
-
def tree
|
169
|
-
wrap_impl(@impl.tree)
|
170
|
-
end
|
171
|
-
|
172
167
|
# @nodoc
|
173
168
|
def tap_on(selector, duration: nil, timeout: nil)
|
174
169
|
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
175
170
|
end
|
176
171
|
|
177
|
-
# -- inherited from EventEmitter --
|
178
172
|
# @nodoc
|
179
|
-
def
|
180
|
-
|
173
|
+
def tree
|
174
|
+
wrap_impl(@impl.tree)
|
181
175
|
end
|
182
176
|
|
183
177
|
# -- inherited from EventEmitter --
|
@@ -192,6 +186,12 @@ module Playwright
|
|
192
186
|
event_emitter_proxy.on(event, callback)
|
193
187
|
end
|
194
188
|
|
189
|
+
# -- inherited from EventEmitter --
|
190
|
+
# @nodoc
|
191
|
+
def off(event, callback)
|
192
|
+
event_emitter_proxy.off(event, callback)
|
193
|
+
end
|
194
|
+
|
195
195
|
private def event_emitter_proxy
|
196
196
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
197
197
|
end
|
@@ -3,6 +3,53 @@ module Playwright
|
|
3
3
|
# environment or the service to your e2e test. When used on `Page` or a `BrowserContext`, this API will automatically use
|
4
4
|
# the cookies from the corresponding `BrowserContext`. This means that if you log in using this API, your e2e test will be
|
5
5
|
# logged in and vice versa.
|
6
|
+
#
|
7
|
+
# ```python sync
|
8
|
+
# import os
|
9
|
+
# from playwright.sync_api import sync_playwright
|
10
|
+
#
|
11
|
+
# REPO = "test-repo-1"
|
12
|
+
# USER = "github-username"
|
13
|
+
# API_TOKEN = os.getenv("GITHUB_API_TOKEN")
|
14
|
+
#
|
15
|
+
# with sync_playwright() as p:
|
16
|
+
# # This will launch a new browser, create a context and page. When making HTTP
|
17
|
+
# # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)
|
18
|
+
# # it will automatically set the cookies to the browser page and vise versa.
|
19
|
+
# browser = playwright.chromium.launch()
|
20
|
+
# context = browser.new_context(base_url="https://api.github.com")
|
21
|
+
# api_request_context = context.request
|
22
|
+
# page = context.new_page()
|
23
|
+
#
|
24
|
+
# # Alternatively you can create a APIRequestContext manually without having a browser context attached:
|
25
|
+
# # api_request_context = playwright.request.new_context(base_url="https://api.github.com")
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# # Create a repository.
|
29
|
+
# response = api_request_context.post(
|
30
|
+
# "/user/repos",
|
31
|
+
# headers={
|
32
|
+
# "Accept": "application/vnd.github.v3+json",
|
33
|
+
# # Add GitHub personal access token.
|
34
|
+
# "Authorization": f"token {API_TOKEN}",
|
35
|
+
# },
|
36
|
+
# data={"name": REPO},
|
37
|
+
# )
|
38
|
+
# assert response.ok
|
39
|
+
# assert response.json()["name"] == REPO
|
40
|
+
#
|
41
|
+
# # Delete a repository.
|
42
|
+
# response = api_request_context.delete(
|
43
|
+
# f"/repos/{USER}/{REPO}",
|
44
|
+
# headers={
|
45
|
+
# "Accept": "application/vnd.github.v3+json",
|
46
|
+
# # Add GitHub personal access token.
|
47
|
+
# "Authorization": f"token {API_TOKEN}",
|
48
|
+
# },
|
49
|
+
# )
|
50
|
+
# assert response.ok
|
51
|
+
# assert await response.body() == '{"status": "ok"}'
|
52
|
+
# ```
|
6
53
|
class APIRequestContext < PlaywrightApi
|
7
54
|
|
8
55
|
# Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its
|
@@ -124,12 +171,6 @@ module Playwright
|
|
124
171
|
raise NotImplementedError.new('storage_state is not implemented yet.')
|
125
172
|
end
|
126
173
|
|
127
|
-
# -- inherited from EventEmitter --
|
128
|
-
# @nodoc
|
129
|
-
def off(event, callback)
|
130
|
-
event_emitter_proxy.off(event, callback)
|
131
|
-
end
|
132
|
-
|
133
174
|
# -- inherited from EventEmitter --
|
134
175
|
# @nodoc
|
135
176
|
def once(event, callback)
|
@@ -142,6 +183,12 @@ module Playwright
|
|
142
183
|
event_emitter_proxy.on(event, callback)
|
143
184
|
end
|
144
185
|
|
186
|
+
# -- inherited from EventEmitter --
|
187
|
+
# @nodoc
|
188
|
+
def off(event, callback)
|
189
|
+
event_emitter_proxy.off(event, callback)
|
190
|
+
end
|
191
|
+
|
145
192
|
private def event_emitter_proxy
|
146
193
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
147
194
|
end
|
@@ -166,12 +166,6 @@ module Playwright
|
|
166
166
|
wrap_impl(@impl.version)
|
167
167
|
end
|
168
168
|
|
169
|
-
# -- inherited from EventEmitter --
|
170
|
-
# @nodoc
|
171
|
-
def off(event, callback)
|
172
|
-
event_emitter_proxy.off(event, callback)
|
173
|
-
end
|
174
|
-
|
175
169
|
# -- inherited from EventEmitter --
|
176
170
|
# @nodoc
|
177
171
|
def once(event, callback)
|
@@ -184,6 +178,12 @@ module Playwright
|
|
184
178
|
event_emitter_proxy.on(event, callback)
|
185
179
|
end
|
186
180
|
|
181
|
+
# -- inherited from EventEmitter --
|
182
|
+
# @nodoc
|
183
|
+
def off(event, callback)
|
184
|
+
event_emitter_proxy.off(event, callback)
|
185
|
+
end
|
186
|
+
|
187
187
|
private def event_emitter_proxy
|
188
188
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
189
189
|
end
|
@@ -372,8 +372,8 @@ module Playwright
|
|
372
372
|
end
|
373
373
|
|
374
374
|
# @nodoc
|
375
|
-
def
|
376
|
-
wrap_impl(@impl.
|
375
|
+
def pause
|
376
|
+
wrap_impl(@impl.pause)
|
377
377
|
end
|
378
378
|
|
379
379
|
# @nodoc
|
@@ -386,20 +386,14 @@ module Playwright
|
|
386
386
|
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
387
387
|
end
|
388
388
|
|
389
|
-
# @nodoc
|
390
|
-
def pause
|
391
|
-
wrap_impl(@impl.pause)
|
392
|
-
end
|
393
|
-
|
394
389
|
# @nodoc
|
395
390
|
def options=(req)
|
396
391
|
wrap_impl(@impl.options=(unwrap_impl(req)))
|
397
392
|
end
|
398
393
|
|
399
|
-
# -- inherited from EventEmitter --
|
400
394
|
# @nodoc
|
401
|
-
def
|
402
|
-
|
395
|
+
def enable_debug_console!
|
396
|
+
wrap_impl(@impl.enable_debug_console!)
|
403
397
|
end
|
404
398
|
|
405
399
|
# -- inherited from EventEmitter --
|
@@ -414,6 +408,12 @@ module Playwright
|
|
414
408
|
event_emitter_proxy.on(event, callback)
|
415
409
|
end
|
416
410
|
|
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
|