playwright-ruby-client 1.55.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/CONTRIBUTING.md +5 -0
- data/README.md +4 -0
- data/documentation/docs/api/browser_context.md +6 -2
- 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 +32 -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 +6 -5
- data/documentation/package.json +3 -3
- data/documentation/yarn.lock +3754 -3372
- data/lib/playwright/channel_owners/browser_context.rb +7 -16
- 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 +49 -10
- data/lib/playwright/channel_owners/worker.rb +19 -0
- data/lib/playwright/console_message_impl.rb +4 -4
- data/lib/playwright/events.rb +1 -0
- data/lib/playwright/locator_assertions_impl.rb +5 -2
- data/lib/playwright/locator_impl.rb +25 -5
- data/lib/playwright/page_assertions_impl.rb +5 -2
- 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/browser_context.rb +2 -2
- 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 +23 -4
- data/lib/playwright_api/page.rb +31 -12
- data/lib/playwright_api/worker.rb +20 -3
- data/sig/playwright.rbs +13 -12
- metadata +3 -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
|
@@ -14,7 +14,6 @@ module Playwright
|
|
|
14
14
|
@bindings = {}
|
|
15
15
|
@timeout_settings = TimeoutSettings.new
|
|
16
16
|
@service_workers = Set.new
|
|
17
|
-
@background_pages = Set.new
|
|
18
17
|
@owner_page = nil
|
|
19
18
|
|
|
20
19
|
@tracing = ChannelOwners::Tracing.from(@initializer['tracing'])
|
|
@@ -27,14 +26,11 @@ module Playwright
|
|
|
27
26
|
@channel.once('close', ->(_) { on_close })
|
|
28
27
|
@channel.on('page', ->(params) { on_page(ChannelOwners::Page.from(params['page']) )})
|
|
29
28
|
@channel.on('route', ->(params) { on_route(ChannelOwners::Route.from(params['route'])) })
|
|
30
|
-
@channel.on('backgroundPage', ->(params) {
|
|
31
|
-
on_background_page(ChannelOwners::Page.from(params['page']))
|
|
32
|
-
})
|
|
33
29
|
@channel.on('serviceWorker', ->(params) {
|
|
34
30
|
on_service_worker(ChannelOwners::Worker.from(params['worker']))
|
|
35
31
|
})
|
|
36
32
|
@channel.on('console', ->(params) {
|
|
37
|
-
on_console_message(ConsoleMessageImpl.new(params))
|
|
33
|
+
on_console_message(ConsoleMessageImpl.new(params, ChannelOwners::Page.from_nullable(params['page']), ChannelOwners::Worker.from_nullable(params['worker'])))
|
|
38
34
|
})
|
|
39
35
|
@channel.on('pageError', ->(params) {
|
|
40
36
|
on_page_error(
|
|
@@ -104,11 +100,6 @@ module Playwright
|
|
|
104
100
|
page.send(:emit_popup_event_from_browser_context)
|
|
105
101
|
end
|
|
106
102
|
|
|
107
|
-
private def on_background_page(page)
|
|
108
|
-
@background_pages << page
|
|
109
|
-
emit(Events::BrowserContext::BackgroundPage, page)
|
|
110
|
-
end
|
|
111
|
-
|
|
112
103
|
private def on_route(route)
|
|
113
104
|
route.send(:update_context, self)
|
|
114
105
|
|
|
@@ -171,10 +162,13 @@ module Playwright
|
|
|
171
162
|
end
|
|
172
163
|
|
|
173
164
|
private def on_console_message(message)
|
|
174
|
-
|
|
165
|
+
if (worker = message.worker)
|
|
166
|
+
worker.emit(Events::Worker::Console, message)
|
|
167
|
+
end
|
|
175
168
|
if (page = message.page)
|
|
176
169
|
page.emit(Events::Page::Console, message)
|
|
177
170
|
end
|
|
171
|
+
emit(Events::BrowserContext::Console, message)
|
|
178
172
|
end
|
|
179
173
|
|
|
180
174
|
private def on_dialog(dialog)
|
|
@@ -216,7 +210,8 @@ module Playwright
|
|
|
216
210
|
end
|
|
217
211
|
|
|
218
212
|
def background_pages
|
|
219
|
-
|
|
213
|
+
puts '[WARNING] BrowserContext#background_pages is deprecated. Returns an empty list.'
|
|
214
|
+
[]
|
|
220
215
|
end
|
|
221
216
|
|
|
222
217
|
def service_workers
|
|
@@ -543,10 +538,6 @@ module Playwright
|
|
|
543
538
|
@pages.delete(page)
|
|
544
539
|
end
|
|
545
540
|
|
|
546
|
-
private def remove_background_page(page)
|
|
547
|
-
@background_pages.delete(page)
|
|
548
|
-
end
|
|
549
|
-
|
|
550
541
|
private def remove_service_worker(worker)
|
|
551
542
|
@service_workers.delete(worker)
|
|
552
543
|
end
|
|
@@ -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,
|
|
@@ -149,7 +147,6 @@ module Playwright
|
|
|
149
147
|
private def on_close
|
|
150
148
|
@closed = true
|
|
151
149
|
@browser_context.send(:remove_page, self)
|
|
152
|
-
@browser_context.send(:remove_background_page, self)
|
|
153
150
|
if @closed_or_crashed_promise.pending?
|
|
154
151
|
@closed_or_crashed_promise.fulfill(close_error_with_reason)
|
|
155
152
|
end
|
|
@@ -537,7 +534,8 @@ module Playwright
|
|
|
537
534
|
position: nil,
|
|
538
535
|
strict: nil,
|
|
539
536
|
timeout: nil,
|
|
540
|
-
trial: nil
|
|
537
|
+
trial: nil,
|
|
538
|
+
steps: nil)
|
|
541
539
|
|
|
542
540
|
@main_frame.click(
|
|
543
541
|
selector,
|
|
@@ -551,6 +549,7 @@ module Playwright
|
|
|
551
549
|
strict: strict,
|
|
552
550
|
timeout: timeout,
|
|
553
551
|
trial: trial,
|
|
552
|
+
steps: steps,
|
|
554
553
|
)
|
|
555
554
|
end
|
|
556
555
|
|
|
@@ -563,7 +562,8 @@ module Playwright
|
|
|
563
562
|
strict: nil,
|
|
564
563
|
targetPosition: nil,
|
|
565
564
|
timeout: nil,
|
|
566
|
-
trial: nil
|
|
565
|
+
trial: nil,
|
|
566
|
+
steps: nil)
|
|
567
567
|
|
|
568
568
|
@main_frame.drag_and_drop(
|
|
569
569
|
source,
|
|
@@ -574,7 +574,9 @@ module Playwright
|
|
|
574
574
|
strict: strict,
|
|
575
575
|
targetPosition: targetPosition,
|
|
576
576
|
timeout: timeout,
|
|
577
|
-
trial: trial
|
|
577
|
+
trial: trial,
|
|
578
|
+
steps: steps,
|
|
579
|
+
)
|
|
578
580
|
end
|
|
579
581
|
|
|
580
582
|
def dblclick(
|
|
@@ -587,7 +589,8 @@ module Playwright
|
|
|
587
589
|
position: nil,
|
|
588
590
|
strict: nil,
|
|
589
591
|
timeout: nil,
|
|
590
|
-
trial: nil
|
|
592
|
+
trial: nil,
|
|
593
|
+
steps: nil)
|
|
591
594
|
@main_frame.dblclick(
|
|
592
595
|
selector,
|
|
593
596
|
button: button,
|
|
@@ -599,6 +602,7 @@ module Playwright
|
|
|
599
602
|
strict: strict,
|
|
600
603
|
timeout: timeout,
|
|
601
604
|
trial: trial,
|
|
605
|
+
steps: steps,
|
|
602
606
|
)
|
|
603
607
|
end
|
|
604
608
|
|
|
@@ -639,6 +643,20 @@ module Playwright
|
|
|
639
643
|
timeout: timeout)
|
|
640
644
|
end
|
|
641
645
|
|
|
646
|
+
def console_messages
|
|
647
|
+
messages = @channel.send_message_to_server('consoleMessages')
|
|
648
|
+
messages.map do |message|
|
|
649
|
+
ConsoleMessageImpl.new(message, self, nil)
|
|
650
|
+
end
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
def page_errors
|
|
654
|
+
errors = @channel.send_message_to_server('pageErrors')
|
|
655
|
+
errors.map do |error|
|
|
656
|
+
Error.parse(error['error'])
|
|
657
|
+
end
|
|
658
|
+
end
|
|
659
|
+
|
|
642
660
|
def locator(
|
|
643
661
|
selector,
|
|
644
662
|
has: nil,
|
|
@@ -826,6 +844,12 @@ module Playwright
|
|
|
826
844
|
@workers.to_a
|
|
827
845
|
end
|
|
828
846
|
|
|
847
|
+
def requests
|
|
848
|
+
@channel.send_message_to_server('requests').map do |req|
|
|
849
|
+
ChannelOwners::Request.from(req)
|
|
850
|
+
end
|
|
851
|
+
end
|
|
852
|
+
|
|
829
853
|
def request
|
|
830
854
|
@browser_context.request
|
|
831
855
|
end
|
|
@@ -882,8 +906,23 @@ module Playwright
|
|
|
882
906
|
@video ||= Video.new(self)
|
|
883
907
|
end
|
|
884
908
|
|
|
885
|
-
def snapshot_for_ai(timeout: nil)
|
|
886
|
-
|
|
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
|
|
887
926
|
end
|
|
888
927
|
|
|
889
928
|
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
@@ -1013,7 +1052,7 @@ module Playwright
|
|
|
1013
1052
|
expect_event(Events::Page::Worker, predicate: predicate, timeout: timeout, &block)
|
|
1014
1053
|
end
|
|
1015
1054
|
|
|
1016
|
-
# called from Frame with send(:
|
|
1055
|
+
# called from Frame with send(:_timeout_settings)
|
|
1017
1056
|
private def _timeout_settings
|
|
1018
1057
|
@timeout_settings
|
|
1019
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,12 +1,12 @@
|
|
|
1
1
|
module Playwright
|
|
2
2
|
define_api_implementation :ConsoleMessageImpl do
|
|
3
|
-
def initialize(event)
|
|
3
|
+
def initialize(event, page, worker)
|
|
4
4
|
@event = event
|
|
5
|
+
@page = page
|
|
6
|
+
@worker = worker
|
|
5
7
|
end
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
@page ||= ChannelOwners::Page.from_nullable(@event['page'])
|
|
9
|
-
end
|
|
9
|
+
attr_reader :page, :worker
|
|
10
10
|
|
|
11
11
|
def type
|
|
12
12
|
@event['type']
|
data/lib/playwright/events.rb
CHANGED
|
@@ -49,8 +49,11 @@ module Playwright
|
|
|
49
49
|
"\n#{message}"
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if result['errorMessage']
|
|
53
|
+
error_message = "\n#{result['errorMessage']}"
|
|
54
|
+
end
|
|
55
|
+
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}"
|
|
56
|
+
raise AssertionError.new(out)
|
|
54
57
|
else
|
|
55
58
|
true
|
|
56
59
|
end
|
|
@@ -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,
|
|
@@ -50,8 +50,11 @@ module Playwright
|
|
|
50
50
|
"\n#{message}"
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if result['errorMessage']
|
|
54
|
+
error_message = "\n#{result['errorMessage']}"
|
|
55
|
+
end
|
|
56
|
+
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}"
|
|
57
|
+
raise AssertionError.new(out)
|
|
55
58
|
else
|
|
56
59
|
true
|
|
57
60
|
end
|
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
|
|
|
@@ -72,9 +72,9 @@ module Playwright
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
#
|
|
75
|
-
#
|
|
75
|
+
# Returns an empty list.
|
|
76
76
|
#
|
|
77
|
-
#
|
|
77
|
+
# @deprecated Background pages have been removed from Chromium together with Manifest V2 extensions.
|
|
78
78
|
def background_pages
|
|
79
79
|
wrap_impl(@impl.background_pages)
|
|
80
80
|
end
|
|
@@ -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
|
#
|
|
@@ -61,7 +61,7 @@ module Playwright
|
|
|
61
61
|
# The following example finds a button with a specific title.
|
|
62
62
|
#
|
|
63
63
|
# ```python sync
|
|
64
|
-
# button = page.get_by_role("button").and_(page.
|
|
64
|
+
# button = page.get_by_role("button").and_(page.get_by_title("Subscribe"))
|
|
65
65
|
# ```
|
|
66
66
|
def and(locator)
|
|
67
67
|
wrap_impl(@impl.and(unwrap_impl(locator)))
|
|
@@ -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
|
#
|