playwright-ruby-client 1.27.0 → 1.28.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/element_handle.md +1 -0
- data/documentation/docs/api/frame.md +51 -3
- data/documentation/docs/api/frame_locator.md +50 -3
- data/documentation/docs/api/js_handle.md +5 -3
- data/documentation/docs/api/keyboard.md +1 -1
- data/documentation/docs/api/locator.md +73 -3
- data/documentation/docs/api/page.md +51 -3
- data/documentation/docs/api/request.md +1 -1
- data/documentation/docs/article/guides/rails_integration.md +1 -0
- data/documentation/docs/include/api_coverage.md +3 -0
- data/lib/playwright/channel_owner.rb +41 -0
- data/lib/playwright/channel_owners/browser_context.rb +6 -0
- data/lib/playwright/channel_owners/element_handle.rb +8 -1
- data/lib/playwright/channel_owners/frame.rb +2 -0
- data/lib/playwright/channel_owners/page.rb +23 -28
- data/lib/playwright/connection.rb +4 -1
- data/lib/playwright/locator_impl.rb +16 -2
- data/lib/playwright/locator_utils.rb +13 -19
- data/lib/playwright/utils.rb +6 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +12 -6
- data/lib/playwright_api/android_device.rb +6 -6
- 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 +6 -6
- data/lib/playwright_api/browser_type.rb +6 -6
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +8 -7
- data/lib/playwright_api/frame.rb +45 -11
- data/lib/playwright_api/frame_locator.rb +39 -6
- data/lib/playwright_api/js_handle.rb +7 -7
- data/lib/playwright_api/keyboard.rb +1 -1
- data/lib/playwright_api/locator.rb +55 -5
- data/lib/playwright_api/page.rb +45 -11
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +7 -7
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/tracing.rb +6 -6
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +6 -6
- metadata +4 -4
@@ -8,6 +8,7 @@ module Playwright
|
|
8
8
|
include LocatorUtils
|
9
9
|
attr_writer :owned_context
|
10
10
|
|
11
|
+
|
11
12
|
private def after_initialize
|
12
13
|
@browser_context = @parent
|
13
14
|
@timeout_settings = TimeoutSettings.new(@browser_context.send(:_timeout_settings))
|
@@ -73,6 +74,14 @@ module Playwright
|
|
73
74
|
worker = ChannelOwners::Worker.from(params['worker'])
|
74
75
|
on_worker(worker)
|
75
76
|
})
|
77
|
+
|
78
|
+
set_event_to_subscription_mapping({
|
79
|
+
Events::Page::Request => "request",
|
80
|
+
Events::Page::Response => "response",
|
81
|
+
Events::Page::RequestFinished => "requestFinished",
|
82
|
+
Events::Page::RequestFailed => "requestFailed",
|
83
|
+
Events::Page::FileChooser => "fileChooser",
|
84
|
+
})
|
76
85
|
end
|
77
86
|
|
78
87
|
attr_reader \
|
@@ -169,30 +178,6 @@ module Playwright
|
|
169
178
|
video.send(:set_artifact, artifact)
|
170
179
|
end
|
171
180
|
|
172
|
-
# @override
|
173
|
-
def on(event, callback)
|
174
|
-
if event == Events::Page::FileChooser && listener_count(event) == 0
|
175
|
-
@channel.async_send_message_to_server('setFileChooserInterceptedNoReply', intercepted: true)
|
176
|
-
end
|
177
|
-
super
|
178
|
-
end
|
179
|
-
|
180
|
-
# @override
|
181
|
-
def once(event, callback)
|
182
|
-
if event == Events::Page::FileChooser && listener_count(event) == 0
|
183
|
-
@channel.async_send_message_to_server('setFileChooserInterceptedNoReply', intercepted: true)
|
184
|
-
end
|
185
|
-
super
|
186
|
-
end
|
187
|
-
|
188
|
-
# @override
|
189
|
-
def off(event, callback)
|
190
|
-
super
|
191
|
-
if event == Events::Page::FileChooser && listener_count(event) == 0
|
192
|
-
@channel.async_send_message_to_server('setFileChooserInterceptedNoReply', intercepted: false)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
181
|
def context
|
197
182
|
@browser_context
|
198
183
|
end
|
@@ -366,16 +351,24 @@ module Playwright
|
|
366
351
|
|
367
352
|
def emulate_media(colorScheme: nil, forcedColors: nil, media: nil, reducedMotion: nil)
|
368
353
|
params = {
|
369
|
-
colorScheme: colorScheme,
|
370
|
-
forcedColors: forcedColors,
|
371
|
-
media: media,
|
372
|
-
reducedMotion: reducedMotion,
|
354
|
+
colorScheme: no_override_if_null(colorScheme),
|
355
|
+
forcedColors: no_override_if_null(forcedColors),
|
356
|
+
media: no_override_if_null(media),
|
357
|
+
reducedMotion: no_override_if_null(reducedMotion),
|
373
358
|
}.compact
|
374
359
|
@channel.send_message_to_server('emulateMedia', params)
|
375
360
|
|
376
361
|
nil
|
377
362
|
end
|
378
363
|
|
364
|
+
private def no_override_if_null(target)
|
365
|
+
if target == 'null'
|
366
|
+
'no-override'
|
367
|
+
else
|
368
|
+
target
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
379
372
|
def set_viewport_size(viewportSize)
|
380
373
|
@viewport_size = viewportSize
|
381
374
|
@channel.send_message_to_server('setViewportSize', { viewportSize: viewportSize })
|
@@ -637,6 +630,7 @@ module Playwright
|
|
637
630
|
selector,
|
638
631
|
force: nil,
|
639
632
|
modifiers: nil,
|
633
|
+
noWaitAfter: nil,
|
640
634
|
position: nil,
|
641
635
|
strict: nil,
|
642
636
|
timeout: nil,
|
@@ -645,6 +639,7 @@ module Playwright
|
|
645
639
|
selector,
|
646
640
|
force: force,
|
647
641
|
modifiers: modifiers,
|
642
|
+
noWaitAfter: noWaitAfter,
|
648
643
|
position: position,
|
649
644
|
strict: strict,
|
650
645
|
timeout: timeout,
|
@@ -43,7 +43,10 @@ module Playwright
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def initialize_playwright
|
46
|
-
|
46
|
+
# Avoid Error: sdkLanguage: expected one of (javascript|python|java|csharp)
|
47
|
+
# ref: https://github.com/microsoft/playwright/pull/18308
|
48
|
+
# ref: https://github.com/YusukeIwaki/playwright-ruby-client/issues/228
|
49
|
+
result = send_message_to_server('', 'initialize', { sdkLanguage: 'python' })
|
47
50
|
ChannelOwners::Playwright.from(result['playwright'])
|
48
51
|
end
|
49
52
|
|
@@ -11,8 +11,7 @@ module Playwright
|
|
11
11
|
selector_scopes = [selector]
|
12
12
|
|
13
13
|
if hasText
|
14
|
-
|
15
|
-
selector_scopes << "internal:has=#{text_selector.to_json}"
|
14
|
+
selector_scopes << "internal:has-text=#{escape_for_text_selector(hasText, false)}"
|
16
15
|
end
|
17
16
|
|
18
17
|
if has
|
@@ -187,6 +186,10 @@ module Playwright
|
|
187
186
|
@frame.fill(@selector, value, strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
|
188
187
|
end
|
189
188
|
|
189
|
+
def clear(force: nil, noWaitAfter: nil, timeout: nil)
|
190
|
+
@frame.fill(@selector, '', strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
|
191
|
+
end
|
192
|
+
|
190
193
|
def locator(selector, hasText: nil, has: nil)
|
191
194
|
LocatorImpl.new(
|
192
195
|
frame: @frame,
|
@@ -251,6 +254,15 @@ module Playwright
|
|
251
254
|
@frame.focus(@selector, strict: true, timeout: timeout)
|
252
255
|
end
|
253
256
|
|
257
|
+
def blur(timeout: nil)
|
258
|
+
params = {
|
259
|
+
selector: @selector,
|
260
|
+
strict: true,
|
261
|
+
timeout: timeout,
|
262
|
+
}.compact
|
263
|
+
@frame.channel.send_message_to_server('blur', params)
|
264
|
+
end
|
265
|
+
|
254
266
|
def count
|
255
267
|
@frame.eval_on_selector_all(@selector, 'ee => ee.length')
|
256
268
|
end
|
@@ -262,6 +274,7 @@ module Playwright
|
|
262
274
|
def hover(
|
263
275
|
force: nil,
|
264
276
|
modifiers: nil,
|
277
|
+
noWaitAfter: nil,
|
265
278
|
position: nil,
|
266
279
|
timeout: nil,
|
267
280
|
trial: nil)
|
@@ -269,6 +282,7 @@ module Playwright
|
|
269
282
|
strict: true,
|
270
283
|
force: force,
|
271
284
|
modifiers: modifiers,
|
285
|
+
noWaitAfter: noWaitAfter,
|
272
286
|
position: position,
|
273
287
|
timeout: timeout,
|
274
288
|
trial: trial)
|
@@ -1,7 +1,10 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Playwright
|
2
4
|
module LocatorUtils
|
3
5
|
def get_by_test_id(test_id)
|
4
|
-
|
6
|
+
test_id_attribute_name = ::Playwright::LocatorUtils.instance_variable_get(:@test_id_attribute_name)
|
7
|
+
locator(get_by_test_id_selector(test_id_attribute_name, test_id))
|
5
8
|
end
|
6
9
|
|
7
10
|
def get_by_alt_text(text, exact: false)
|
@@ -35,11 +38,8 @@ module Playwright
|
|
35
38
|
"internal:attr=[#{attr_name}=#{escape_for_attribute_selector_or_regex(text, exact)}]"
|
36
39
|
end
|
37
40
|
|
38
|
-
private def get_by_test_id_selector(test_id)
|
39
|
-
|
40
|
-
::Playwright::LocatorUtils.instance_variable_get(:@test_id_attribute_name),
|
41
|
-
test_id,
|
42
|
-
exact: true)
|
41
|
+
private def get_by_test_id_selector(test_id_attribute_name, test_id)
|
42
|
+
"internal:testid=[#{test_id_attribute_name}=#{escape_for_attribute_selector(test_id, true)}]"
|
43
43
|
end
|
44
44
|
|
45
45
|
private def get_by_label_selector(text, exact:)
|
@@ -59,7 +59,7 @@ module Playwright
|
|
59
59
|
end
|
60
60
|
|
61
61
|
private def get_by_text_selector(text, exact:)
|
62
|
-
"text=#{escape_for_text_selector(text, exact)}"
|
62
|
+
"internal:text=#{escape_for_text_selector(text, exact)}"
|
63
63
|
end
|
64
64
|
|
65
65
|
private def get_by_role_selector(role, **options)
|
@@ -67,7 +67,7 @@ module Playwright
|
|
67
67
|
|
68
68
|
ex = {
|
69
69
|
includeHidden: -> (value) { ['include-hidden', value.to_s] },
|
70
|
-
name: -> (value) { ['name', escape_for_attribute_selector_or_regex(value,
|
70
|
+
name: -> (value) { ['name', escape_for_attribute_selector_or_regex(value, options[:exact])]},
|
71
71
|
}
|
72
72
|
|
73
73
|
%i[
|
@@ -82,12 +82,12 @@ module Playwright
|
|
82
82
|
].each do |attr_name|
|
83
83
|
if options.key?(attr_name)
|
84
84
|
attr_value = options[attr_name]
|
85
|
-
props << ex[attr_name]&.call(attr_value) || [attr_name, attr_value.to_s]
|
85
|
+
props << (ex[attr_name]&.call(attr_value) || [attr_name, attr_value.to_s])
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
opts = props.map { |k, v| "[#{k}=#{v}]"}.join('')
|
90
|
-
"role=#{role}#{opts}"
|
90
|
+
"internal:role=#{role}#{opts}"
|
91
91
|
end
|
92
92
|
|
93
93
|
# @param text [String]
|
@@ -103,16 +103,10 @@ module Playwright
|
|
103
103
|
end
|
104
104
|
|
105
105
|
if exact
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
if text.include?('"') || text.include?('>>') || text.start_with?('/')
|
111
|
-
_text = escape_for_regex(text).gsub(/\s+/, '\\s+')
|
112
|
-
return "/#{_text}/i"
|
106
|
+
"#{text.to_json}s"
|
107
|
+
else
|
108
|
+
"#{text.to_json}i"
|
113
109
|
end
|
114
|
-
|
115
|
-
text
|
116
110
|
end
|
117
111
|
|
118
112
|
# @param text [Regexp|String]
|
data/lib/playwright/utils.rb
CHANGED
@@ -55,6 +55,12 @@ module Playwright
|
|
55
55
|
params[:storageState] = JSON.parse(File.read(params[:storageState]))
|
56
56
|
end
|
57
57
|
|
58
|
+
%i[colorScheme reducedMotion forcedColors].each do |key|
|
59
|
+
if params[key] == 'null'
|
60
|
+
params[key] = 'no-override'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
58
64
|
params
|
59
65
|
end
|
60
66
|
end
|
data/lib/playwright/version.rb
CHANGED
@@ -25,6 +25,12 @@ module Playwright
|
|
25
25
|
# ```
|
26
26
|
class Android < PlaywrightApi
|
27
27
|
|
28
|
+
# This methods attaches Playwright to an existing Android device. Use [`method: Android.launchServer`] to launch a new
|
29
|
+
# Android server instance.
|
30
|
+
def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
|
31
|
+
raise NotImplementedError.new('connect is not implemented yet.')
|
32
|
+
end
|
33
|
+
|
28
34
|
# Returns the list of detected Android devices.
|
29
35
|
def devices(host: nil, omitDriverInstall: nil, port: nil)
|
30
36
|
wrap_impl(@impl.devices(host: unwrap_impl(host), omitDriverInstall: unwrap_impl(omitDriverInstall), port: unwrap_impl(port)))
|
@@ -36,12 +42,6 @@ module Playwright
|
|
36
42
|
end
|
37
43
|
alias_method :default_timeout=, :set_default_timeout
|
38
44
|
|
39
|
-
# -- inherited from EventEmitter --
|
40
|
-
# @nodoc
|
41
|
-
def off(event, callback)
|
42
|
-
event_emitter_proxy.off(event, callback)
|
43
|
-
end
|
44
|
-
|
45
45
|
# -- inherited from EventEmitter --
|
46
46
|
# @nodoc
|
47
47
|
def once(event, callback)
|
@@ -54,6 +54,12 @@ module Playwright
|
|
54
54
|
event_emitter_proxy.on(event, callback)
|
55
55
|
end
|
56
56
|
|
57
|
+
# -- inherited from EventEmitter --
|
58
|
+
# @nodoc
|
59
|
+
def off(event, callback)
|
60
|
+
event_emitter_proxy.off(event, callback)
|
61
|
+
end
|
62
|
+
|
57
63
|
private def event_emitter_proxy
|
58
64
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
59
65
|
end
|
@@ -173,12 +173,6 @@ module Playwright
|
|
173
173
|
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
174
174
|
end
|
175
175
|
|
176
|
-
# -- inherited from EventEmitter --
|
177
|
-
# @nodoc
|
178
|
-
def off(event, callback)
|
179
|
-
event_emitter_proxy.off(event, callback)
|
180
|
-
end
|
181
|
-
|
182
176
|
# -- inherited from EventEmitter --
|
183
177
|
# @nodoc
|
184
178
|
def once(event, callback)
|
@@ -191,6 +185,12 @@ module Playwright
|
|
191
185
|
event_emitter_proxy.on(event, callback)
|
192
186
|
end
|
193
187
|
|
188
|
+
# -- inherited from EventEmitter --
|
189
|
+
# @nodoc
|
190
|
+
def off(event, callback)
|
191
|
+
event_emitter_proxy.off(event, callback)
|
192
|
+
end
|
193
|
+
|
194
194
|
private def event_emitter_proxy
|
195
195
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
196
196
|
end
|
@@ -269,12 +269,6 @@ module Playwright
|
|
269
269
|
raise NotImplementedError.new('storage_state is not implemented yet.')
|
270
270
|
end
|
271
271
|
|
272
|
-
# -- inherited from EventEmitter --
|
273
|
-
# @nodoc
|
274
|
-
def off(event, callback)
|
275
|
-
event_emitter_proxy.off(event, callback)
|
276
|
-
end
|
277
|
-
|
278
272
|
# -- inherited from EventEmitter --
|
279
273
|
# @nodoc
|
280
274
|
def once(event, callback)
|
@@ -287,6 +281,12 @@ module Playwright
|
|
287
281
|
event_emitter_proxy.on(event, callback)
|
288
282
|
end
|
289
283
|
|
284
|
+
# -- inherited from EventEmitter --
|
285
|
+
# @nodoc
|
286
|
+
def off(event, callback)
|
287
|
+
event_emitter_proxy.off(event, callback)
|
288
|
+
end
|
289
|
+
|
290
290
|
private def event_emitter_proxy
|
291
291
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
292
292
|
end
|
@@ -192,12 +192,6 @@ module Playwright
|
|
192
192
|
wrap_impl(@impl.version)
|
193
193
|
end
|
194
194
|
|
195
|
-
# -- inherited from EventEmitter --
|
196
|
-
# @nodoc
|
197
|
-
def off(event, callback)
|
198
|
-
event_emitter_proxy.off(event, callback)
|
199
|
-
end
|
200
|
-
|
201
195
|
# -- inherited from EventEmitter --
|
202
196
|
# @nodoc
|
203
197
|
def once(event, callback)
|
@@ -210,6 +204,12 @@ module Playwright
|
|
210
204
|
event_emitter_proxy.on(event, callback)
|
211
205
|
end
|
212
206
|
|
207
|
+
# -- inherited from EventEmitter --
|
208
|
+
# @nodoc
|
209
|
+
def off(event, callback)
|
210
|
+
event_emitter_proxy.off(event, callback)
|
211
|
+
end
|
212
|
+
|
213
213
|
private def event_emitter_proxy
|
214
214
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
215
215
|
end
|
@@ -406,12 +406,6 @@ module Playwright
|
|
406
406
|
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
407
407
|
end
|
408
408
|
|
409
|
-
# -- inherited from EventEmitter --
|
410
|
-
# @nodoc
|
411
|
-
def off(event, callback)
|
412
|
-
event_emitter_proxy.off(event, callback)
|
413
|
-
end
|
414
|
-
|
415
409
|
# -- inherited from EventEmitter --
|
416
410
|
# @nodoc
|
417
411
|
def once(event, callback)
|
@@ -424,6 +418,12 @@ module Playwright
|
|
424
418
|
event_emitter_proxy.on(event, callback)
|
425
419
|
end
|
426
420
|
|
421
|
+
# -- inherited from EventEmitter --
|
422
|
+
# @nodoc
|
423
|
+
def off(event, callback)
|
424
|
+
event_emitter_proxy.off(event, callback)
|
425
|
+
end
|
426
|
+
|
427
427
|
private def event_emitter_proxy
|
428
428
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
429
429
|
end
|
@@ -158,12 +158,6 @@ module Playwright
|
|
158
158
|
wrap_impl(@impl.name)
|
159
159
|
end
|
160
160
|
|
161
|
-
# -- inherited from EventEmitter --
|
162
|
-
# @nodoc
|
163
|
-
def off(event, callback)
|
164
|
-
event_emitter_proxy.off(event, callback)
|
165
|
-
end
|
166
|
-
|
167
161
|
# -- inherited from EventEmitter --
|
168
162
|
# @nodoc
|
169
163
|
def once(event, callback)
|
@@ -176,6 +170,12 @@ module Playwright
|
|
176
170
|
event_emitter_proxy.on(event, callback)
|
177
171
|
end
|
178
172
|
|
173
|
+
# -- inherited from EventEmitter --
|
174
|
+
# @nodoc
|
175
|
+
def off(event, callback)
|
176
|
+
event_emitter_proxy.off(event, callback)
|
177
|
+
end
|
178
|
+
|
179
179
|
private def event_emitter_proxy
|
180
180
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
181
181
|
end
|
@@ -33,12 +33,6 @@ module Playwright
|
|
33
33
|
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
34
34
|
end
|
35
35
|
|
36
|
-
# -- inherited from EventEmitter --
|
37
|
-
# @nodoc
|
38
|
-
def off(event, callback)
|
39
|
-
event_emitter_proxy.off(event, callback)
|
40
|
-
end
|
41
|
-
|
42
36
|
# -- inherited from EventEmitter --
|
43
37
|
# @nodoc
|
44
38
|
def once(event, callback)
|
@@ -51,6 +45,12 @@ module Playwright
|
|
51
45
|
event_emitter_proxy.on(event, callback)
|
52
46
|
end
|
53
47
|
|
48
|
+
# -- inherited from EventEmitter --
|
49
|
+
# @nodoc
|
50
|
+
def off(event, callback)
|
51
|
+
event_emitter_proxy.off(event, callback)
|
52
|
+
end
|
53
|
+
|
54
54
|
private def event_emitter_proxy
|
55
55
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
56
56
|
end
|
@@ -42,12 +42,6 @@ module Playwright
|
|
42
42
|
wrap_impl(@impl.type)
|
43
43
|
end
|
44
44
|
|
45
|
-
# -- inherited from EventEmitter --
|
46
|
-
# @nodoc
|
47
|
-
def off(event, callback)
|
48
|
-
event_emitter_proxy.off(event, callback)
|
49
|
-
end
|
50
|
-
|
51
45
|
# -- inherited from EventEmitter --
|
52
46
|
# @nodoc
|
53
47
|
def once(event, callback)
|
@@ -60,6 +54,12 @@ module Playwright
|
|
60
54
|
event_emitter_proxy.on(event, callback)
|
61
55
|
end
|
62
56
|
|
57
|
+
# -- inherited from EventEmitter --
|
58
|
+
# @nodoc
|
59
|
+
def off(event, callback)
|
60
|
+
event_emitter_proxy.off(event, callback)
|
61
|
+
end
|
62
|
+
|
63
63
|
private def event_emitter_proxy
|
64
64
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
65
65
|
end
|
@@ -58,12 +58,6 @@ module Playwright
|
|
58
58
|
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
59
59
|
end
|
60
60
|
|
61
|
-
# -- inherited from EventEmitter --
|
62
|
-
# @nodoc
|
63
|
-
def off(event, callback)
|
64
|
-
event_emitter_proxy.off(event, callback)
|
65
|
-
end
|
66
|
-
|
67
61
|
# -- inherited from EventEmitter --
|
68
62
|
# @nodoc
|
69
63
|
def once(event, callback)
|
@@ -76,6 +70,12 @@ module Playwright
|
|
76
70
|
event_emitter_proxy.on(event, callback)
|
77
71
|
end
|
78
72
|
|
73
|
+
# -- inherited from EventEmitter --
|
74
|
+
# @nodoc
|
75
|
+
def off(event, callback)
|
76
|
+
event_emitter_proxy.off(event, callback)
|
77
|
+
end
|
78
|
+
|
79
79
|
private def event_emitter_proxy
|
80
80
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
81
81
|
end
|
@@ -251,10 +251,11 @@ module Playwright
|
|
251
251
|
def hover(
|
252
252
|
force: nil,
|
253
253
|
modifiers: nil,
|
254
|
+
noWaitAfter: nil,
|
254
255
|
position: nil,
|
255
256
|
timeout: nil,
|
256
257
|
trial: nil)
|
257
|
-
wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
258
|
+
wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
258
259
|
end
|
259
260
|
|
260
261
|
# Returns the `element.innerHTML`.
|
@@ -557,12 +558,6 @@ module Playwright
|
|
557
558
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
558
559
|
end
|
559
560
|
|
560
|
-
# -- inherited from EventEmitter --
|
561
|
-
# @nodoc
|
562
|
-
def off(event, callback)
|
563
|
-
event_emitter_proxy.off(event, callback)
|
564
|
-
end
|
565
|
-
|
566
561
|
# -- inherited from EventEmitter --
|
567
562
|
# @nodoc
|
568
563
|
def once(event, callback)
|
@@ -575,6 +570,12 @@ module Playwright
|
|
575
570
|
event_emitter_proxy.on(event, callback)
|
576
571
|
end
|
577
572
|
|
573
|
+
# -- inherited from EventEmitter --
|
574
|
+
# @nodoc
|
575
|
+
def off(event, callback)
|
576
|
+
event_emitter_proxy.off(event, callback)
|
577
|
+
end
|
578
|
+
|
578
579
|
private def event_emitter_proxy
|
579
580
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
580
581
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -357,7 +357,7 @@ module Playwright
|
|
357
357
|
end
|
358
358
|
|
359
359
|
# Allows locating input elements by the text of the associated label. For example, this method will find the input by
|
360
|
-
# label text Password in the following DOM:
|
360
|
+
# label text "Password" in the following DOM:
|
361
361
|
#
|
362
362
|
# ```html
|
363
363
|
# <label for="password-input">Password:</label>
|
@@ -390,13 +390,14 @@ module Playwright
|
|
390
390
|
role,
|
391
391
|
checked: nil,
|
392
392
|
disabled: nil,
|
393
|
+
exact: nil,
|
393
394
|
expanded: nil,
|
394
395
|
includeHidden: nil,
|
395
396
|
level: nil,
|
396
397
|
name: nil,
|
397
398
|
pressed: nil,
|
398
399
|
selected: nil)
|
399
|
-
wrap_impl(@impl.get_by_role(unwrap_impl(role), checked: unwrap_impl(checked), disabled: unwrap_impl(disabled), expanded: unwrap_impl(expanded), includeHidden: unwrap_impl(includeHidden), level: unwrap_impl(level), name: unwrap_impl(name), pressed: unwrap_impl(pressed), selected: unwrap_impl(selected)))
|
400
|
+
wrap_impl(@impl.get_by_role(unwrap_impl(role), checked: unwrap_impl(checked), disabled: unwrap_impl(disabled), exact: unwrap_impl(exact), expanded: unwrap_impl(expanded), includeHidden: unwrap_impl(includeHidden), level: unwrap_impl(level), name: unwrap_impl(name), pressed: unwrap_impl(pressed), selected: unwrap_impl(selected)))
|
400
401
|
end
|
401
402
|
|
402
403
|
# Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
|
@@ -405,12 +406,44 @@ module Playwright
|
|
405
406
|
wrap_impl(@impl.get_by_test_id(unwrap_impl(testId)))
|
406
407
|
end
|
407
408
|
|
408
|
-
# Allows locating elements that contain given text.
|
409
|
+
# Allows locating elements that contain given text. Consider the following DOM structure:
|
410
|
+
#
|
411
|
+
# ```html
|
412
|
+
# <div>Hello <span>world</span></div>
|
413
|
+
# <div>Hello</div>
|
414
|
+
# ```
|
415
|
+
#
|
416
|
+
# You can locate by text substring, exact string, or a regular expression:
|
417
|
+
#
|
418
|
+
# ```python sync
|
419
|
+
# # Matches <span>
|
420
|
+
# page.get_by_text("world")
|
421
|
+
#
|
422
|
+
# # Matches first <div>
|
423
|
+
# page.get_by_text("Hello world")
|
424
|
+
#
|
425
|
+
# # Matches second <div>
|
426
|
+
# page.get_by_text("Hello", exact=True)
|
427
|
+
#
|
428
|
+
# # Matches both <div>s
|
429
|
+
# page.get_by_text(re.compile("Hello"))
|
430
|
+
#
|
431
|
+
# # Matches second <div>
|
432
|
+
# page.get_by_text(re.compile("^hello$", re.IGNORECASE))
|
433
|
+
# ```
|
434
|
+
#
|
435
|
+
# See also [`method: Locator.filter`] that allows to match by another criteria, like an accessible role, and then filter
|
436
|
+
# by the text content.
|
437
|
+
#
|
438
|
+
# > NOTE: Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into
|
439
|
+
# one, turns line breaks into spaces and ignores leading and trailing whitespace.
|
440
|
+
# > NOTE: Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For
|
441
|
+
# example, locating by text `"Log in"` matches `<input type=button value="Log in">`.
|
409
442
|
def get_by_text(text, exact: nil)
|
410
443
|
wrap_impl(@impl.get_by_text(unwrap_impl(text), exact: unwrap_impl(exact)))
|
411
444
|
end
|
412
445
|
|
413
|
-
# Allows locating elements by their title. For example, this method will find the button by its title "
|
446
|
+
# Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
414
447
|
#
|
415
448
|
# ```html
|
416
449
|
# <button title='Place the order'>Order Now</button>
|
@@ -455,11 +488,12 @@ module Playwright
|
|
455
488
|
selector,
|
456
489
|
force: nil,
|
457
490
|
modifiers: nil,
|
491
|
+
noWaitAfter: nil,
|
458
492
|
position: nil,
|
459
493
|
strict: nil,
|
460
494
|
timeout: nil,
|
461
495
|
trial: nil)
|
462
|
-
wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
496
|
+
wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
463
497
|
end
|
464
498
|
|
465
499
|
# Returns `element.innerHTML`.
|
@@ -874,12 +908,6 @@ module Playwright
|
|
874
908
|
wrap_impl(@impl.highlight(unwrap_impl(selector)))
|
875
909
|
end
|
876
910
|
|
877
|
-
# -- inherited from EventEmitter --
|
878
|
-
# @nodoc
|
879
|
-
def off(event, callback)
|
880
|
-
event_emitter_proxy.off(event, callback)
|
881
|
-
end
|
882
|
-
|
883
911
|
# -- inherited from EventEmitter --
|
884
912
|
# @nodoc
|
885
913
|
def once(event, callback)
|
@@ -892,6 +920,12 @@ module Playwright
|
|
892
920
|
event_emitter_proxy.on(event, callback)
|
893
921
|
end
|
894
922
|
|
923
|
+
# -- inherited from EventEmitter --
|
924
|
+
# @nodoc
|
925
|
+
def off(event, callback)
|
926
|
+
event_emitter_proxy.off(event, callback)
|
927
|
+
end
|
928
|
+
|
895
929
|
private def event_emitter_proxy
|
896
930
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
897
931
|
end
|