playwright-ruby-client 1.59.0 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/documentation/docs/api/api_request.md +25 -1
- data/documentation/docs/api/api_request_context.md +13 -11
- data/documentation/docs/api/browser.md +18 -0
- data/documentation/docs/api/browser_context.md +1 -1
- data/documentation/docs/api/browser_type.md +18 -0
- data/documentation/docs/api/frame.md +1 -0
- data/documentation/docs/api/frame_locator.md +1 -0
- data/documentation/docs/api/locator.md +37 -2
- data/documentation/docs/api/locator_assertions.md +1 -1
- data/documentation/docs/api/page.md +12 -2
- data/documentation/docs/api/page_assertions.md +28 -0
- data/documentation/docs/api/playwright.md +5 -0
- data/documentation/docs/api/tracing.md +29 -0
- data/documentation/docs/include/api_coverage.md +14 -60
- data/lib/playwright/api_request_impl.rb +70 -0
- data/lib/playwright/channel_owners/api_request_context.rb +5 -1
- data/lib/playwright/channel_owners/binding_call.rb +3 -9
- data/lib/playwright/channel_owners/browser.rb +17 -0
- data/lib/playwright/channel_owners/browser_context.rb +10 -54
- data/lib/playwright/channel_owners/browser_type.rb +34 -1
- data/lib/playwright/channel_owners/frame.rb +89 -3
- data/lib/playwright/channel_owners/json_pipe.rb +4 -0
- data/lib/playwright/channel_owners/local_utils.rb +11 -2
- data/lib/playwright/channel_owners/page.rb +20 -11
- data/lib/playwright/channel_owners/playwright.rb +4 -0
- data/lib/playwright/channel_owners/tracing.rb +105 -4
- data/lib/playwright/connection.rb +5 -1
- data/lib/playwright/console_message_impl.rb +10 -1
- data/lib/playwright/errors.rb +3 -2
- data/lib/playwright/events.rb +7 -0
- data/lib/playwright/json_pipe_transport.rb +40 -0
- data/lib/playwright/locator_assertions_impl.rb +21 -4
- data/lib/playwright/locator_impl.rb +21 -3
- data/lib/playwright/locator_utils.rb +2 -0
- data/lib/playwright/page_assertions_impl.rb +33 -3
- data/lib/playwright/screencast.rb +5 -1
- data/lib/playwright/test.rb +16 -41
- data/lib/playwright/url_matcher.rb +35 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright.rb +1 -0
- data/lib/playwright_api/api_request.rb +1 -1
- data/lib/playwright_api/api_request_context.rb +15 -11
- data/lib/playwright_api/browser.rb +2 -2
- data/lib/playwright_api/browser_context.rb +7 -7
- data/lib/playwright_api/browser_type.rb +5 -3
- data/lib/playwright_api/frame.rb +18 -7
- data/lib/playwright_api/frame_locator.rb +2 -1
- data/lib/playwright_api/locator.rb +39 -5
- data/lib/playwright_api/locator_assertions.rb +2 -2
- data/lib/playwright_api/page.rb +28 -16
- data/lib/playwright_api/page_assertions.rb +22 -0
- data/lib/playwright_api/playwright.rb +1 -1
- data/lib/playwright_api/tracing.rb +23 -0
- data/sig/playwright.rbs +35 -43
- metadata +5 -12
- data/documentation/docs/api/experimental/android.md +0 -42
- data/documentation/docs/api/experimental/android_device.md +0 -109
- data/documentation/docs/api/experimental/android_input.md +0 -43
- data/documentation/docs/api/experimental/android_socket.md +0 -7
- data/documentation/docs/api/experimental/android_web_view.md +0 -7
- data/lib/playwright_api/android.rb +0 -68
- data/lib/playwright_api/android_device.rb +0 -229
- data/lib/playwright_api/android_input.rb +0 -34
- data/lib/playwright_api/android_socket.rb +0 -18
- data/lib/playwright_api/android_web_view.rb +0 -24
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Playwright
|
|
4
|
+
class JsonPipeTransport
|
|
5
|
+
def initialize(local_utils, params)
|
|
6
|
+
@local_utils = local_utils
|
|
7
|
+
@params = params
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def on_message_received(&block)
|
|
11
|
+
@on_message = block
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def on_driver_closed(&block)
|
|
15
|
+
@on_driver_closed = block
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def on_driver_crashed(&block)
|
|
19
|
+
@on_driver_crashed = block
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def send_message(message)
|
|
23
|
+
@pipe.channel.send_message_to_server('send', message: message)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def stop
|
|
27
|
+
@pipe&.channel&.send_message_to_server('close')
|
|
28
|
+
rescue TargetClosedError
|
|
29
|
+
nil
|
|
30
|
+
ensure
|
|
31
|
+
@pipe = nil
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def async_run
|
|
35
|
+
@pipe = @local_utils.connect(@params)
|
|
36
|
+
@pipe.channel.on('message', ->(params) { @on_message&.call(params['message']) })
|
|
37
|
+
@pipe.channel.on('closed', ->(_params) { @on_driver_closed&.call })
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -27,7 +27,7 @@ module Playwright
|
|
|
27
27
|
result = @locator.expect(expression, expect_options, title)
|
|
28
28
|
|
|
29
29
|
if result["matches"] == @is_not
|
|
30
|
-
actual = result
|
|
30
|
+
actual = received_actual(result)
|
|
31
31
|
|
|
32
32
|
log =
|
|
33
33
|
if result.key?("log")
|
|
@@ -52,19 +52,35 @@ module Playwright
|
|
|
52
52
|
if result['errorMessage']
|
|
53
53
|
error_message = "\n#{result['errorMessage']}"
|
|
54
54
|
end
|
|
55
|
-
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}"
|
|
55
|
+
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}#{aria_snapshot(result)}"
|
|
56
56
|
raise AssertionError.new(out)
|
|
57
57
|
else
|
|
58
58
|
true
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
private def received_actual(result)
|
|
63
|
+
received = result['received']
|
|
64
|
+
if received.is_a?(Hash)
|
|
65
|
+
received['value']
|
|
66
|
+
else
|
|
67
|
+
received
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
private def aria_snapshot(result)
|
|
72
|
+
aria_snapshot = result.dig('received', 'ariaSnapshot')
|
|
73
|
+
return '' unless aria_snapshot
|
|
74
|
+
|
|
75
|
+
"\nAria snapshot:\n#{aria_snapshot}\n"
|
|
76
|
+
end
|
|
77
|
+
|
|
62
78
|
private def _not # "not" is reserved in Ruby
|
|
63
79
|
LocatorAssertionsImpl.new(
|
|
64
80
|
@locator,
|
|
65
81
|
@default_expect_timeout,
|
|
66
82
|
!@is_not,
|
|
67
|
-
@
|
|
83
|
+
@custom_message
|
|
68
84
|
)
|
|
69
85
|
end
|
|
70
86
|
|
|
@@ -292,12 +308,13 @@ module Playwright
|
|
|
292
308
|
end
|
|
293
309
|
_define_negation :to_have_count
|
|
294
310
|
|
|
295
|
-
def to_have_css(name, value, timeout: nil)
|
|
311
|
+
def to_have_css(name, value, pseudo: nil, timeout: nil)
|
|
296
312
|
expected_text = to_expected_text_values([value])
|
|
297
313
|
expect_impl(
|
|
298
314
|
"to.have.css",
|
|
299
315
|
{
|
|
300
316
|
expressionArg: name,
|
|
317
|
+
pseudo: pseudo,
|
|
301
318
|
expectedText: expected_text,
|
|
302
319
|
timeout: timeout,
|
|
303
320
|
},
|
|
@@ -426,11 +426,12 @@ module Playwright
|
|
|
426
426
|
end
|
|
427
427
|
end
|
|
428
428
|
|
|
429
|
-
def aria_snapshot(depth: nil, mode: nil, timeout: nil, _track: nil)
|
|
429
|
+
def aria_snapshot(boxes: nil, depth: nil, mode: nil, timeout: nil, _track: nil)
|
|
430
430
|
params = {
|
|
431
431
|
selector: @selector,
|
|
432
432
|
timeout: _timeout(timeout),
|
|
433
433
|
}
|
|
434
|
+
params[:boxes] = boxes unless boxes.nil?
|
|
434
435
|
params[:depth] = depth if depth
|
|
435
436
|
params[:mode] = mode if mode
|
|
436
437
|
if _track
|
|
@@ -485,6 +486,14 @@ module Playwright
|
|
|
485
486
|
@frame.set_input_files(@selector, files, strict: true, noWaitAfter: noWaitAfter, timeout: timeout)
|
|
486
487
|
end
|
|
487
488
|
|
|
489
|
+
def drop(payload, position: nil, timeout: nil)
|
|
490
|
+
@frame.drop(@selector,
|
|
491
|
+
payload,
|
|
492
|
+
strict: true,
|
|
493
|
+
position: position,
|
|
494
|
+
timeout: timeout)
|
|
495
|
+
end
|
|
496
|
+
|
|
488
497
|
def tap_point(
|
|
489
498
|
force: nil,
|
|
490
499
|
modifiers: nil,
|
|
@@ -549,8 +558,17 @@ module Playwright
|
|
|
549
558
|
@frame.eval_on_selector_all(@selector, "ee => ee.map(e => e.textContent || '')")
|
|
550
559
|
end
|
|
551
560
|
|
|
552
|
-
def highlight
|
|
553
|
-
@frame.highlight(@selector)
|
|
561
|
+
def highlight(style: nil)
|
|
562
|
+
@frame.highlight(@selector, style: style)
|
|
563
|
+
DisposableStub.new { hide_highlight }
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
def hide_highlight
|
|
567
|
+
@frame.hide_highlight(@selector)
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
def _assertions(timeout, is_not, message)
|
|
571
|
+
LocatorAssertionsImpl.new(self, timeout, is_not, message)
|
|
554
572
|
end
|
|
555
573
|
|
|
556
574
|
def expect(expression, options, title)
|
|
@@ -66,12 +66,14 @@ module Playwright
|
|
|
66
66
|
props = []
|
|
67
67
|
|
|
68
68
|
ex = {
|
|
69
|
+
description: -> (value) { ['description', escape_for_attribute_selector_or_regex(value, options[:exact])]},
|
|
69
70
|
includeHidden: -> (value) { ['include-hidden', value.to_s] },
|
|
70
71
|
name: -> (value) { ['name', escape_for_attribute_selector_or_regex(value, options[:exact])]},
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
%i[
|
|
74
75
|
checked
|
|
76
|
+
description
|
|
75
77
|
disabled
|
|
76
78
|
selected
|
|
77
79
|
expanded
|
|
@@ -28,7 +28,7 @@ module Playwright
|
|
|
28
28
|
result = @frame.expect(nil, expression, expect_options, title)
|
|
29
29
|
|
|
30
30
|
if result["matches"] == @is_not
|
|
31
|
-
actual = result
|
|
31
|
+
actual = received_actual(result)
|
|
32
32
|
|
|
33
33
|
log =
|
|
34
34
|
if result.key?("log")
|
|
@@ -53,19 +53,35 @@ module Playwright
|
|
|
53
53
|
if result['errorMessage']
|
|
54
54
|
error_message = "\n#{result['errorMessage']}"
|
|
55
55
|
end
|
|
56
|
-
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}"
|
|
56
|
+
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}#{aria_snapshot(result)}"
|
|
57
57
|
raise AssertionError.new(out)
|
|
58
58
|
else
|
|
59
59
|
true
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
private def received_actual(result)
|
|
64
|
+
received = result['received']
|
|
65
|
+
if received.is_a?(Hash)
|
|
66
|
+
received['value']
|
|
67
|
+
else
|
|
68
|
+
received
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private def aria_snapshot(result)
|
|
73
|
+
aria_snapshot = result.dig('received', 'ariaSnapshot')
|
|
74
|
+
return '' unless aria_snapshot
|
|
75
|
+
|
|
76
|
+
"\nAria snapshot:\n#{aria_snapshot}\n"
|
|
77
|
+
end
|
|
78
|
+
|
|
63
79
|
private def _not # "not" is reserved in Ruby
|
|
64
80
|
PageAssertionsImpl.new(
|
|
65
81
|
@page,
|
|
66
82
|
@default_expect_timeout,
|
|
67
83
|
!@is_not,
|
|
68
|
-
@
|
|
84
|
+
@custom_message
|
|
69
85
|
)
|
|
70
86
|
end
|
|
71
87
|
|
|
@@ -150,5 +166,19 @@ module Playwright
|
|
|
150
166
|
)
|
|
151
167
|
end
|
|
152
168
|
_define_negation :to_have_url
|
|
169
|
+
|
|
170
|
+
def to_match_aria_snapshot(expected, timeout: nil)
|
|
171
|
+
expect_impl(
|
|
172
|
+
'to.match.aria',
|
|
173
|
+
{
|
|
174
|
+
expectedValue: expected,
|
|
175
|
+
timeout: timeout,
|
|
176
|
+
},
|
|
177
|
+
expected,
|
|
178
|
+
'Page expected to match Aria snapshot',
|
|
179
|
+
'Expect "to_match_aria_snapshot"',
|
|
180
|
+
)
|
|
181
|
+
end
|
|
182
|
+
_define_negation :to_match_aria_snapshot
|
|
153
183
|
end
|
|
154
184
|
end
|
|
@@ -85,7 +85,11 @@ module Playwright
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
private def handle_screencast_frame(event)
|
|
88
|
-
@on_frame&.call(
|
|
88
|
+
@on_frame&.call({
|
|
89
|
+
data: Base64.strict_decode64(event['data']),
|
|
90
|
+
viewportWidth: event['viewportWidth'],
|
|
91
|
+
viewportHeight: event['viewportHeight'],
|
|
92
|
+
})
|
|
89
93
|
end
|
|
90
94
|
end
|
|
91
95
|
end
|
data/lib/playwright/test.rb
CHANGED
|
@@ -21,37 +21,6 @@ module Playwright
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# ref: https://github.com/microsoft/playwright-python/blob/main/playwright/sync_api/__init__.py#L90
|
|
24
|
-
class Expect
|
|
25
|
-
def initialize
|
|
26
|
-
@default_expect_timeout = ::Playwright::Test.expect_timeout
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def call(actual, is_not)
|
|
30
|
-
case actual
|
|
31
|
-
when Page
|
|
32
|
-
PageAssertions.new(
|
|
33
|
-
PageAssertionsImpl.new(
|
|
34
|
-
actual,
|
|
35
|
-
@default_expect_timeout,
|
|
36
|
-
is_not,
|
|
37
|
-
nil,
|
|
38
|
-
)
|
|
39
|
-
)
|
|
40
|
-
when Locator
|
|
41
|
-
LocatorAssertions.new(
|
|
42
|
-
LocatorAssertionsImpl.new(
|
|
43
|
-
actual,
|
|
44
|
-
@default_expect_timeout,
|
|
45
|
-
is_not,
|
|
46
|
-
nil,
|
|
47
|
-
)
|
|
48
|
-
)
|
|
49
|
-
else
|
|
50
|
-
raise NotImplementedError.new("Only locator assertions are currently implemented")
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
24
|
module Matchers
|
|
56
25
|
class PlaywrightMatcher
|
|
57
26
|
def initialize(expectation_method, *args, **kwargs)
|
|
@@ -61,7 +30,7 @@ module Playwright
|
|
|
61
30
|
end
|
|
62
31
|
|
|
63
32
|
def matches?(actual)
|
|
64
|
-
|
|
33
|
+
assertions_for(actual, false).send(@method, *@args, **@kwargs)
|
|
65
34
|
true
|
|
66
35
|
rescue AssertionError => e
|
|
67
36
|
@failure_message = e.full_message
|
|
@@ -69,7 +38,7 @@ module Playwright
|
|
|
69
38
|
end
|
|
70
39
|
|
|
71
40
|
def does_not_match?(actual)
|
|
72
|
-
|
|
41
|
+
assertions_for(actual, true).send(@method, *@args, **@kwargs)
|
|
73
42
|
true
|
|
74
43
|
rescue AssertionError => e
|
|
75
44
|
@failure_message = e.full_message
|
|
@@ -83,20 +52,26 @@ module Playwright
|
|
|
83
52
|
def failure_message_when_negated
|
|
84
53
|
@failure_message
|
|
85
54
|
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
55
|
|
|
89
|
-
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def assertions_for(actual, is_not)
|
|
59
|
+
if actual.respond_to?(:_assertions)
|
|
60
|
+
actual._assertions(::Playwright::Test.expect_timeout, is_not, nil)
|
|
61
|
+
else
|
|
62
|
+
raise NotImplementedError.new("Only page and locator assertions are currently implemented")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
90
66
|
|
|
91
|
-
|
|
92
|
-
.map(&:to_s)
|
|
93
|
-
.each do |method_name|
|
|
67
|
+
(PageAssertions.instance_methods(false) + LocatorAssertions.instance_methods(false)).each do |method_name_sym|
|
|
94
68
|
# to_be_visible => be_visible
|
|
95
69
|
# not_to_be_visible => not_be_visible
|
|
96
|
-
|
|
97
|
-
|
|
70
|
+
method_name = method_name_sym.to_s
|
|
71
|
+
define_method(method_name.gsub("to_", "")) do |*args, **kwargs|
|
|
98
72
|
Matchers::PlaywrightMatcher.new(method_name, *args, **kwargs)
|
|
99
73
|
end
|
|
100
74
|
end
|
|
75
|
+
end
|
|
101
76
|
end
|
|
102
77
|
end
|
|
@@ -5,6 +5,7 @@ module Playwright
|
|
|
5
5
|
def initialize(url, base_url:)
|
|
6
6
|
@url = url
|
|
7
7
|
@base_url = base_url
|
|
8
|
+
validate_glob_pattern if @url.is_a?(String)
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def as_pattern
|
|
@@ -37,5 +38,39 @@ module Playwright
|
|
|
37
38
|
@url
|
|
38
39
|
end
|
|
39
40
|
end
|
|
41
|
+
|
|
42
|
+
private def validate_glob_pattern
|
|
43
|
+
in_group = false
|
|
44
|
+
escaped = false
|
|
45
|
+
|
|
46
|
+
@url.each_char do |char|
|
|
47
|
+
if escaped
|
|
48
|
+
escaped = false
|
|
49
|
+
next
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if char == '\\'
|
|
53
|
+
escaped = true
|
|
54
|
+
next
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
case char
|
|
58
|
+
when '{'
|
|
59
|
+
if in_group
|
|
60
|
+
raise ArgumentError.new("Invalid glob pattern #{@url.inspect}: nested '{' is not supported")
|
|
61
|
+
end
|
|
62
|
+
in_group = true
|
|
63
|
+
when '}'
|
|
64
|
+
unless in_group
|
|
65
|
+
raise ArgumentError.new("Invalid glob pattern #{@url.inspect}: unmatched '}'")
|
|
66
|
+
end
|
|
67
|
+
in_group = false
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if in_group
|
|
72
|
+
raise ArgumentError.new("Invalid glob pattern #{@url.inspect}: unmatched '{'")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
40
75
|
end
|
|
41
76
|
end
|
data/lib/playwright/version.rb
CHANGED
data/lib/playwright.rb
CHANGED
|
@@ -27,6 +27,7 @@ require 'playwright/route_handler'
|
|
|
27
27
|
require 'playwright/select_option_values'
|
|
28
28
|
require 'playwright/timeout_settings'
|
|
29
29
|
require 'playwright/transport'
|
|
30
|
+
require 'playwright/json_pipe_transport'
|
|
30
31
|
require 'playwright/url_matcher'
|
|
31
32
|
require 'playwright/version'
|
|
32
33
|
require 'playwright/screencast'
|
|
@@ -20,7 +20,7 @@ module Playwright
|
|
|
20
20
|
storageState: nil,
|
|
21
21
|
timeout: nil,
|
|
22
22
|
userAgent: nil)
|
|
23
|
-
|
|
23
|
+
wrap_impl(@impl.new_context(baseURL: unwrap_impl(baseURL), clientCertificates: unwrap_impl(clientCertificates), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), failOnStatusCode: unwrap_impl(failOnStatusCode), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), proxy: unwrap_impl(proxy), storageState: unwrap_impl(storageState), timeout: unwrap_impl(timeout), userAgent: unwrap_impl(userAgent)))
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -3,21 +3,21 @@ module Playwright
|
|
|
3
3
|
# This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
|
|
4
4
|
# environment or the service to your e2e test.
|
|
5
5
|
#
|
|
6
|
-
# Each Playwright browser context has associated
|
|
7
|
-
#
|
|
8
|
-
#
|
|
6
|
+
# Each Playwright browser context has an associated `APIRequestContext`, accessible via
|
|
7
|
+
# [`property: BrowserContext.request`] or [`property: Page.request`] (these return the
|
|
8
|
+
#
|
|
9
|
+
# **same instance** — `page.request` is a shortcut for `page.context().request`).
|
|
10
|
+
# You can also create a standalone, isolated instance with [`method: APIRequest.newContext`].
|
|
9
11
|
#
|
|
10
12
|
# **Cookie management**
|
|
11
13
|
#
|
|
12
|
-
# `APIRequestContext` returned by [`property: BrowserContext.request`] and
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# `BrowserContext` cookies and requests made from the page will pick them up. This means that if you log in using
|
|
16
|
-
# this API, your e2e test will be logged in and vice versa.
|
|
14
|
+
# The `APIRequestContext` returned by [`property: BrowserContext.request`] and
|
|
15
|
+
#
|
|
16
|
+
# [`property: Page.request`] uses the same cookie jar as its `BrowserContext`:
|
|
17
17
|
#
|
|
18
|
-
# If you want API requests
|
|
19
|
-
#
|
|
20
|
-
# storage.
|
|
18
|
+
# If you want API requests that do **not** share cookies with the browser, create an
|
|
19
|
+
# isolated context via [`method: APIRequest.newContext`]. Such `APIRequestContext`
|
|
20
|
+
# object will have its own isolated cookie storage.
|
|
21
21
|
#
|
|
22
22
|
# ```python sync
|
|
23
23
|
# import os
|
|
@@ -67,6 +67,10 @@ module Playwright
|
|
|
67
67
|
# ```
|
|
68
68
|
class APIRequestContext < PlaywrightApi
|
|
69
69
|
|
|
70
|
+
def tracing # property
|
|
71
|
+
wrap_impl(@impl.tracing)
|
|
72
|
+
end
|
|
73
|
+
|
|
70
74
|
#
|
|
71
75
|
# Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its response.
|
|
72
76
|
# The method will populate request cookies from the context and update
|
|
@@ -175,7 +175,7 @@ module Playwright
|
|
|
175
175
|
#
|
|
176
176
|
# Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
|
|
177
177
|
def bind(title, host: nil, port: nil, workspaceDir: nil)
|
|
178
|
-
|
|
178
|
+
wrap_impl(@impl.bind(unwrap_impl(title), host: unwrap_impl(host), port: unwrap_impl(port), workspaceDir: unwrap_impl(workspaceDir)))
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
#
|
|
@@ -206,7 +206,7 @@ module Playwright
|
|
|
206
206
|
#
|
|
207
207
|
# Unbinds the browser server previously bound with [`method: Browser.bind`].
|
|
208
208
|
def unbind
|
|
209
|
-
|
|
209
|
+
wrap_impl(@impl.unbind)
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
#
|
|
@@ -174,8 +174,8 @@ module Playwright
|
|
|
174
174
|
# with sync_playwright() as playwright:
|
|
175
175
|
# run(playwright)
|
|
176
176
|
# ```
|
|
177
|
-
def expose_binding(name, callback
|
|
178
|
-
wrap_impl(@impl.expose_binding(unwrap_impl(name), unwrap_impl(callback)
|
|
177
|
+
def expose_binding(name, callback)
|
|
178
|
+
wrap_impl(@impl.expose_binding(unwrap_impl(name), unwrap_impl(callback)))
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
#
|
|
@@ -489,11 +489,6 @@ module Playwright
|
|
|
489
489
|
raise NotImplementedError.new('wait_for_event is not implemented yet.')
|
|
490
490
|
end
|
|
491
491
|
|
|
492
|
-
# @nodoc
|
|
493
|
-
def enable_debug_console!
|
|
494
|
-
wrap_impl(@impl.enable_debug_console!)
|
|
495
|
-
end
|
|
496
|
-
|
|
497
492
|
# @nodoc
|
|
498
493
|
def pause
|
|
499
494
|
wrap_impl(@impl.pause)
|
|
@@ -514,6 +509,11 @@ module Playwright
|
|
|
514
509
|
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
|
515
510
|
end
|
|
516
511
|
|
|
512
|
+
# @nodoc
|
|
513
|
+
def enable_debug_console!
|
|
514
|
+
wrap_impl(@impl.enable_debug_console!)
|
|
515
|
+
end
|
|
516
|
+
|
|
517
517
|
# -- inherited from EventEmitter --
|
|
518
518
|
# @nodoc
|
|
519
519
|
def on(event, callback)
|
|
@@ -28,8 +28,9 @@ module Playwright
|
|
|
28
28
|
exposeNetwork: nil,
|
|
29
29
|
headers: nil,
|
|
30
30
|
slowMo: nil,
|
|
31
|
-
timeout: nil
|
|
32
|
-
|
|
31
|
+
timeout: nil,
|
|
32
|
+
&block)
|
|
33
|
+
wrap_impl(@impl.connect(unwrap_impl(endpoint), exposeNetwork: unwrap_impl(exposeNetwork), headers: unwrap_impl(headers), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
#
|
|
@@ -52,10 +53,11 @@ module Playwright
|
|
|
52
53
|
endpointURL,
|
|
53
54
|
headers: nil,
|
|
54
55
|
isLocal: nil,
|
|
56
|
+
noDefaults: nil,
|
|
55
57
|
slowMo: nil,
|
|
56
58
|
timeout: nil,
|
|
57
59
|
&block)
|
|
58
|
-
wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), isLocal: unwrap_impl(isLocal), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
60
|
+
wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), isLocal: unwrap_impl(isLocal), noDefaults: unwrap_impl(noDefaults), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
#
|
data/lib/playwright_api/frame.rb
CHANGED
|
@@ -454,6 +454,7 @@ module Playwright
|
|
|
454
454
|
def get_by_role(
|
|
455
455
|
role,
|
|
456
456
|
checked: nil,
|
|
457
|
+
description: nil,
|
|
457
458
|
disabled: nil,
|
|
458
459
|
exact: nil,
|
|
459
460
|
expanded: nil,
|
|
@@ -462,7 +463,7 @@ module Playwright
|
|
|
462
463
|
name: nil,
|
|
463
464
|
pressed: nil,
|
|
464
465
|
selected: nil)
|
|
465
|
-
wrap_impl(@impl.get_by_role(unwrap_impl(role), checked: unwrap_impl(checked), disabled: unwrap_impl(disabled), exact: unwrap_impl(exact), expanded: unwrap_impl(expanded), includeHidden: unwrap_impl(includeHidden), level: unwrap_impl(level), name: unwrap_impl(name), pressed: unwrap_impl(pressed), selected: unwrap_impl(selected)))
|
|
466
|
+
wrap_impl(@impl.get_by_role(unwrap_impl(role), checked: unwrap_impl(checked), description: unwrap_impl(description), disabled: unwrap_impl(disabled), exact: unwrap_impl(exact), expanded: unwrap_impl(expanded), includeHidden: unwrap_impl(includeHidden), level: unwrap_impl(level), name: unwrap_impl(name), pressed: unwrap_impl(pressed), selected: unwrap_impl(selected)))
|
|
466
467
|
end
|
|
467
468
|
|
|
468
469
|
#
|
|
@@ -1041,18 +1042,28 @@ module Playwright
|
|
|
1041
1042
|
end
|
|
1042
1043
|
|
|
1043
1044
|
# @nodoc
|
|
1044
|
-
def
|
|
1045
|
-
wrap_impl(@impl.
|
|
1045
|
+
def detached=(req)
|
|
1046
|
+
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
|
1046
1047
|
end
|
|
1047
1048
|
|
|
1048
1049
|
# @nodoc
|
|
1049
|
-
def
|
|
1050
|
-
wrap_impl(@impl.
|
|
1050
|
+
def drop(selector, payload, position: nil, strict: nil, timeout: nil)
|
|
1051
|
+
wrap_impl(@impl.drop(unwrap_impl(selector), unwrap_impl(payload), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
1051
1052
|
end
|
|
1052
1053
|
|
|
1053
1054
|
# @nodoc
|
|
1054
|
-
def
|
|
1055
|
-
wrap_impl(@impl.
|
|
1055
|
+
def highlight(selector, style: nil)
|
|
1056
|
+
wrap_impl(@impl.highlight(unwrap_impl(selector), style: unwrap_impl(style)))
|
|
1057
|
+
end
|
|
1058
|
+
|
|
1059
|
+
# @nodoc
|
|
1060
|
+
def hide_highlight(selector)
|
|
1061
|
+
wrap_impl(@impl.hide_highlight(unwrap_impl(selector)))
|
|
1062
|
+
end
|
|
1063
|
+
|
|
1064
|
+
# @nodoc
|
|
1065
|
+
def expect(selector, expression, options, title)
|
|
1066
|
+
wrap_impl(@impl.expect(unwrap_impl(selector), unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
|
|
1056
1067
|
end
|
|
1057
1068
|
|
|
1058
1069
|
# -- inherited from EventEmitter --
|
|
@@ -136,6 +136,7 @@ module Playwright
|
|
|
136
136
|
def get_by_role(
|
|
137
137
|
role,
|
|
138
138
|
checked: nil,
|
|
139
|
+
description: nil,
|
|
139
140
|
disabled: nil,
|
|
140
141
|
exact: nil,
|
|
141
142
|
expanded: nil,
|
|
@@ -144,7 +145,7 @@ module Playwright
|
|
|
144
145
|
name: nil,
|
|
145
146
|
pressed: nil,
|
|
146
147
|
selected: nil)
|
|
147
|
-
wrap_impl(@impl.get_by_role(unwrap_impl(role), checked: unwrap_impl(checked), disabled: unwrap_impl(disabled), exact: unwrap_impl(exact), expanded: unwrap_impl(expanded), includeHidden: unwrap_impl(includeHidden), level: unwrap_impl(level), name: unwrap_impl(name), pressed: unwrap_impl(pressed), selected: unwrap_impl(selected)))
|
|
148
|
+
wrap_impl(@impl.get_by_role(unwrap_impl(role), checked: unwrap_impl(checked), description: unwrap_impl(description), disabled: unwrap_impl(disabled), exact: unwrap_impl(exact), expanded: unwrap_impl(expanded), includeHidden: unwrap_impl(includeHidden), level: unwrap_impl(level), name: unwrap_impl(name), pressed: unwrap_impl(pressed), selected: unwrap_impl(selected)))
|
|
148
149
|
end
|
|
149
150
|
|
|
150
151
|
#
|