playwright-ruby-client 1.56.0 → 1.57.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/console_message.md +9 -0
- data/documentation/docs/api/element_handle.md +2 -0
- data/documentation/docs/api/frame.md +1 -0
- data/documentation/docs/api/locator.md +22 -0
- data/documentation/docs/api/page.md +1 -2
- data/documentation/docs/api/worker.md +20 -0
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +19 -0
- data/documentation/docs/article/guides/rails_integration.md +43 -2
- data/documentation/docs/include/api_coverage.md +3 -5
- data/documentation/package.json +2 -2
- data/documentation/yarn.lock +9003 -12370
- data/lib/playwright/channel_owners/browser_context.rb +5 -2
- data/lib/playwright/channel_owners/element_handle.rb +6 -2
- data/lib/playwright/channel_owners/frame.rb +9 -3
- data/lib/playwright/channel_owners/page.rb +30 -10
- data/lib/playwright/channel_owners/worker.rb +19 -0
- data/lib/playwright/console_message_impl.rb +3 -4
- data/lib/playwright/events.rb +1 -0
- data/lib/playwright/locator_impl.rb +25 -5
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/web_socket_transport.rb +1 -1
- data/lib/playwright.rb +4 -0
- data/lib/playwright_api/console_message.rb +6 -0
- data/lib/playwright_api/element_handle.rb +4 -2
- data/lib/playwright_api/frame.rb +2 -1
- data/lib/playwright_api/locator.rb +22 -3
- data/lib/playwright_api/page.rb +8 -11
- data/lib/playwright_api/worker.rb +17 -0
- data/sig/playwright.rbs +10 -12
- metadata +2 -5
- data/documentation/docs/api/accessibility.md +0 -66
- data/lib/playwright/accessibility_impl.rb +0 -50
- data/lib/playwright_api/accessibility.rb +0 -57
|
@@ -30,7 +30,7 @@ module Playwright
|
|
|
30
30
|
on_service_worker(ChannelOwners::Worker.from(params['worker']))
|
|
31
31
|
})
|
|
32
32
|
@channel.on('console', ->(params) {
|
|
33
|
-
on_console_message(ConsoleMessageImpl.new(params, ChannelOwners::Page.from_nullable(params['page'])))
|
|
33
|
+
on_console_message(ConsoleMessageImpl.new(params, ChannelOwners::Page.from_nullable(params['page']), ChannelOwners::Worker.from_nullable(params['worker'])))
|
|
34
34
|
})
|
|
35
35
|
@channel.on('pageError', ->(params) {
|
|
36
36
|
on_page_error(
|
|
@@ -162,10 +162,13 @@ module Playwright
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
private def on_console_message(message)
|
|
165
|
-
|
|
165
|
+
if (worker = message.worker)
|
|
166
|
+
worker.emit(Events::Worker::Console, message)
|
|
167
|
+
end
|
|
166
168
|
if (page = message.page)
|
|
167
169
|
page.emit(Events::Page::Console, message)
|
|
168
170
|
end
|
|
171
|
+
emit(Events::BrowserContext::Console, message)
|
|
169
172
|
end
|
|
170
173
|
|
|
171
174
|
private def on_dialog(dialog)
|
|
@@ -110,7 +110,8 @@ module Playwright
|
|
|
110
110
|
noWaitAfter: nil,
|
|
111
111
|
position: nil,
|
|
112
112
|
timeout: nil,
|
|
113
|
-
trial: nil
|
|
113
|
+
trial: nil,
|
|
114
|
+
steps: nil)
|
|
114
115
|
|
|
115
116
|
params = {
|
|
116
117
|
button: button,
|
|
@@ -122,6 +123,7 @@ module Playwright
|
|
|
122
123
|
position: position,
|
|
123
124
|
timeout: _timeout(timeout),
|
|
124
125
|
trial: trial,
|
|
126
|
+
steps: steps,
|
|
125
127
|
}.compact
|
|
126
128
|
@channel.send_message_to_server('click', params)
|
|
127
129
|
|
|
@@ -136,7 +138,8 @@ module Playwright
|
|
|
136
138
|
noWaitAfter: nil,
|
|
137
139
|
position: nil,
|
|
138
140
|
timeout: nil,
|
|
139
|
-
trial: nil
|
|
141
|
+
trial: nil,
|
|
142
|
+
steps: nil)
|
|
140
143
|
|
|
141
144
|
params = {
|
|
142
145
|
button: button,
|
|
@@ -147,6 +150,7 @@ module Playwright
|
|
|
147
150
|
position: position,
|
|
148
151
|
timeout: _timeout(timeout),
|
|
149
152
|
trial: trial,
|
|
153
|
+
steps: steps,
|
|
150
154
|
}.compact
|
|
151
155
|
@channel.send_message_to_server('dblclick', params)
|
|
152
156
|
|
|
@@ -337,7 +337,8 @@ module Playwright
|
|
|
337
337
|
position: nil,
|
|
338
338
|
strict: nil,
|
|
339
339
|
timeout: nil,
|
|
340
|
-
trial: nil
|
|
340
|
+
trial: nil,
|
|
341
|
+
steps: nil)
|
|
341
342
|
|
|
342
343
|
params = {
|
|
343
344
|
selector: selector,
|
|
@@ -351,6 +352,7 @@ module Playwright
|
|
|
351
352
|
strict: strict,
|
|
352
353
|
timeout: _timeout(timeout),
|
|
353
354
|
trial: trial,
|
|
355
|
+
steps: steps,
|
|
354
356
|
}.compact
|
|
355
357
|
@channel.send_message_to_server('click', params)
|
|
356
358
|
|
|
@@ -366,7 +368,8 @@ module Playwright
|
|
|
366
368
|
strict: nil,
|
|
367
369
|
targetPosition: nil,
|
|
368
370
|
timeout: nil,
|
|
369
|
-
trial: nil
|
|
371
|
+
trial: nil,
|
|
372
|
+
steps: nil)
|
|
370
373
|
|
|
371
374
|
params = {
|
|
372
375
|
source: source,
|
|
@@ -378,6 +381,7 @@ module Playwright
|
|
|
378
381
|
targetPosition: targetPosition,
|
|
379
382
|
timeout: _timeout(timeout),
|
|
380
383
|
trial: trial,
|
|
384
|
+
steps: steps,
|
|
381
385
|
}.compact
|
|
382
386
|
@channel.send_message_to_server('dragAndDrop', params)
|
|
383
387
|
|
|
@@ -394,7 +398,8 @@ module Playwright
|
|
|
394
398
|
position: nil,
|
|
395
399
|
strict: nil,
|
|
396
400
|
timeout: nil,
|
|
397
|
-
trial: nil
|
|
401
|
+
trial: nil,
|
|
402
|
+
steps: nil)
|
|
398
403
|
|
|
399
404
|
params = {
|
|
400
405
|
selector: selector,
|
|
@@ -407,6 +412,7 @@ module Playwright
|
|
|
407
412
|
strict: strict,
|
|
408
413
|
timeout: _timeout(timeout),
|
|
409
414
|
trial: trial,
|
|
415
|
+
steps: steps,
|
|
410
416
|
}.compact
|
|
411
417
|
@channel.send_message_to_server('dblclick', params)
|
|
412
418
|
|
|
@@ -11,7 +11,6 @@ module Playwright
|
|
|
11
11
|
private def after_initialize
|
|
12
12
|
@browser_context = @parent
|
|
13
13
|
@timeout_settings = TimeoutSettings.new(@browser_context.send(:_timeout_settings))
|
|
14
|
-
@accessibility = AccessibilityImpl.new(@channel)
|
|
15
14
|
@keyboard = KeyboardImpl.new(@channel)
|
|
16
15
|
@mouse = MouseImpl.new(@channel)
|
|
17
16
|
@touchscreen = TouchscreenImpl.new(@channel)
|
|
@@ -79,7 +78,6 @@ module Playwright
|
|
|
79
78
|
end
|
|
80
79
|
|
|
81
80
|
attr_reader \
|
|
82
|
-
:accessibility,
|
|
83
81
|
:keyboard,
|
|
84
82
|
:mouse,
|
|
85
83
|
:touchscreen,
|
|
@@ -536,7 +534,8 @@ module Playwright
|
|
|
536
534
|
position: nil,
|
|
537
535
|
strict: nil,
|
|
538
536
|
timeout: nil,
|
|
539
|
-
trial: nil
|
|
537
|
+
trial: nil,
|
|
538
|
+
steps: nil)
|
|
540
539
|
|
|
541
540
|
@main_frame.click(
|
|
542
541
|
selector,
|
|
@@ -550,6 +549,7 @@ module Playwright
|
|
|
550
549
|
strict: strict,
|
|
551
550
|
timeout: timeout,
|
|
552
551
|
trial: trial,
|
|
552
|
+
steps: steps,
|
|
553
553
|
)
|
|
554
554
|
end
|
|
555
555
|
|
|
@@ -562,7 +562,8 @@ module Playwright
|
|
|
562
562
|
strict: nil,
|
|
563
563
|
targetPosition: nil,
|
|
564
564
|
timeout: nil,
|
|
565
|
-
trial: nil
|
|
565
|
+
trial: nil,
|
|
566
|
+
steps: nil)
|
|
566
567
|
|
|
567
568
|
@main_frame.drag_and_drop(
|
|
568
569
|
source,
|
|
@@ -573,7 +574,9 @@ module Playwright
|
|
|
573
574
|
strict: strict,
|
|
574
575
|
targetPosition: targetPosition,
|
|
575
576
|
timeout: timeout,
|
|
576
|
-
trial: trial
|
|
577
|
+
trial: trial,
|
|
578
|
+
steps: steps,
|
|
579
|
+
)
|
|
577
580
|
end
|
|
578
581
|
|
|
579
582
|
def dblclick(
|
|
@@ -586,7 +589,8 @@ module Playwright
|
|
|
586
589
|
position: nil,
|
|
587
590
|
strict: nil,
|
|
588
591
|
timeout: nil,
|
|
589
|
-
trial: nil
|
|
592
|
+
trial: nil,
|
|
593
|
+
steps: nil)
|
|
590
594
|
@main_frame.dblclick(
|
|
591
595
|
selector,
|
|
592
596
|
button: button,
|
|
@@ -598,6 +602,7 @@ module Playwright
|
|
|
598
602
|
strict: strict,
|
|
599
603
|
timeout: timeout,
|
|
600
604
|
trial: trial,
|
|
605
|
+
steps: steps,
|
|
601
606
|
)
|
|
602
607
|
end
|
|
603
608
|
|
|
@@ -641,7 +646,7 @@ module Playwright
|
|
|
641
646
|
def console_messages
|
|
642
647
|
messages = @channel.send_message_to_server('consoleMessages')
|
|
643
648
|
messages.map do |message|
|
|
644
|
-
ConsoleMessageImpl.new(message, self)
|
|
649
|
+
ConsoleMessageImpl.new(message, self, nil)
|
|
645
650
|
end
|
|
646
651
|
end
|
|
647
652
|
|
|
@@ -901,8 +906,23 @@ module Playwright
|
|
|
901
906
|
@video ||= Video.new(self)
|
|
902
907
|
end
|
|
903
908
|
|
|
904
|
-
def snapshot_for_ai(timeout: nil)
|
|
905
|
-
|
|
909
|
+
def snapshot_for_ai(timeout: nil, mode: nil, track: nil)
|
|
910
|
+
option_mode = mode || 'full'
|
|
911
|
+
unless ['full', 'incremental'].include?(option_mode)
|
|
912
|
+
raise ArgumentError.new("mode must be either 'full' or 'incremental'")
|
|
913
|
+
end
|
|
914
|
+
|
|
915
|
+
options = {
|
|
916
|
+
timeout: @timeout_settings.timeout(timeout),
|
|
917
|
+
mode: option_mode,
|
|
918
|
+
}
|
|
919
|
+
options[:track] = track if track
|
|
920
|
+
result = @channel.send_message_to_server_result('snapshotForAI', options)
|
|
921
|
+
if option_mode == 'full'
|
|
922
|
+
result['full']
|
|
923
|
+
elsif option_mode == 'incremental'
|
|
924
|
+
result['incremental']
|
|
925
|
+
end
|
|
906
926
|
end
|
|
907
927
|
|
|
908
928
|
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
@@ -1032,7 +1052,7 @@ module Playwright
|
|
|
1032
1052
|
expect_event(Events::Page::Worker, predicate: predicate, timeout: timeout, &block)
|
|
1033
1053
|
end
|
|
1034
1054
|
|
|
1035
|
-
# called from Frame with send(:
|
|
1055
|
+
# called from Frame with send(:_timeout_settings)
|
|
1036
1056
|
private def _timeout_settings
|
|
1037
1057
|
@timeout_settings
|
|
1038
1058
|
end
|
|
@@ -4,6 +4,10 @@ module Playwright
|
|
|
4
4
|
|
|
5
5
|
private def after_initialize
|
|
6
6
|
@channel.once('close', ->(_) { on_close })
|
|
7
|
+
|
|
8
|
+
set_event_to_subscription_mapping({
|
|
9
|
+
Events::Worker::Console => "console",
|
|
10
|
+
})
|
|
7
11
|
end
|
|
8
12
|
|
|
9
13
|
private def on_close
|
|
@@ -23,5 +27,20 @@ module Playwright
|
|
|
23
27
|
def evaluate_handle(expression, arg: nil)
|
|
24
28
|
JavaScript::Expression.new(expression, arg).evaluate_handle(@channel)
|
|
25
29
|
end
|
|
30
|
+
|
|
31
|
+
def expect_event(event, predicate: nil, timeout: nil, &block)
|
|
32
|
+
waiter = Waiter.new(self, wait_name: "Worker.expect_event(#{event})")
|
|
33
|
+
timeout_value = timeout || @page&.send(:_timeout_settings)&.timeout || @context&.send(:_timeout_settings)&.timeout
|
|
34
|
+
waiter.reject_on_timeout(timeout_value, "Timeout #{timeout_value}ms exceeded while waiting for event \"#{event}\"")
|
|
35
|
+
|
|
36
|
+
unless event == Events::Worker::Close
|
|
37
|
+
waiter.reject_on_event(self, Events::Worker::Close, TargetClosedError.new)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
waiter.wait_for_event(self, event, predicate: predicate)
|
|
41
|
+
block&.call
|
|
42
|
+
|
|
43
|
+
waiter.result.value!
|
|
44
|
+
end
|
|
26
45
|
end
|
|
27
46
|
end
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
module Playwright
|
|
2
2
|
define_api_implementation :ConsoleMessageImpl do
|
|
3
|
-
def initialize(event, page)
|
|
3
|
+
def initialize(event, page, worker)
|
|
4
4
|
@event = event
|
|
5
5
|
@page = page
|
|
6
|
+
@worker = worker
|
|
6
7
|
end
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
@page
|
|
10
|
-
end
|
|
9
|
+
attr_reader :page, :worker
|
|
11
10
|
|
|
12
11
|
def type
|
|
13
12
|
@event['type']
|
data/lib/playwright/events.rb
CHANGED
|
@@ -126,7 +126,8 @@ module Playwright
|
|
|
126
126
|
noWaitAfter: nil,
|
|
127
127
|
position: nil,
|
|
128
128
|
timeout: nil,
|
|
129
|
-
trial: nil
|
|
129
|
+
trial: nil,
|
|
130
|
+
steps: nil)
|
|
130
131
|
|
|
131
132
|
@frame.click(@selector,
|
|
132
133
|
strict: true,
|
|
@@ -138,7 +139,8 @@ module Playwright
|
|
|
138
139
|
noWaitAfter: noWaitAfter,
|
|
139
140
|
position: position,
|
|
140
141
|
timeout: timeout,
|
|
141
|
-
trial: trial
|
|
142
|
+
trial: trial,
|
|
143
|
+
steps: steps)
|
|
142
144
|
end
|
|
143
145
|
|
|
144
146
|
def dblclick(
|
|
@@ -149,7 +151,8 @@ module Playwright
|
|
|
149
151
|
noWaitAfter: nil,
|
|
150
152
|
position: nil,
|
|
151
153
|
timeout: nil,
|
|
152
|
-
trial: nil
|
|
154
|
+
trial: nil,
|
|
155
|
+
steps: nil)
|
|
153
156
|
|
|
154
157
|
@frame.dblclick(@selector,
|
|
155
158
|
strict: true,
|
|
@@ -160,7 +163,8 @@ module Playwright
|
|
|
160
163
|
noWaitAfter: noWaitAfter,
|
|
161
164
|
position: position,
|
|
162
165
|
timeout: timeout,
|
|
163
|
-
trial: trial
|
|
166
|
+
trial: trial,
|
|
167
|
+
steps: steps)
|
|
164
168
|
end
|
|
165
169
|
|
|
166
170
|
def dispatch_event(type, eventInit: nil, timeout: nil)
|
|
@@ -173,7 +177,8 @@ module Playwright
|
|
|
173
177
|
sourcePosition: nil,
|
|
174
178
|
targetPosition: nil,
|
|
175
179
|
timeout: nil,
|
|
176
|
-
trial: nil
|
|
180
|
+
trial: nil,
|
|
181
|
+
steps: nil)
|
|
177
182
|
|
|
178
183
|
@frame.drag_and_drop(
|
|
179
184
|
@selector,
|
|
@@ -185,6 +190,7 @@ module Playwright
|
|
|
185
190
|
timeout: timeout,
|
|
186
191
|
trial: trial,
|
|
187
192
|
strict: true,
|
|
193
|
+
steps: steps,
|
|
188
194
|
)
|
|
189
195
|
end
|
|
190
196
|
|
|
@@ -256,6 +262,20 @@ module Playwright
|
|
|
256
262
|
)
|
|
257
263
|
end
|
|
258
264
|
|
|
265
|
+
def description
|
|
266
|
+
if @selector =~ / >> internal:describe=("(?:[^"\\]|\\.)*")$/
|
|
267
|
+
begin
|
|
268
|
+
description = JSON.parse($1)
|
|
269
|
+
if description.is_a?(String)
|
|
270
|
+
return description
|
|
271
|
+
end
|
|
272
|
+
rescue JSON::ParserError
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
nil
|
|
277
|
+
end
|
|
278
|
+
|
|
259
279
|
def filter(has: nil, hasNot: nil, hasNotText: nil, hasText: nil, visible: nil)
|
|
260
280
|
LocatorImpl.new(
|
|
261
281
|
frame: @frame,
|
data/lib/playwright/version.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Playwright
|
|
|
6
6
|
# ref: https://github.com/microsoft/playwright-python/blob/master/playwright/_impl/_transport.py
|
|
7
7
|
class WebSocketTransport
|
|
8
8
|
# @param ws_endpoint [String] EndpointURL of WebSocket
|
|
9
|
-
def initialize(ws_endpoint:, headers:)
|
|
9
|
+
def initialize(ws_endpoint:, headers: {})
|
|
10
10
|
@ws_endpoint = ws_endpoint
|
|
11
11
|
@headers = headers
|
|
12
12
|
@debug = ENV['DEBUG'].to_s == 'true' || ENV['DEBUG'].to_s == '1'
|
data/lib/playwright.rb
CHANGED
|
@@ -104,6 +104,10 @@ module Playwright
|
|
|
104
104
|
|
|
105
105
|
# @Deprecated. Playwright >= 1.54 does not support this method.
|
|
106
106
|
module_function def connect_to_playwright_server(ws_endpoint, &block)
|
|
107
|
+
if Gem::Version.new(COMPATIBLE_PLAYWRIGHT_VERSION) >= Gem::Version.new('1.54.0')
|
|
108
|
+
raise NotImplementedError, 'connect_to_playwright_server is deprecated and not supported in Playwright >= 1.54. Use connect_to_browser_server instead.'
|
|
109
|
+
end
|
|
110
|
+
|
|
107
111
|
require 'playwright/web_socket_client'
|
|
108
112
|
require 'playwright/web_socket_transport'
|
|
109
113
|
|
|
@@ -48,5 +48,11 @@ module Playwright
|
|
|
48
48
|
def type
|
|
49
49
|
wrap_impl(@impl.type)
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# The web worker or service worker that produced this console message, if any. Note that console messages from web workers also have non-null [`method: ConsoleMessage.page`].
|
|
54
|
+
def worker
|
|
55
|
+
wrap_impl(@impl.worker)
|
|
56
|
+
end
|
|
51
57
|
end
|
|
52
58
|
end
|
|
@@ -100,9 +100,10 @@ module Playwright
|
|
|
100
100
|
modifiers: nil,
|
|
101
101
|
noWaitAfter: nil,
|
|
102
102
|
position: nil,
|
|
103
|
+
steps: nil,
|
|
103
104
|
timeout: nil,
|
|
104
105
|
trial: nil)
|
|
105
|
-
wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
106
|
+
wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
106
107
|
end
|
|
107
108
|
|
|
108
109
|
#
|
|
@@ -130,9 +131,10 @@ module Playwright
|
|
|
130
131
|
modifiers: nil,
|
|
131
132
|
noWaitAfter: nil,
|
|
132
133
|
position: nil,
|
|
134
|
+
steps: nil,
|
|
133
135
|
timeout: nil,
|
|
134
136
|
trial: nil)
|
|
135
|
-
wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
137
|
+
wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
136
138
|
end
|
|
137
139
|
|
|
138
140
|
#
|
data/lib/playwright_api/frame.rb
CHANGED
|
@@ -180,11 +180,12 @@ module Playwright
|
|
|
180
180
|
force: nil,
|
|
181
181
|
noWaitAfter: nil,
|
|
182
182
|
sourcePosition: nil,
|
|
183
|
+
steps: nil,
|
|
183
184
|
strict: nil,
|
|
184
185
|
targetPosition: nil,
|
|
185
186
|
timeout: nil,
|
|
186
187
|
trial: nil)
|
|
187
|
-
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
188
|
+
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
188
189
|
end
|
|
189
190
|
|
|
190
191
|
#
|
|
@@ -227,9 +227,10 @@ module Playwright
|
|
|
227
227
|
modifiers: nil,
|
|
228
228
|
noWaitAfter: nil,
|
|
229
229
|
position: nil,
|
|
230
|
+
steps: nil,
|
|
230
231
|
timeout: nil,
|
|
231
232
|
trial: nil)
|
|
232
|
-
wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
233
|
+
wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
233
234
|
end
|
|
234
235
|
|
|
235
236
|
#
|
|
@@ -269,9 +270,10 @@ module Playwright
|
|
|
269
270
|
modifiers: nil,
|
|
270
271
|
noWaitAfter: nil,
|
|
271
272
|
position: nil,
|
|
273
|
+
steps: nil,
|
|
272
274
|
timeout: nil,
|
|
273
275
|
trial: nil)
|
|
274
|
-
wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
276
|
+
wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
275
277
|
end
|
|
276
278
|
|
|
277
279
|
#
|
|
@@ -288,6 +290,22 @@ module Playwright
|
|
|
288
290
|
wrap_impl(@impl.describe(unwrap_impl(description)))
|
|
289
291
|
end
|
|
290
292
|
|
|
293
|
+
#
|
|
294
|
+
# Returns locator description previously set with [`method: Locator.describe`]. Returns `null` if no custom description has been set. Prefer `Locator.toString()` for a human-readable representation, as it uses the description when available.
|
|
295
|
+
#
|
|
296
|
+
# **Usage**
|
|
297
|
+
#
|
|
298
|
+
# ```python sync
|
|
299
|
+
# button = page.get_by_role("button").describe("Subscribe button")
|
|
300
|
+
# print(button.description()) # "Subscribe button"
|
|
301
|
+
#
|
|
302
|
+
# input = page.get_by_role("textbox")
|
|
303
|
+
# print(input.description()) # None
|
|
304
|
+
# ```
|
|
305
|
+
def description
|
|
306
|
+
wrap_impl(@impl.description)
|
|
307
|
+
end
|
|
308
|
+
|
|
291
309
|
#
|
|
292
310
|
# Programmatically dispatch an event on the matching element.
|
|
293
311
|
#
|
|
@@ -358,10 +376,11 @@ module Playwright
|
|
|
358
376
|
force: nil,
|
|
359
377
|
noWaitAfter: nil,
|
|
360
378
|
sourcePosition: nil,
|
|
379
|
+
steps: nil,
|
|
361
380
|
targetPosition: nil,
|
|
362
381
|
timeout: nil,
|
|
363
382
|
trial: nil)
|
|
364
|
-
wrap_impl(@impl.drag_to(unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
383
|
+
wrap_impl(@impl.drag_to(unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
365
384
|
end
|
|
366
385
|
|
|
367
386
|
#
|
data/lib/playwright_api/page.rb
CHANGED
|
@@ -49,10 +49,6 @@ module Playwright
|
|
|
49
49
|
wrap_impl(@impl.clock)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
def accessibility # property
|
|
53
|
-
wrap_impl(@impl.accessibility)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
52
|
def keyboard # property
|
|
57
53
|
wrap_impl(@impl.keyboard)
|
|
58
54
|
end
|
|
@@ -278,11 +274,12 @@ module Playwright
|
|
|
278
274
|
force: nil,
|
|
279
275
|
noWaitAfter: nil,
|
|
280
276
|
sourcePosition: nil,
|
|
277
|
+
steps: nil,
|
|
281
278
|
strict: nil,
|
|
282
279
|
targetPosition: nil,
|
|
283
280
|
timeout: nil,
|
|
284
281
|
trial: nil)
|
|
285
|
-
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
282
|
+
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
286
283
|
end
|
|
287
284
|
|
|
288
285
|
#
|
|
@@ -1821,8 +1818,8 @@ module Playwright
|
|
|
1821
1818
|
end
|
|
1822
1819
|
|
|
1823
1820
|
# @nodoc
|
|
1824
|
-
def snapshot_for_ai(timeout: nil)
|
|
1825
|
-
wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout)))
|
|
1821
|
+
def snapshot_for_ai(timeout: nil, mode: nil, track: nil)
|
|
1822
|
+
wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), mode: unwrap_impl(mode), track: unwrap_impl(track)))
|
|
1826
1823
|
end
|
|
1827
1824
|
|
|
1828
1825
|
# @nodoc
|
|
@@ -1831,8 +1828,8 @@ module Playwright
|
|
|
1831
1828
|
end
|
|
1832
1829
|
|
|
1833
1830
|
# @nodoc
|
|
1834
|
-
def
|
|
1835
|
-
wrap_impl(@impl.
|
|
1831
|
+
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1832
|
+
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1836
1833
|
end
|
|
1837
1834
|
|
|
1838
1835
|
# @nodoc
|
|
@@ -1846,8 +1843,8 @@ module Playwright
|
|
|
1846
1843
|
end
|
|
1847
1844
|
|
|
1848
1845
|
# @nodoc
|
|
1849
|
-
def
|
|
1850
|
-
wrap_impl(@impl.
|
|
1846
|
+
def stop_js_coverage
|
|
1847
|
+
wrap_impl(@impl.stop_js_coverage)
|
|
1851
1848
|
end
|
|
1852
1849
|
|
|
1853
1850
|
# -- inherited from EventEmitter --
|
|
@@ -46,6 +46,23 @@ module Playwright
|
|
|
46
46
|
wrap_impl(@impl.url)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
#
|
|
50
|
+
# Waits for event to fire and passes its value into the predicate function.
|
|
51
|
+
# Returns when the predicate returns truthy value.
|
|
52
|
+
# Will throw an error if the page is closed before the event is fired.
|
|
53
|
+
# Returns the event data value.
|
|
54
|
+
#
|
|
55
|
+
# **Usage**
|
|
56
|
+
#
|
|
57
|
+
# ```python sync
|
|
58
|
+
# with worker.expect_event("console") as event_info:
|
|
59
|
+
# worker.evaluate("console.log(42)")
|
|
60
|
+
# message = event_info.value
|
|
61
|
+
# ```
|
|
62
|
+
def expect_event(event, predicate: nil, timeout: nil, &block)
|
|
63
|
+
wrap_impl(@impl.expect_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
64
|
+
end
|
|
65
|
+
|
|
49
66
|
# @nodoc
|
|
50
67
|
def context=(req)
|
|
51
68
|
wrap_impl(@impl.context=(unwrap_impl(req)))
|
data/sig/playwright.rbs
CHANGED
|
@@ -94,9 +94,9 @@ module Playwright
|
|
|
94
94
|
class ElementHandle < JSHandle
|
|
95
95
|
def bounding_box: -> (nil | Hash[untyped, untyped])
|
|
96
96
|
def check: (?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
97
|
-
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
97
|
+
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
98
98
|
def content_frame: -> (nil | Frame)
|
|
99
|
-
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
99
|
+
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
100
100
|
def dispatch_event: (String type_, ?eventInit: untyped) -> void
|
|
101
101
|
def eval_on_selector: (String selector, String expression, ?arg: untyped) -> untyped
|
|
102
102
|
def eval_on_selector_all: (String selector, String expression, ?arg: untyped) -> untyped
|
|
@@ -134,10 +134,6 @@ module Playwright
|
|
|
134
134
|
def wait_for_selector: (String selector, ?state: ("attached" | "detached" | "visible" | "hidden"), ?strict: bool, ?timeout: Float) -> (nil | ElementHandle)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
class Accessibility
|
|
138
|
-
def snapshot: (?interestingOnly: bool, ?root: ElementHandle) -> (nil | Hash[untyped, untyped])
|
|
139
|
-
end
|
|
140
|
-
|
|
141
137
|
class FileChooser
|
|
142
138
|
def element: -> ElementHandle
|
|
143
139
|
def multiple?: -> bool
|
|
@@ -155,7 +151,7 @@ module Playwright
|
|
|
155
151
|
def content: -> String
|
|
156
152
|
def dblclick: (String selector, ?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
|
157
153
|
def dispatch_event: (String selector, String type_, ?eventInit: untyped, ?strict: bool, ?timeout: Float) -> void
|
|
158
|
-
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
154
|
+
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?steps: Integer, ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
159
155
|
def eval_on_selector: (String selector, String expression, ?arg: untyped, ?strict: bool) -> untyped
|
|
160
156
|
def eval_on_selector_all: (String selector, String expression, ?arg: untyped) -> untyped
|
|
161
157
|
def evaluate: (String expression, ?arg: untyped) -> untyped
|
|
@@ -215,6 +211,7 @@ module Playwright
|
|
|
215
211
|
def evaluate: (String expression, ?arg: untyped) -> untyped
|
|
216
212
|
def evaluate_handle: (String expression, ?arg: untyped) -> JSHandle
|
|
217
213
|
def url: -> String
|
|
214
|
+
def expect_event: (String event, ?predicate: function, ?timeout: Float) { () -> void } -> untyped
|
|
218
215
|
end
|
|
219
216
|
|
|
220
217
|
class Selectors
|
|
@@ -241,6 +238,7 @@ module Playwright
|
|
|
241
238
|
def page: -> (nil | Page)
|
|
242
239
|
def text: -> String
|
|
243
240
|
def type: -> ("log" | "debug" | "info" | "error" | "warning" | "dir" | "dirxml" | "table" | "trace" | "clear" | "startGroup" | "startGroupCollapsed" | "endGroup" | "assert" | "profile" | "profileEnd" | "count" | "timeEnd")
|
|
241
|
+
def worker: -> (nil | Worker)
|
|
244
242
|
end
|
|
245
243
|
|
|
246
244
|
class Dialog
|
|
@@ -275,7 +273,7 @@ module Playwright
|
|
|
275
273
|
def context: -> BrowserContext
|
|
276
274
|
def dblclick: (String selector, ?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
|
277
275
|
def dispatch_event: (String selector, String type_, ?eventInit: untyped, ?strict: bool, ?timeout: Float) -> void
|
|
278
|
-
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
276
|
+
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?steps: Integer, ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
279
277
|
def emulate_media: (?colorScheme: ("light" | "dark" | "no-preference" | "null"), ?contrast: ("no-preference" | "more" | "null"), ?forcedColors: ("active" | "none" | "null"), ?media: ("screen" | "print" | "null"), ?reducedMotion: ("reduce" | "no-preference" | "null")) -> void
|
|
280
278
|
def eval_on_selector: (String selector, String expression, ?arg: untyped, ?strict: bool) -> untyped
|
|
281
279
|
def eval_on_selector_all: (String selector, String expression, ?arg: untyped) -> untyped
|
|
@@ -368,7 +366,6 @@ module Playwright
|
|
|
368
366
|
def workers: -> Array[untyped]
|
|
369
367
|
|
|
370
368
|
attr_reader clock: Clock
|
|
371
|
-
attr_reader accessibility: Accessibility
|
|
372
369
|
attr_reader keyboard: Keyboard
|
|
373
370
|
attr_reader mouse: Mouse
|
|
374
371
|
attr_reader request: APIRequestContext
|
|
@@ -468,12 +465,13 @@ module Playwright
|
|
|
468
465
|
def bounding_box: (?timeout: Float) -> (nil | Hash[untyped, untyped])
|
|
469
466
|
def check: (?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
470
467
|
def clear: (?force: bool, ?noWaitAfter: bool, ?timeout: Float) -> void
|
|
471
|
-
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
468
|
+
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
472
469
|
def count: -> Integer
|
|
473
|
-
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
470
|
+
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
474
471
|
def describe: (String description) -> Locator
|
|
472
|
+
def description: -> (nil | String)
|
|
475
473
|
def dispatch_event: (String type_, ?eventInit: untyped, ?timeout: Float) -> void
|
|
476
|
-
def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
474
|
+
def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?steps: Integer, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
477
475
|
def element_handle: (?timeout: Float) -> ElementHandle
|
|
478
476
|
def element_handles: -> Array[untyped]
|
|
479
477
|
def content_frame: -> FrameLocator
|