playwright-ruby-client 1.52.0 → 1.53.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/experimental/android.md +10 -0
- data/documentation/docs/api/locator.md +24 -1
- data/documentation/docs/api/locator_assertions.md +4 -7
- data/documentation/docs/api/page.md +1 -1
- data/documentation/docs/api/selectors.md +10 -0
- data/documentation/docs/api/tracing.md +8 -0
- data/documentation/docs/include/api_coverage.md +3 -2
- data/lib/playwright/channel.rb +6 -3
- data/lib/playwright/channel_owners/android.rb +12 -0
- data/lib/playwright/channel_owners/android_device.rb +6 -5
- data/lib/playwright/channel_owners/api_request_context.rb +6 -1
- data/lib/playwright/channel_owners/browser.rb +37 -6
- data/lib/playwright/channel_owners/browser_context.rb +44 -23
- data/lib/playwright/channel_owners/browser_type.rb +45 -12
- data/lib/playwright/channel_owners/element_handle.rb +22 -17
- data/lib/playwright/channel_owners/frame.rb +40 -33
- data/lib/playwright/channel_owners/page.rb +19 -8
- data/lib/playwright/channel_owners/playwright.rb +10 -4
- data/lib/playwright/channel_owners/web_socket.rb +1 -1
- data/lib/playwright/connection.rb +3 -0
- data/lib/playwright/file_chooser_impl.rb +3 -2
- data/lib/playwright/frame_locator_impl.rb +5 -8
- data/lib/playwright/locator_assertions_impl.rb +64 -34
- data/lib/playwright/locator_impl.rb +31 -20
- data/lib/playwright/page_assertions_impl.rb +10 -8
- data/lib/playwright/selectors_impl.rb +45 -0
- data/lib/playwright/test.rb +21 -3
- data/lib/playwright/timeout_settings.rb +5 -0
- data/lib/playwright/utils.rb +0 -33
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +12 -7
- data/lib/playwright_api/android_device.rb +8 -8
- data/lib/playwright_api/api_request_context.rb +6 -6
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +10 -10
- data/lib/playwright_api/browser_type.rb +6 -6
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +6 -6
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +30 -4
- data/lib/playwright_api/locator_assertions.rb +3 -3
- data/lib/playwright_api/page.rb +13 -8
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +8 -8
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +1 -28
- data/lib/playwright_api/tracing.rb +14 -6
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- data/sig/playwright.rbs +6 -1
- metadata +4 -4
- data/lib/playwright/channel_owners/selectors.rb +0 -26
@@ -3,6 +3,11 @@ require_relative './js_handle'
|
|
3
3
|
module Playwright
|
4
4
|
module ChannelOwners
|
5
5
|
class ElementHandle < JSHandle
|
6
|
+
private def _timeout(timeout)
|
7
|
+
# @parent is Frame
|
8
|
+
@parent.send(:_timeout, timeout)
|
9
|
+
end
|
10
|
+
|
6
11
|
def as_element
|
7
12
|
self
|
8
13
|
end
|
@@ -69,7 +74,7 @@ module Playwright
|
|
69
74
|
|
70
75
|
def scroll_into_view_if_needed(timeout: nil)
|
71
76
|
params = {
|
72
|
-
timeout: timeout,
|
77
|
+
timeout: _timeout(timeout),
|
73
78
|
}.compact
|
74
79
|
@channel.send_message_to_server('scrollIntoViewIfNeeded', params)
|
75
80
|
|
@@ -88,7 +93,7 @@ module Playwright
|
|
88
93
|
modifiers: modifiers,
|
89
94
|
noWaitAfter: noWaitAfter,
|
90
95
|
position: position,
|
91
|
-
timeout: timeout,
|
96
|
+
timeout: _timeout(timeout),
|
92
97
|
trial: trial,
|
93
98
|
}.compact
|
94
99
|
@channel.send_message_to_server('hover', params)
|
@@ -115,7 +120,7 @@ module Playwright
|
|
115
120
|
modifiers: modifiers,
|
116
121
|
noWaitAfter: noWaitAfter,
|
117
122
|
position: position,
|
118
|
-
timeout: timeout,
|
123
|
+
timeout: _timeout(timeout),
|
119
124
|
trial: trial,
|
120
125
|
}.compact
|
121
126
|
@channel.send_message_to_server('click', params)
|
@@ -140,7 +145,7 @@ module Playwright
|
|
140
145
|
modifiers: modifiers,
|
141
146
|
noWaitAfter: noWaitAfter,
|
142
147
|
position: position,
|
143
|
-
timeout: timeout,
|
148
|
+
timeout: _timeout(timeout),
|
144
149
|
trial: trial,
|
145
150
|
}.compact
|
146
151
|
@channel.send_message_to_server('dblclick', params)
|
@@ -162,7 +167,7 @@ module Playwright
|
|
162
167
|
value: value,
|
163
168
|
label: label,
|
164
169
|
).as_params
|
165
|
-
params = base_params.merge({ force: force, noWaitAfter: noWaitAfter, timeout: timeout }.compact)
|
170
|
+
params = base_params.merge({ force: force, noWaitAfter: noWaitAfter, timeout: _timeout(timeout) }.compact)
|
166
171
|
@channel.send_message_to_server('selectOption', params)
|
167
172
|
end
|
168
173
|
|
@@ -179,7 +184,7 @@ module Playwright
|
|
179
184
|
modifiers: modifiers,
|
180
185
|
noWaitAfter: noWaitAfter,
|
181
186
|
position: position,
|
182
|
-
timeout: timeout,
|
187
|
+
timeout: _timeout(timeout),
|
183
188
|
trial: trial,
|
184
189
|
}.compact
|
185
190
|
@channel.send_message_to_server('tap', params)
|
@@ -192,7 +197,7 @@ module Playwright
|
|
192
197
|
value: value,
|
193
198
|
force: force,
|
194
199
|
noWaitAfter: noWaitAfter,
|
195
|
-
timeout: timeout,
|
200
|
+
timeout: _timeout(timeout),
|
196
201
|
}.compact
|
197
202
|
@channel.send_message_to_server('fill', params)
|
198
203
|
|
@@ -200,14 +205,14 @@ module Playwright
|
|
200
205
|
end
|
201
206
|
|
202
207
|
def select_text(force: nil, timeout: nil)
|
203
|
-
params = { force: force, timeout: timeout }.compact
|
208
|
+
params = { force: force, timeout: _timeout(timeout) }.compact
|
204
209
|
@channel.send_message_to_server('selectText', params)
|
205
210
|
|
206
211
|
nil
|
207
212
|
end
|
208
213
|
|
209
214
|
def input_value(timeout: nil)
|
210
|
-
params = { timeout: timeout }.compact
|
215
|
+
params = { timeout: _timeout(timeout) }.compact
|
211
216
|
@channel.send_message_to_server('inputValue', params)
|
212
217
|
end
|
213
218
|
|
@@ -218,7 +223,7 @@ module Playwright
|
|
218
223
|
end
|
219
224
|
|
220
225
|
method_name, params = InputFiles.new(frame.page.context, files).as_method_and_params
|
221
|
-
params.merge!({ noWaitAfter: noWaitAfter, timeout: timeout }.compact)
|
226
|
+
params.merge!({ noWaitAfter: noWaitAfter, timeout: _timeout(timeout) }.compact)
|
222
227
|
@channel.send_message_to_server(method_name, params)
|
223
228
|
|
224
229
|
nil
|
@@ -235,7 +240,7 @@ module Playwright
|
|
235
240
|
text: text,
|
236
241
|
delay: delay,
|
237
242
|
noWaitAfter: noWaitAfter,
|
238
|
-
timeout: timeout,
|
243
|
+
timeout: _timeout(timeout),
|
239
244
|
}.compact
|
240
245
|
@channel.send_message_to_server('type', params)
|
241
246
|
|
@@ -247,7 +252,7 @@ module Playwright
|
|
247
252
|
key: key,
|
248
253
|
delay: delay,
|
249
254
|
noWaitAfter: noWaitAfter,
|
250
|
-
timeout: timeout,
|
255
|
+
timeout: _timeout(timeout),
|
251
256
|
}.compact
|
252
257
|
@channel.send_message_to_server('press', params)
|
253
258
|
|
@@ -259,7 +264,7 @@ module Playwright
|
|
259
264
|
force: force,
|
260
265
|
noWaitAfter: noWaitAfter,
|
261
266
|
position: position,
|
262
|
-
timeout: timeout,
|
267
|
+
timeout: _timeout(timeout),
|
263
268
|
trial: trial,
|
264
269
|
}.compact
|
265
270
|
@channel.send_message_to_server('check', params)
|
@@ -272,7 +277,7 @@ module Playwright
|
|
272
277
|
force: force,
|
273
278
|
noWaitAfter: noWaitAfter,
|
274
279
|
position: position,
|
275
|
-
timeout: timeout,
|
280
|
+
timeout: _timeout(timeout),
|
276
281
|
trial: trial,
|
277
282
|
}.compact
|
278
283
|
@channel.send_message_to_server('uncheck', params)
|
@@ -314,7 +319,7 @@ module Playwright
|
|
314
319
|
quality: quality,
|
315
320
|
scale: scale,
|
316
321
|
style: style,
|
317
|
-
timeout: timeout,
|
322
|
+
timeout: _timeout(timeout),
|
318
323
|
type: type,
|
319
324
|
}.compact
|
320
325
|
if mask.is_a?(Enumerable)
|
@@ -352,14 +357,14 @@ module Playwright
|
|
352
357
|
end
|
353
358
|
|
354
359
|
def wait_for_element_state(state, timeout: nil)
|
355
|
-
params = { state: state, timeout: timeout }.compact
|
360
|
+
params = { state: state, timeout: _timeout(timeout) }.compact
|
356
361
|
@channel.send_message_to_server('waitForElementState', params)
|
357
362
|
|
358
363
|
nil
|
359
364
|
end
|
360
365
|
|
361
366
|
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
|
362
|
-
params = { selector: selector, state: state, strict: strict, timeout: timeout }.compact
|
367
|
+
params = { selector: selector, state: state, strict: strict, timeout: _timeout(timeout) }.compact
|
363
368
|
resp = @channel.send_message_to_server('waitForSelector', params)
|
364
369
|
|
365
370
|
ChannelOwners::ElementHandle.from_nullable(resp)
|
@@ -26,6 +26,14 @@ module Playwright
|
|
26
26
|
attr_reader :page, :parent_frame
|
27
27
|
attr_writer :detached
|
28
28
|
|
29
|
+
private def _timeout(timeout)
|
30
|
+
@page.send(:_timeout_settings).timeout(timeout)
|
31
|
+
end
|
32
|
+
|
33
|
+
private def _navigation_timeout(timeout)
|
34
|
+
@page.send(:_timeout_settings).navigation_timeout(timeout)
|
35
|
+
end
|
36
|
+
|
29
37
|
private def on_load_state(add:, remove:)
|
30
38
|
if add
|
31
39
|
@load_states << add
|
@@ -63,7 +71,7 @@ module Playwright
|
|
63
71
|
def goto(url, timeout: nil, waitUntil: nil, referer: nil)
|
64
72
|
params = {
|
65
73
|
url: url,
|
66
|
-
timeout: timeout,
|
74
|
+
timeout: _navigation_timeout(timeout),
|
67
75
|
waitUntil: waitUntil,
|
68
76
|
referer: referer
|
69
77
|
}.compact
|
@@ -94,7 +102,7 @@ module Playwright
|
|
94
102
|
|
95
103
|
def expect_navigation(timeout: nil, url: nil, waitUntil: nil, &block)
|
96
104
|
option_wait_until = waitUntil || 'load'
|
97
|
-
option_timeout = timeout
|
105
|
+
option_timeout = _navigation_timeout(timeout)
|
98
106
|
time_start = Time.now
|
99
107
|
|
100
108
|
waiter = setup_navigation_waiter(wait_name: :expect_navigation, timeout_value: option_timeout)
|
@@ -148,7 +156,7 @@ module Playwright
|
|
148
156
|
|
149
157
|
def wait_for_load_state(state: nil, timeout: nil)
|
150
158
|
option_state = state || 'load'
|
151
|
-
option_timeout = timeout
|
159
|
+
option_timeout = _navigation_timeout(timeout)
|
152
160
|
unless %w(load domcontentloaded networkidle commit).include?(option_state)
|
153
161
|
raise ArgumentError.new('state: expected one of (load|domcontentloaded|networkidle|commit)')
|
154
162
|
end
|
@@ -204,39 +212,39 @@ module Playwright
|
|
204
212
|
end
|
205
213
|
|
206
214
|
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
|
207
|
-
params = { selector: selector, state: state, strict: strict, timeout: timeout }.compact
|
215
|
+
params = { selector: selector, state: state, strict: strict, timeout: _timeout(timeout) }.compact
|
208
216
|
resp = @channel.send_message_to_server('waitForSelector', params)
|
209
217
|
|
210
218
|
ChannelOwners::ElementHandle.from_nullable(resp)
|
211
219
|
end
|
212
220
|
|
213
221
|
def checked?(selector, strict: nil, timeout: nil)
|
214
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
222
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
215
223
|
@channel.send_message_to_server('isChecked', params)
|
216
224
|
end
|
217
225
|
|
218
226
|
def disabled?(selector, strict: nil, timeout: nil)
|
219
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
227
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
220
228
|
@channel.send_message_to_server('isDisabled', params)
|
221
229
|
end
|
222
230
|
|
223
231
|
def editable?(selector, strict: nil, timeout: nil)
|
224
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
232
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
225
233
|
@channel.send_message_to_server('isEditable', params)
|
226
234
|
end
|
227
235
|
|
228
236
|
def enabled?(selector, strict: nil, timeout: nil)
|
229
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
237
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
230
238
|
@channel.send_message_to_server('isEnabled', params)
|
231
239
|
end
|
232
240
|
|
233
241
|
def hidden?(selector, strict: nil, timeout: nil)
|
234
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
242
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
235
243
|
@channel.send_message_to_server('isHidden', params)
|
236
244
|
end
|
237
245
|
|
238
246
|
def visible?(selector, strict: nil, timeout: nil)
|
239
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
247
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
240
248
|
@channel.send_message_to_server('isVisible', params)
|
241
249
|
end
|
242
250
|
|
@@ -246,7 +254,7 @@ module Playwright
|
|
246
254
|
type: type,
|
247
255
|
eventInit: JavaScript::ValueSerializer.new(eventInit).serialize,
|
248
256
|
strict: strict,
|
249
|
-
timeout: timeout,
|
257
|
+
timeout: _timeout(timeout),
|
250
258
|
}.compact
|
251
259
|
@channel.send_message_to_server('dispatchEvent', params)
|
252
260
|
|
@@ -268,7 +276,7 @@ module Playwright
|
|
268
276
|
def set_content(html, timeout: nil, waitUntil: nil)
|
269
277
|
params = {
|
270
278
|
html: html,
|
271
|
-
timeout: timeout,
|
279
|
+
timeout: _navigation_timeout(timeout),
|
272
280
|
waitUntil: waitUntil,
|
273
281
|
}.compact
|
274
282
|
|
@@ -341,7 +349,7 @@ module Playwright
|
|
341
349
|
noWaitAfter: noWaitAfter,
|
342
350
|
position: position,
|
343
351
|
strict: strict,
|
344
|
-
timeout: timeout,
|
352
|
+
timeout: _timeout(timeout),
|
345
353
|
trial: trial,
|
346
354
|
}.compact
|
347
355
|
@channel.send_message_to_server('click', params)
|
@@ -368,7 +376,7 @@ module Playwright
|
|
368
376
|
sourcePosition: sourcePosition,
|
369
377
|
strict: strict,
|
370
378
|
targetPosition: targetPosition,
|
371
|
-
timeout: timeout,
|
379
|
+
timeout: _timeout(timeout),
|
372
380
|
trial: trial,
|
373
381
|
}.compact
|
374
382
|
@channel.send_message_to_server('dragAndDrop', params)
|
@@ -397,7 +405,7 @@ module Playwright
|
|
397
405
|
noWaitAfter: noWaitAfter,
|
398
406
|
position: position,
|
399
407
|
strict: strict,
|
400
|
-
timeout: timeout,
|
408
|
+
timeout: _timeout(timeout),
|
401
409
|
trial: trial,
|
402
410
|
}.compact
|
403
411
|
@channel.send_message_to_server('dblclick', params)
|
@@ -421,7 +429,7 @@ module Playwright
|
|
421
429
|
noWaitAfter: noWaitAfter,
|
422
430
|
position: position,
|
423
431
|
strict: strict,
|
424
|
-
timeout: timeout,
|
432
|
+
timeout: _timeout(timeout),
|
425
433
|
trial: trial,
|
426
434
|
}.compact
|
427
435
|
@channel.send_message_to_server('tap', params)
|
@@ -442,7 +450,7 @@ module Playwright
|
|
442
450
|
force: force,
|
443
451
|
noWaitAfter: noWaitAfter,
|
444
452
|
strict: strict,
|
445
|
-
timeout: timeout,
|
453
|
+
timeout: _timeout(timeout),
|
446
454
|
}.compact
|
447
455
|
@channel.send_message_to_server('fill', params)
|
448
456
|
|
@@ -457,7 +465,6 @@ module Playwright
|
|
457
465
|
hasText: nil)
|
458
466
|
LocatorImpl.new(
|
459
467
|
frame: self,
|
460
|
-
timeout_settings: @page.send(:timeout_settings),
|
461
468
|
selector: selector,
|
462
469
|
has: has,
|
463
470
|
hasNot: hasNot,
|
@@ -466,27 +473,27 @@ module Playwright
|
|
466
473
|
end
|
467
474
|
|
468
475
|
def frame_locator(selector)
|
469
|
-
FrameLocatorImpl.new(frame: self,
|
476
|
+
FrameLocatorImpl.new(frame: self, frame_selector: selector)
|
470
477
|
end
|
471
478
|
|
472
479
|
def focus(selector, strict: nil, timeout: nil)
|
473
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
480
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
474
481
|
@channel.send_message_to_server('focus', params)
|
475
482
|
nil
|
476
483
|
end
|
477
484
|
|
478
485
|
def text_content(selector, strict: nil, timeout: nil)
|
479
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
486
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
480
487
|
@channel.send_message_to_server('textContent', params)
|
481
488
|
end
|
482
489
|
|
483
490
|
def inner_text(selector, strict: nil, timeout: nil)
|
484
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
491
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
485
492
|
@channel.send_message_to_server('innerText', params)
|
486
493
|
end
|
487
494
|
|
488
495
|
def inner_html(selector, strict: nil, timeout: nil)
|
489
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
496
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
490
497
|
@channel.send_message_to_server('innerHTML', params)
|
491
498
|
end
|
492
499
|
|
@@ -495,7 +502,7 @@ module Playwright
|
|
495
502
|
selector: selector,
|
496
503
|
name: name,
|
497
504
|
strict: strict,
|
498
|
-
timeout: timeout,
|
505
|
+
timeout: _timeout(timeout),
|
499
506
|
}.compact
|
500
507
|
@channel.send_message_to_server('getAttribute', params)
|
501
508
|
end
|
@@ -516,7 +523,7 @@ module Playwright
|
|
516
523
|
noWaitAfter: noWaitAfter,
|
517
524
|
position: position,
|
518
525
|
strict: strict,
|
519
|
-
timeout: timeout,
|
526
|
+
timeout: _timeout(timeout),
|
520
527
|
trial: trial,
|
521
528
|
}.compact
|
522
529
|
@channel.send_message_to_server('hover', params)
|
@@ -540,12 +547,12 @@ module Playwright
|
|
540
547
|
value: value,
|
541
548
|
label: label,
|
542
549
|
).as_params
|
543
|
-
params = base_params.merge({ selector: selector, force: force, noWaitAfter: noWaitAfter, strict: strict, timeout: timeout }.compact)
|
550
|
+
params = base_params.merge({ selector: selector, force: force, noWaitAfter: noWaitAfter, strict: strict, timeout: _timeout(timeout) }.compact)
|
544
551
|
@channel.send_message_to_server('selectOption', params)
|
545
552
|
end
|
546
553
|
|
547
554
|
def input_value(selector, strict: nil, timeout: nil)
|
548
|
-
params = { selector: selector, strict: strict, timeout: timeout }.compact
|
555
|
+
params = { selector: selector, strict: strict, timeout: _timeout(timeout) }.compact
|
549
556
|
@channel.send_message_to_server('inputValue', params)
|
550
557
|
end
|
551
558
|
|
@@ -555,7 +562,7 @@ module Playwright
|
|
555
562
|
selector: selector,
|
556
563
|
noWaitAfter: noWaitAfter,
|
557
564
|
strict: strict,
|
558
|
-
timeout: timeout,
|
565
|
+
timeout: _timeout(timeout),
|
559
566
|
}.compact)
|
560
567
|
@channel.send_message_to_server(method_name, params)
|
561
568
|
|
@@ -576,7 +583,7 @@ module Playwright
|
|
576
583
|
delay: delay,
|
577
584
|
noWaitAfter: noWaitAfter,
|
578
585
|
strict: strict,
|
579
|
-
timeout: timeout,
|
586
|
+
timeout: _timeout(timeout),
|
580
587
|
}.compact
|
581
588
|
@channel.send_message_to_server('type', params)
|
582
589
|
|
@@ -597,7 +604,7 @@ module Playwright
|
|
597
604
|
delay: delay,
|
598
605
|
noWaitAfter: noWaitAfter,
|
599
606
|
strict: strict,
|
600
|
-
timeout: timeout,
|
607
|
+
timeout: _timeout(timeout),
|
601
608
|
}.compact
|
602
609
|
@channel.send_message_to_server('press', params)
|
603
610
|
|
@@ -619,7 +626,7 @@ module Playwright
|
|
619
626
|
noWaitAfter: noWaitAfter,
|
620
627
|
position: position,
|
621
628
|
strict: strict,
|
622
|
-
timeout: timeout,
|
629
|
+
timeout: _timeout(timeout),
|
623
630
|
trial: trial,
|
624
631
|
}.compact
|
625
632
|
@channel.send_message_to_server('check', params)
|
@@ -642,7 +649,7 @@ module Playwright
|
|
642
649
|
noWaitAfter: noWaitAfter,
|
643
650
|
position: position,
|
644
651
|
strict: strict,
|
645
|
-
timeout: timeout,
|
652
|
+
timeout: _timeout(timeout),
|
646
653
|
trial: trial,
|
647
654
|
}.compact
|
648
655
|
@channel.send_message_to_server('uncheck', params)
|
@@ -670,7 +677,7 @@ module Playwright
|
|
670
677
|
end
|
671
678
|
|
672
679
|
expression = JavaScript::Expression.new(pageFunction, arg)
|
673
|
-
expression.wait_for_function(@channel, polling: polling, timeout: timeout)
|
680
|
+
expression.wait_for_function(@channel, polling: polling, timeout: _timeout(timeout))
|
674
681
|
end
|
675
682
|
|
676
683
|
def title
|
@@ -42,6 +42,7 @@ module Playwright
|
|
42
42
|
@channel.on('fileChooser', ->(params) {
|
43
43
|
chooser = FileChooserImpl.new(
|
44
44
|
page: self,
|
45
|
+
timeout_settings: @timeout_settings,
|
45
46
|
element_handle: ChannelOwners::ElementHandle.from(params['element']),
|
46
47
|
is_multiple: params['isMultiple'])
|
47
48
|
emit(Events::Page::FileChooser, chooser)
|
@@ -57,6 +58,7 @@ module Playwright
|
|
57
58
|
})
|
58
59
|
@channel.on('route', ->(params) { on_route(ChannelOwners::Route.from(params['route'])) })
|
59
60
|
@channel.on('video', method(:on_video))
|
61
|
+
@channel.on('viewportSizeChanged', method(:on_viewport_size_changed))
|
60
62
|
@channel.on('webSocket', ->(params) {
|
61
63
|
emit(Events::Page::WebSocket, ChannelOwners::WebSocket.from(params['webSocket']))
|
62
64
|
})
|
@@ -177,6 +179,13 @@ module Playwright
|
|
177
179
|
video.send(:set_artifact, artifact)
|
178
180
|
end
|
179
181
|
|
182
|
+
private def on_viewport_size_changed(params)
|
183
|
+
@viewport_size = {
|
184
|
+
width: params['viewportSize']['width'],
|
185
|
+
height: params['viewportSize']['height'],
|
186
|
+
}
|
187
|
+
end
|
188
|
+
|
180
189
|
# @override
|
181
190
|
private def perform_event_emitter_callback(event, callback, args)
|
182
191
|
should_callback_async = [
|
@@ -230,12 +239,10 @@ module Playwright
|
|
230
239
|
|
231
240
|
def set_default_navigation_timeout(timeout)
|
232
241
|
@timeout_settings.default_navigation_timeout = timeout
|
233
|
-
@channel.send_message_to_server('setDefaultNavigationTimeoutNoReply', timeout: timeout)
|
234
242
|
end
|
235
243
|
|
236
244
|
def set_default_timeout(timeout)
|
237
245
|
@timeout_settings.default_timeout = timeout
|
238
|
-
@channel.send_message_to_server('setDefaultTimeoutNoReply', timeout: timeout)
|
239
246
|
end
|
240
247
|
|
241
248
|
def query_selector(selector, strict: nil)
|
@@ -339,7 +346,7 @@ module Playwright
|
|
339
346
|
|
340
347
|
def reload(timeout: nil, waitUntil: nil)
|
341
348
|
params = {
|
342
|
-
timeout: timeout,
|
349
|
+
timeout: @timeout_settings.timeout(timeout),
|
343
350
|
waitUntil: waitUntil,
|
344
351
|
}.compact
|
345
352
|
resp = @channel.send_message_to_server('reload', params)
|
@@ -355,13 +362,13 @@ module Playwright
|
|
355
362
|
end
|
356
363
|
|
357
364
|
def go_back(timeout: nil, waitUntil: nil)
|
358
|
-
params = { timeout: timeout, waitUntil: waitUntil }.compact
|
365
|
+
params = { timeout: @timeout_settings.timeout(timeout), waitUntil: waitUntil }.compact
|
359
366
|
resp = @channel.send_message_to_server('goBack', params)
|
360
367
|
ChannelOwners::Response.from_nullable(resp)
|
361
368
|
end
|
362
369
|
|
363
370
|
def go_forward(timeout: nil, waitUntil: nil)
|
364
|
-
params = { timeout: timeout, waitUntil: waitUntil }.compact
|
371
|
+
params = { timeout: @timeout_settings.timeout(timeout), waitUntil: waitUntil }.compact
|
365
372
|
resp = @channel.send_message_to_server('goForward', params)
|
366
373
|
ChannelOwners::Response.from_nullable(resp)
|
367
374
|
end
|
@@ -432,7 +439,7 @@ module Playwright
|
|
432
439
|
|
433
440
|
def route_from_har(har, notFound: nil, update: nil, url: nil, updateContent: nil, updateMode: nil)
|
434
441
|
if update
|
435
|
-
@browser_context.send(:record_into_har, har, self,
|
442
|
+
@browser_context.send(:record_into_har, har, self, url: url, update_content: updateContent, update_mode: updateMode)
|
436
443
|
return
|
437
444
|
end
|
438
445
|
|
@@ -481,7 +488,7 @@ module Playwright
|
|
481
488
|
caret: caret,
|
482
489
|
scale: scale,
|
483
490
|
style: style,
|
484
|
-
timeout: timeout,
|
491
|
+
timeout: @timeout_settings.timeout(timeout),
|
485
492
|
}.compact
|
486
493
|
if mask.is_a?(Enumerable)
|
487
494
|
params[:mask] = mask.map do |locator|
|
@@ -875,6 +882,10 @@ module Playwright
|
|
875
882
|
@video ||= Video.new(self)
|
876
883
|
end
|
877
884
|
|
885
|
+
def snapshot_for_ai
|
886
|
+
@channel.send_message_to_server('snapshotForAI')
|
887
|
+
end
|
888
|
+
|
878
889
|
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
879
890
|
params = {
|
880
891
|
resetOnNavigation: resetOnNavigation,
|
@@ -1003,7 +1014,7 @@ module Playwright
|
|
1003
1014
|
end
|
1004
1015
|
|
1005
1016
|
# called from Frame with send(:timeout_settings)
|
1006
|
-
private def
|
1017
|
+
private def _timeout_settings
|
1007
1018
|
@timeout_settings
|
1008
1019
|
end
|
1009
1020
|
|
@@ -1,15 +1,21 @@
|
|
1
1
|
module Playwright
|
2
2
|
define_channel_owner :Playwright do
|
3
3
|
def chromium
|
4
|
-
@chromium ||= ::Playwright::ChannelOwners::BrowserType.from(@initializer['chromium'])
|
4
|
+
@chromium ||= ::Playwright::ChannelOwners::BrowserType.from(@initializer['chromium']).tap do |browser_type|
|
5
|
+
browser_type.send(:update_playwright, self)
|
6
|
+
end
|
5
7
|
end
|
6
8
|
|
7
9
|
def firefox
|
8
|
-
@firefox ||= ::Playwright::ChannelOwners::BrowserType.from(@initializer['firefox'])
|
10
|
+
@firefox ||= ::Playwright::ChannelOwners::BrowserType.from(@initializer['firefox']).tap do |browser_type|
|
11
|
+
browser_type.send(:update_playwright, self)
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
def webkit
|
12
|
-
@webkit ||= ::Playwright::ChannelOwners::BrowserType.from(@initializer['webkit'])
|
16
|
+
@webkit ||= ::Playwright::ChannelOwners::BrowserType.from(@initializer['webkit']).tap do |browser_type|
|
17
|
+
browser_type.send(:update_playwright, self)
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
def android
|
@@ -21,7 +27,7 @@ module Playwright
|
|
21
27
|
end
|
22
28
|
|
23
29
|
def selectors
|
24
|
-
@selectors ||= ::Playwright::
|
30
|
+
@selectors ||= ::Playwright::SelectorsImpl.new
|
25
31
|
end
|
26
32
|
|
27
33
|
def devices
|
@@ -35,7 +35,7 @@ module Playwright
|
|
35
35
|
|
36
36
|
def expect_event(event, predicate: nil, timeout: nil, &block)
|
37
37
|
waiter = Waiter.new(self, wait_name: "WebSocket.expect_event(#{event})")
|
38
|
-
timeout_value = timeout || @parent.send(:
|
38
|
+
timeout_value = timeout || @parent.send(:_timeout_settings).timeout
|
39
39
|
waiter.reject_on_timeout(timeout_value, "Timeout #{timeout_value}ms exceeded while waiting for event \"#{event}\"")
|
40
40
|
|
41
41
|
unless event == Events::WebSocket::Close
|
@@ -90,6 +90,9 @@ module Playwright
|
|
90
90
|
_metadata[:apiName] = metadata[:apiName]
|
91
91
|
_metadata[:location] = metadata[:stack].first
|
92
92
|
_metadata[:internal] = !metadata[:apiName]
|
93
|
+
if metadata[:title]
|
94
|
+
_metadata[:title] = metadata[:title]
|
95
|
+
end
|
93
96
|
end
|
94
97
|
_metadata.compact!
|
95
98
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Playwright
|
2
2
|
define_api_implementation :FileChooserImpl do
|
3
|
-
def initialize(page:, element_handle:, is_multiple:)
|
3
|
+
def initialize(page:, timeout_settings:, element_handle:, is_multiple:)
|
4
4
|
@page = page
|
5
|
+
@timeout_settings = timeout_settings
|
5
6
|
@element_handle = element_handle
|
6
7
|
@is_multiple = is_multiple
|
7
8
|
end
|
@@ -17,7 +18,7 @@ module Playwright
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def set_files(files, noWaitAfter: nil, timeout: nil)
|
20
|
-
@element_handle.set_input_files(files, noWaitAfter: noWaitAfter, timeout: timeout)
|
21
|
+
@element_handle.set_input_files(files, noWaitAfter: noWaitAfter, timeout: @timeout_settings.timeout(timeout))
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -4,12 +4,15 @@ module Playwright
|
|
4
4
|
define_api_implementation :FrameLocatorImpl do
|
5
5
|
include LocatorUtils
|
6
6
|
|
7
|
-
def initialize(frame:,
|
7
|
+
def initialize(frame:, frame_selector:)
|
8
8
|
@frame = frame
|
9
|
-
@timeout_settings = timeout_settings
|
10
9
|
@frame_selector = frame_selector
|
11
10
|
end
|
12
11
|
|
12
|
+
private def _timeout(timeout)
|
13
|
+
@frame.send(:_timeout, timeout)
|
14
|
+
end
|
15
|
+
|
13
16
|
def locator(
|
14
17
|
selector,
|
15
18
|
has: nil,
|
@@ -18,7 +21,6 @@ module Playwright
|
|
18
21
|
hasText: nil)
|
19
22
|
LocatorImpl.new(
|
20
23
|
frame: @frame,
|
21
|
-
timeout_settings: @timeout_settings,
|
22
24
|
selector: "#{@frame_selector} >> internal:control=enter-frame >> #{selector}",
|
23
25
|
has: has,
|
24
26
|
hasNot: hasNot,
|
@@ -29,7 +31,6 @@ module Playwright
|
|
29
31
|
def owner
|
30
32
|
LocatorImpl.new(
|
31
33
|
frame: @frame,
|
32
|
-
timeout_settings: @timeout_settings,
|
33
34
|
selector: @frame_selector,
|
34
35
|
)
|
35
36
|
end
|
@@ -37,7 +38,6 @@ module Playwright
|
|
37
38
|
def frame_locator(selector)
|
38
39
|
FrameLocatorImpl.new(
|
39
40
|
frame: @frame,
|
40
|
-
timeout_settings: @timeout_settings,
|
41
41
|
frame_selector: "#{@frame_selector} >> internal:control=enter-frame >> #{selector}",
|
42
42
|
)
|
43
43
|
end
|
@@ -45,7 +45,6 @@ module Playwright
|
|
45
45
|
def first
|
46
46
|
FrameLocatorImpl.new(
|
47
47
|
frame: @frame,
|
48
|
-
timeout_settings: @timeout_settings,
|
49
48
|
frame_selector: "#{@frame_selector} >> nth=0",
|
50
49
|
)
|
51
50
|
end
|
@@ -53,7 +52,6 @@ module Playwright
|
|
53
52
|
def last
|
54
53
|
FrameLocatorImpl.new(
|
55
54
|
frame: @frame,
|
56
|
-
timeout_settings: @timeout_settings,
|
57
55
|
frame_selector: "#{@frame_selector} >> nth=-1",
|
58
56
|
)
|
59
57
|
end
|
@@ -61,7 +59,6 @@ module Playwright
|
|
61
59
|
def nth(index)
|
62
60
|
FrameLocatorImpl.new(
|
63
61
|
frame: @frame,
|
64
|
-
timeout_settings: @timeout_settings,
|
65
62
|
frame_selector: "#{@frame_selector} >> nth=#{index}",
|
66
63
|
)
|
67
64
|
end
|