playwright-ruby-client 1.18.3 → 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_context.md +11 -1
- 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 +5 -1
- data/documentation/docs/api/route.md +1 -0
- data/documentation/docs/api/tracing.md +6 -1
- data/documentation/docs/include/api_coverage.md +1 -0
- data/lib/playwright/api_response_impl.rb +4 -0
- data/lib/playwright/channel_owner.rb +4 -0
- data/lib/playwright/channel_owners/api_request_context.rb +4 -0
- data/lib/playwright/channel_owners/browser_context.rb +10 -9
- data/lib/playwright/channel_owners/frame.rb +2 -2
- data/lib/playwright/channel_owners/page.rb +11 -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 -14
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/api_request_context.rb +2 -2
- data/lib/playwright_api/frame.rb +2 -2
- data/lib/playwright_api/frame_locator.rb +2 -2
- data/lib/playwright_api/locator.rb +8 -3
- data/lib/playwright_api/page.rb +7 -7
- data/lib/playwright_api/playwright.rb +4 -4
- data/lib/playwright_api/route.rb +2 -1
- data/lib/playwright_api/tracing.rb +29 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfbbc528927aa551597f30f0abb057a13609726f473cfd6c625a97d135d0b705
|
4
|
+
data.tar.gz: f3f8dda3439bfaa0d3a8796ee8ed6eb453ae9934e9bf0b1768a8a0c9a62d5e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14e62113089e96e77fd11dabdda86582ac5c4004465a4007396b71a954927396e1a77c5abf2c10199e43b41b119a5879bbdf491400ec8de5d9f1bd2b3da19ef8
|
7
|
+
data.tar.gz: 6ee4b4854cf14ba4cd1cad9dd4c847cea5dea58c892298e15daecce174754b35beccfaff8386f9c97ca103d500aeea476f82c232fa88291741d075685d2fc789
|
@@ -28,7 +28,17 @@ playwright.chromium.launch do |browser|
|
|
28
28
|
data: { name: 'test-repo-1' },
|
29
29
|
)
|
30
30
|
response.ok? # => true
|
31
|
-
response.json['name'] # => "
|
31
|
+
response.json['name'] # => "test-repo-1"
|
32
|
+
|
33
|
+
# Delete a repository.
|
34
|
+
response = api_request_context.delete(
|
35
|
+
"/repos/YourName/test-repo-1",
|
36
|
+
headers: {
|
37
|
+
"Accept": "application/vnd.github.v3+json",
|
38
|
+
"Authorization": "Bearer #{API_TOKEN}",
|
39
|
+
},
|
40
|
+
)
|
41
|
+
response.ok? # => true
|
32
42
|
end
|
33
43
|
```
|
34
44
|
|
@@ -549,7 +549,7 @@ considered not visible.
|
|
549
549
|
## locator
|
550
550
|
|
551
551
|
```
|
552
|
-
def locator(selector, hasText: nil)
|
552
|
+
def locator(selector, has: nil, hasText: nil)
|
553
553
|
```
|
554
554
|
|
555
555
|
The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
@@ -311,7 +311,7 @@ When working with iframes, you can create a frame locator that will enter the if
|
|
311
311
|
that iframe:
|
312
312
|
|
313
313
|
```ruby
|
314
|
-
locator = page.frame_locator("
|
314
|
+
locator = page.frame_locator("iframe").locator("text=Submit")
|
315
315
|
locator.click
|
316
316
|
```
|
317
317
|
|
@@ -430,7 +430,7 @@ Returns locator to the last matching element.
|
|
430
430
|
## locator
|
431
431
|
|
432
432
|
```
|
433
|
-
def locator(selector, hasText: nil)
|
433
|
+
def locator(selector, has: nil, hasText: nil)
|
434
434
|
```
|
435
435
|
|
436
436
|
The method finds an element matching the specified selector in the [Locator](./locator)'s subtree.
|
@@ -443,6 +443,14 @@ def nth(index)
|
|
443
443
|
|
444
444
|
Returns locator to the n-th matching element.
|
445
445
|
|
446
|
+
## page
|
447
|
+
|
448
|
+
```
|
449
|
+
def page
|
450
|
+
```
|
451
|
+
|
452
|
+
A page this locator belongs to.
|
453
|
+
|
446
454
|
## press
|
447
455
|
|
448
456
|
```
|
@@ -774,7 +774,7 @@ considered not visible.
|
|
774
774
|
## locator
|
775
775
|
|
776
776
|
```
|
777
|
-
def locator(selector, hasText: nil)
|
777
|
+
def locator(selector, has: nil, hasText: nil)
|
778
778
|
```
|
779
779
|
|
780
780
|
The method returns an element locator that can be used to perform actions on the page. Locator is resolved to the
|
@@ -1491,6 +1491,9 @@ response = page.expect_response(/example.com\/resource/) do
|
|
1491
1491
|
page.click("input")
|
1492
1492
|
end
|
1493
1493
|
puts response.body
|
1494
|
+
puts response.ok?
|
1495
|
+
|
1496
|
+
page.wait_for_load_state # wait for request finished.
|
1494
1497
|
|
1495
1498
|
# or with a predicate
|
1496
1499
|
page.content = '<form action="https://example.com/resource"><input type="submit" /></form>'
|
@@ -1498,6 +1501,7 @@ response = page.expect_response(->(res) { res.url.start_with? 'https://example.c
|
|
1498
1501
|
page.click("input")
|
1499
1502
|
end
|
1500
1503
|
puts response.body
|
1504
|
+
puts response.ok?
|
1501
1505
|
```
|
1502
1506
|
|
1503
1507
|
|
@@ -72,6 +72,10 @@ module Playwright
|
|
72
72
|
private def delete_object_from_child(guid)
|
73
73
|
@objects.delete(guid)
|
74
74
|
end
|
75
|
+
|
76
|
+
private def same_connection?(other)
|
77
|
+
@connection == other.instance_variable_get(:@connection)
|
78
|
+
end
|
75
79
|
end
|
76
80
|
|
77
81
|
class RootChannelOwner < ChannelOwner
|
@@ -14,7 +14,7 @@ module Playwright
|
|
14
14
|
@service_workers = Set.new
|
15
15
|
@background_pages = Set.new
|
16
16
|
|
17
|
-
@tracing =
|
17
|
+
@tracing = ChannelOwners::Tracing.from(@initializer['tracing'])
|
18
18
|
@request = ChannelOwners::APIRequestContext.from(@initializer['APIRequestContext'])
|
19
19
|
|
20
20
|
@channel.on('bindingCall', ->(params) { on_binding(ChannelOwners::BindingCall.from(params['binding'])) })
|
@@ -72,13 +72,19 @@ module Playwright
|
|
72
72
|
wrapped_route = PlaywrightApi.wrap(route)
|
73
73
|
wrapped_request = PlaywrightApi.wrap(request)
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
handler_entry = @routes.find do |entry|
|
76
|
+
entry.match?(request.url)
|
77
|
+
end
|
78
|
+
|
79
|
+
if handler_entry
|
80
|
+
handler_entry.async_handle(wrapped_route, wrapped_request)
|
81
|
+
|
78
82
|
@routes.reject!(&:expired?)
|
79
83
|
if @routes.count == 0
|
80
84
|
@channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
|
81
85
|
end
|
86
|
+
else
|
87
|
+
route.continue
|
82
88
|
end
|
83
89
|
end
|
84
90
|
|
@@ -360,10 +366,5 @@ module Playwright
|
|
360
366
|
private def base_url
|
361
367
|
@options[:baseURL]
|
362
368
|
end
|
363
|
-
|
364
|
-
# called from Tracing
|
365
|
-
private def remote_connection?
|
366
|
-
@connection.remote?
|
367
|
-
end
|
368
369
|
end
|
369
370
|
end
|
@@ -400,8 +400,8 @@ module Playwright
|
|
400
400
|
nil
|
401
401
|
end
|
402
402
|
|
403
|
-
def locator(selector, hasText: nil)
|
404
|
-
LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector, hasText: hasText)
|
403
|
+
def locator(selector, hasText: nil, has: nil)
|
404
|
+
LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector, hasText: hasText, has: has)
|
405
405
|
end
|
406
406
|
|
407
407
|
def frame_locator(selector)
|
@@ -98,13 +98,19 @@ module Playwright
|
|
98
98
|
wrapped_route = PlaywrightApi.wrap(route)
|
99
99
|
wrapped_request = PlaywrightApi.wrap(request)
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
handler_entry = @routes.find do |entry|
|
102
|
+
entry.match?(request.url)
|
103
|
+
end
|
104
|
+
|
105
|
+
if handler_entry
|
106
|
+
handler_entry.async_handle(wrapped_route, wrapped_request)
|
107
|
+
|
104
108
|
@routes.reject!(&:expired?)
|
105
109
|
if @routes.count == 0
|
106
110
|
@channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
|
107
111
|
end
|
112
|
+
else
|
113
|
+
@browser_context.send(:on_route, route, request)
|
108
114
|
end
|
109
115
|
end
|
110
116
|
|
@@ -558,8 +564,8 @@ module Playwright
|
|
558
564
|
timeout: timeout)
|
559
565
|
end
|
560
566
|
|
561
|
-
def locator(selector, hasText: nil)
|
562
|
-
@main_frame.locator(selector, hasText: hasText)
|
567
|
+
def locator(selector, hasText: nil, has: nil)
|
568
|
+
@main_frame.locator(selector, hasText: hasText, has: has)
|
563
569
|
end
|
564
570
|
|
565
571
|
def frame_locator(selector)
|
@@ -17,16 +17,30 @@ module Playwright
|
|
17
17
|
contentType: nil,
|
18
18
|
headers: nil,
|
19
19
|
path: nil,
|
20
|
-
status: nil
|
20
|
+
status: nil,
|
21
|
+
response: nil)
|
21
22
|
params = {
|
22
23
|
contentType: contentType,
|
23
24
|
status: status,
|
24
25
|
}.compact
|
26
|
+
option_body = body
|
27
|
+
|
28
|
+
if response
|
29
|
+
params[:status] ||= response.status
|
30
|
+
params[:headers] ||= response.headers
|
31
|
+
|
32
|
+
if !body && !path && response.is_a?(APIResponse)
|
33
|
+
if response.send(:_request).send(:same_connection?, self)
|
34
|
+
params[:fetchResponseUid] = response.send(:fetch_uid)
|
35
|
+
else
|
36
|
+
option_body = response.body
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
25
40
|
|
26
|
-
length = 0
|
27
41
|
content =
|
28
|
-
if
|
29
|
-
|
42
|
+
if option_body
|
43
|
+
option_body
|
30
44
|
elsif path
|
31
45
|
File.read(path)
|
32
46
|
else
|
@@ -1,15 +1,11 @@
|
|
1
1
|
module Playwright
|
2
|
-
|
3
|
-
def
|
4
|
-
@channel = channel
|
5
|
-
@context = context
|
6
|
-
end
|
7
|
-
|
8
|
-
def start(name: nil, title: nil, screenshots: nil, snapshots: nil)
|
2
|
+
define_channel_owner :Tracing do
|
3
|
+
def start(name: nil, title: nil, screenshots: nil, snapshots: nil, sources: nil)
|
9
4
|
params = {
|
10
5
|
name: name,
|
11
6
|
screenshots: screenshots,
|
12
7
|
snapshots: snapshots,
|
8
|
+
sources: sources,
|
13
9
|
}.compact
|
14
10
|
@channel.send_message_to_server('tracingStart', params)
|
15
11
|
@channel.send_message_to_server('tracingStartChunk', { title: title }.compact)
|
@@ -31,7 +27,7 @@ module Playwright
|
|
31
27
|
private def do_stop_chunk(file_path:)
|
32
28
|
mode = 'doNotSave'
|
33
29
|
if file_path
|
34
|
-
if @
|
30
|
+
if @connection.remote?
|
35
31
|
mode = 'compressTrace'
|
36
32
|
else
|
37
33
|
mode = 'compressTraceAndSources'
|
@@ -6,12 +6,13 @@ module Playwright
|
|
6
6
|
@frame_selector = frame_selector
|
7
7
|
end
|
8
8
|
|
9
|
-
def locator(selector, hasText: nil)
|
9
|
+
def locator(selector, hasText: nil, has: 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
14
|
hasText: hasText,
|
15
|
+
has: has,
|
15
16
|
)
|
16
17
|
end
|
17
18
|
|
@@ -24,29 +24,51 @@ module Playwright
|
|
24
24
|
end
|
25
25
|
|
26
26
|
define_api_implementation :LocatorImpl do
|
27
|
-
def initialize(frame:, timeout_settings:, selector:, hasText: nil)
|
27
|
+
def initialize(frame:, timeout_settings:, selector:, hasText: nil, has: nil)
|
28
28
|
@frame = frame
|
29
29
|
@timeout_settings = timeout_settings
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
30
|
+
selector_scopes = [selector]
|
31
|
+
|
32
|
+
case hasText
|
33
|
+
when Regexp
|
34
|
+
source = EscapeWithQuotes.new(hasText.source, '"')
|
35
|
+
flags = []
|
36
|
+
flags << 'ms' if (hasText.options & Regexp::MULTILINE) != 0
|
37
|
+
flags << 'i' if (hasText.options & Regexp::IGNORECASE) != 0
|
38
|
+
selector_scopes << ":scope:text-matches(#{source}, \"#{flags.join('')}\")"
|
39
|
+
when String
|
40
|
+
text = EscapeWithQuotes.new(hasText, '"')
|
41
|
+
selector_scopes << ":scope:has-text(#{text})"
|
42
|
+
end
|
43
|
+
|
44
|
+
if has
|
45
|
+
unless same_frame?(has)
|
46
|
+
raise DifferentFrameError.new
|
43
47
|
end
|
48
|
+
selector_scopes << "has=#{has.send(:selector_json)}"
|
49
|
+
end
|
50
|
+
|
51
|
+
@selector = selector_scopes.join(' >> ')
|
44
52
|
end
|
45
53
|
|
46
54
|
def to_s
|
47
55
|
"Locator@#{@selector}"
|
48
56
|
end
|
49
57
|
|
58
|
+
class DifferentFrameError < StandardError
|
59
|
+
def initialize
|
60
|
+
super('Inner "has" locator must belong to the same frame.')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
private def same_frame?(other)
|
65
|
+
@frame == other.instance_variable_get(:@frame)
|
66
|
+
end
|
67
|
+
|
68
|
+
private def selector_json
|
69
|
+
@selector.to_json
|
70
|
+
end
|
71
|
+
|
50
72
|
private def with_element(timeout: nil, &block)
|
51
73
|
timeout_or_default = @timeout_settings.timeout(timeout)
|
52
74
|
start_time = Time.now
|
@@ -67,6 +89,10 @@ module Playwright
|
|
67
89
|
end
|
68
90
|
end
|
69
91
|
|
92
|
+
def page
|
93
|
+
@frame.page
|
94
|
+
end
|
95
|
+
|
70
96
|
def bounding_box(timeout: nil)
|
71
97
|
with_element(timeout: timeout) do |handle|
|
72
98
|
handle.bounding_box
|
@@ -180,12 +206,13 @@ module Playwright
|
|
180
206
|
@frame.fill(@selector, value, strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
|
181
207
|
end
|
182
208
|
|
183
|
-
def locator(selector, hasText: nil)
|
209
|
+
def locator(selector, hasText: nil, has: nil)
|
184
210
|
LocatorImpl.new(
|
185
211
|
frame: @frame,
|
186
212
|
timeout_settings: @timeout_settings,
|
187
213
|
selector: "#{@selector} >> #{selector}",
|
188
214
|
hasText: hasText,
|
215
|
+
has: has,
|
189
216
|
)
|
190
217
|
end
|
191
218
|
|
@@ -5,7 +5,7 @@ module Playwright
|
|
5
5
|
@count = count
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def increment
|
9
9
|
return false if expired?
|
10
10
|
|
11
11
|
@count = @count - 1
|
@@ -18,7 +18,7 @@ module Playwright
|
|
18
18
|
end
|
19
19
|
|
20
20
|
class StubCounter
|
21
|
-
def
|
21
|
+
def increment
|
22
22
|
true
|
23
23
|
end
|
24
24
|
|
@@ -43,14 +43,17 @@ module Playwright
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
46
|
+
def match?(url)
|
47
|
+
@url_matcher.match?(url)
|
48
|
+
end
|
49
|
+
|
50
|
+
def async_handle(route, request)
|
51
|
+
@counter.increment
|
48
52
|
|
49
|
-
|
53
|
+
Concurrent::Promises.future do
|
50
54
|
@handler.call(route, request)
|
51
|
-
|
52
|
-
|
53
|
-
false
|
55
|
+
rescue => err
|
56
|
+
puts err, err.backtrace
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
data/lib/playwright/transport.rb
CHANGED
@@ -46,8 +46,7 @@ module Playwright
|
|
46
46
|
#
|
47
47
|
# @note This method blocks until playwright-cli exited. Consider using Thread or Future.
|
48
48
|
def async_run
|
49
|
-
|
50
|
-
@stdin, @stdout, @stderr, @thread = run_driver_with_open3
|
49
|
+
@stdin, @stdout, @stderr, @thread = Open3.popen3("#{@driver_executable_path} run-driver", { pgroup: true })
|
51
50
|
@stdin.binmode # Ensure Strings are written 1:1 without encoding conversion, necessary for integer values
|
52
51
|
|
53
52
|
Thread.new { handle_stdout }
|
@@ -56,18 +55,6 @@ module Playwright
|
|
56
55
|
|
57
56
|
private
|
58
57
|
|
59
|
-
def run_driver_with_open3
|
60
|
-
Open3.popen3("#{@driver_executable_path} run-driver", { pgroup: true })
|
61
|
-
rescue ArgumentError => err
|
62
|
-
# Windows doesn't accept pgroup parameter.
|
63
|
-
# ArgumentError: wrong exec option symbol: pgroup
|
64
|
-
if err.message =~ /pgroup/
|
65
|
-
Open3.popen3("#{@driver_executable_path} run-driver")
|
66
|
-
else
|
67
|
-
raise
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
58
|
def handle_stdout(packet_size: 32_768)
|
72
59
|
while chunk = @stdout.read(4)
|
73
60
|
length = chunk.unpack1('V') # unsigned 32bit, little endian
|
data/lib/playwright/version.rb
CHANGED
@@ -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.
|
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.
|
@@ -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.
|
@@ -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
@@ -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,8 +1387,8 @@ 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
|
@@ -1402,8 +1402,8 @@ module Playwright
|
|
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
|
@@ -87,13 +87,13 @@ module Playwright
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# @nodoc
|
90
|
-
def
|
91
|
-
wrap_impl(@impl.
|
90
|
+
def electron
|
91
|
+
wrap_impl(@impl.electron)
|
92
92
|
end
|
93
93
|
|
94
94
|
# @nodoc
|
95
|
-
def
|
96
|
-
wrap_impl(@impl.
|
95
|
+
def android
|
96
|
+
wrap_impl(@impl.android)
|
97
97
|
end
|
98
98
|
|
99
99
|
# -- inherited from EventEmitter --
|
data/lib/playwright_api/route.rb
CHANGED
@@ -47,8 +47,9 @@ module Playwright
|
|
47
47
|
contentType: nil,
|
48
48
|
headers: nil,
|
49
49
|
path: nil,
|
50
|
+
response: nil,
|
50
51
|
status: nil)
|
51
|
-
wrap_impl(@impl.fulfill(body: unwrap_impl(body), contentType: unwrap_impl(contentType), headers: unwrap_impl(headers), path: unwrap_impl(path), status: unwrap_impl(status)))
|
52
|
+
wrap_impl(@impl.fulfill(body: unwrap_impl(body), contentType: unwrap_impl(contentType), headers: unwrap_impl(headers), path: unwrap_impl(path), response: unwrap_impl(response), status: unwrap_impl(status)))
|
52
53
|
end
|
53
54
|
|
54
55
|
# A request to be routed.
|
@@ -22,8 +22,13 @@ module Playwright
|
|
22
22
|
# page.goto("https://playwright.dev")
|
23
23
|
# context.tracing.stop(path = "trace.zip")
|
24
24
|
# ```
|
25
|
-
def start(
|
26
|
-
|
25
|
+
def start(
|
26
|
+
name: nil,
|
27
|
+
screenshots: nil,
|
28
|
+
snapshots: nil,
|
29
|
+
sources: nil,
|
30
|
+
title: nil)
|
31
|
+
wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots), sources: unwrap_impl(sources), title: unwrap_impl(title)))
|
27
32
|
end
|
28
33
|
|
29
34
|
# Start a new trace chunk. If you'd like to record multiple traces on the same `BrowserContext`, use
|
@@ -58,5 +63,27 @@ module Playwright
|
|
58
63
|
def stop_chunk(path: nil)
|
59
64
|
wrap_impl(@impl.stop_chunk(path: unwrap_impl(path)))
|
60
65
|
end
|
66
|
+
|
67
|
+
# -- inherited from EventEmitter --
|
68
|
+
# @nodoc
|
69
|
+
def off(event, callback)
|
70
|
+
event_emitter_proxy.off(event, callback)
|
71
|
+
end
|
72
|
+
|
73
|
+
# -- inherited from EventEmitter --
|
74
|
+
# @nodoc
|
75
|
+
def once(event, callback)
|
76
|
+
event_emitter_proxy.once(event, callback)
|
77
|
+
end
|
78
|
+
|
79
|
+
# -- inherited from EventEmitter --
|
80
|
+
# @nodoc
|
81
|
+
def on(event, callback)
|
82
|
+
event_emitter_proxy.on(event, callback)
|
83
|
+
end
|
84
|
+
|
85
|
+
private def event_emitter_proxy
|
86
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
87
|
+
end
|
61
88
|
end
|
62
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playwright-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -304,6 +304,7 @@ files:
|
|
304
304
|
- lib/playwright/channel_owners/route.rb
|
305
305
|
- lib/playwright/channel_owners/selectors.rb
|
306
306
|
- lib/playwright/channel_owners/stream.rb
|
307
|
+
- lib/playwright/channel_owners/tracing.rb
|
307
308
|
- lib/playwright/channel_owners/web_socket.rb
|
308
309
|
- lib/playwright/channel_owners/worker.rb
|
309
310
|
- lib/playwright/connection.rb
|
@@ -329,7 +330,6 @@ files:
|
|
329
330
|
- lib/playwright/select_option_values.rb
|
330
331
|
- lib/playwright/timeout_settings.rb
|
331
332
|
- lib/playwright/touchscreen_impl.rb
|
332
|
-
- lib/playwright/tracing_impl.rb
|
333
333
|
- lib/playwright/transport.rb
|
334
334
|
- lib/playwright/url_matcher.rb
|
335
335
|
- lib/playwright/utils.rb
|
@@ -396,5 +396,5 @@ requirements: []
|
|
396
396
|
rubygems_version: 3.3.7
|
397
397
|
signing_key:
|
398
398
|
specification_version: 4
|
399
|
-
summary: The Ruby binding of playwright driver 1.
|
399
|
+
summary: The Ruby binding of playwright driver 1.19.0
|
400
400
|
test_files: []
|