playwright-ruby-client 1.27.0 → 1.28.1
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/android.rb +2 -2
- data/lib/playwright/channel_owners/android_device.rb +14 -55
- 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/channel_owners/playwright.rb +7 -0
- data/lib/playwright/connection.rb +4 -1
- data/lib/playwright/input_files.rb +3 -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/web_socket_transport.rb +1 -1
- data/lib/playwright.rb +55 -0
- data/lib/playwright_api/android.rb +12 -6
- data/lib/playwright_api/android_device.rb +10 -5
- 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
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
|
@@ -4,7 +4,7 @@ module Playwright
|
|
4
4
|
# [`method: Locator.frameLocator`] method.
|
5
5
|
#
|
6
6
|
# ```python sync
|
7
|
-
# locator = page.frame_locator("my-frame").
|
7
|
+
# locator = page.frame_locator("my-frame").get_by_text("Submit")
|
8
8
|
# locator.click()
|
9
9
|
# ```
|
10
10
|
#
|
@@ -27,7 +27,7 @@ module Playwright
|
|
27
27
|
# [`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) CSS selector:
|
28
28
|
#
|
29
29
|
# ```python sync
|
30
|
-
# frameLocator = locator.frame_locator(":scope")
|
30
|
+
# frameLocator = locator.frame_locator(":scope")
|
31
31
|
# ```
|
32
32
|
class FrameLocator < PlaywrightApi
|
33
33
|
|
@@ -52,7 +52,7 @@ module Playwright
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# Allows locating input elements by the text of the associated label. For example, this method will find the input by
|
55
|
-
# label text Password in the following DOM:
|
55
|
+
# label text "Password" in the following DOM:
|
56
56
|
#
|
57
57
|
# ```html
|
58
58
|
# <label for="password-input">Password:</label>
|
@@ -85,13 +85,14 @@ module Playwright
|
|
85
85
|
role,
|
86
86
|
checked: nil,
|
87
87
|
disabled: nil,
|
88
|
+
exact: nil,
|
88
89
|
expanded: nil,
|
89
90
|
includeHidden: nil,
|
90
91
|
level: nil,
|
91
92
|
name: nil,
|
92
93
|
pressed: nil,
|
93
94
|
selected: nil)
|
94
|
-
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)))
|
95
|
+
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)))
|
95
96
|
end
|
96
97
|
|
97
98
|
# Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
|
@@ -100,12 +101,44 @@ module Playwright
|
|
100
101
|
wrap_impl(@impl.get_by_test_id(unwrap_impl(testId)))
|
101
102
|
end
|
102
103
|
|
103
|
-
# Allows locating elements that contain given text.
|
104
|
+
# Allows locating elements that contain given text. Consider the following DOM structure:
|
105
|
+
#
|
106
|
+
# ```html
|
107
|
+
# <div>Hello <span>world</span></div>
|
108
|
+
# <div>Hello</div>
|
109
|
+
# ```
|
110
|
+
#
|
111
|
+
# You can locate by text substring, exact string, or a regular expression:
|
112
|
+
#
|
113
|
+
# ```python sync
|
114
|
+
# # Matches <span>
|
115
|
+
# page.get_by_text("world")
|
116
|
+
#
|
117
|
+
# # Matches first <div>
|
118
|
+
# page.get_by_text("Hello world")
|
119
|
+
#
|
120
|
+
# # Matches second <div>
|
121
|
+
# page.get_by_text("Hello", exact=True)
|
122
|
+
#
|
123
|
+
# # Matches both <div>s
|
124
|
+
# page.get_by_text(re.compile("Hello"))
|
125
|
+
#
|
126
|
+
# # Matches second <div>
|
127
|
+
# page.get_by_text(re.compile("^hello$", re.IGNORECASE))
|
128
|
+
# ```
|
129
|
+
#
|
130
|
+
# See also [`method: Locator.filter`] that allows to match by another criteria, like an accessible role, and then filter
|
131
|
+
# by the text content.
|
132
|
+
#
|
133
|
+
# > NOTE: Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into
|
134
|
+
# one, turns line breaks into spaces and ignores leading and trailing whitespace.
|
135
|
+
# > NOTE: Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For
|
136
|
+
# example, locating by text `"Log in"` matches `<input type=button value="Log in">`.
|
104
137
|
def get_by_text(text, exact: nil)
|
105
138
|
wrap_impl(@impl.get_by_text(unwrap_impl(text), exact: unwrap_impl(exact)))
|
106
139
|
end
|
107
140
|
|
108
|
-
# Allows locating elements by their title. For example, this method will find the button by its title "
|
141
|
+
# Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
109
142
|
#
|
110
143
|
# ```html
|
111
144
|
# <button title='Place the order'>Order Now</button>
|
@@ -59,7 +59,7 @@ module Playwright
|
|
59
59
|
# The method returns a map with **own property names** as keys and JSHandle instances for the property values.
|
60
60
|
#
|
61
61
|
# ```python sync
|
62
|
-
# handle = page.evaluate_handle("{window, document}")
|
62
|
+
# handle = page.evaluate_handle("({window, document})")
|
63
63
|
# properties = handle.get_properties()
|
64
64
|
# window_handle = properties.get("window")
|
65
65
|
# document_handle = properties.get("document")
|
@@ -88,12 +88,6 @@ module Playwright
|
|
88
88
|
wrap_impl(@impl.to_s)
|
89
89
|
end
|
90
90
|
|
91
|
-
# -- inherited from EventEmitter --
|
92
|
-
# @nodoc
|
93
|
-
def off(event, callback)
|
94
|
-
event_emitter_proxy.off(event, callback)
|
95
|
-
end
|
96
|
-
|
97
91
|
# -- inherited from EventEmitter --
|
98
92
|
# @nodoc
|
99
93
|
def once(event, callback)
|
@@ -106,6 +100,12 @@ module Playwright
|
|
106
100
|
event_emitter_proxy.on(event, callback)
|
107
101
|
end
|
108
102
|
|
103
|
+
# -- inherited from EventEmitter --
|
104
|
+
# @nodoc
|
105
|
+
def off(event, callback)
|
106
|
+
event_emitter_proxy.off(event, callback)
|
107
|
+
end
|
108
|
+
|
109
109
|
private def event_emitter_proxy
|
110
110
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
111
111
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Playwright
|
2
2
|
# Keyboard provides an api for managing a virtual keyboard. The high level api is [`method: Keyboard.type`], which takes
|
3
|
-
# raw characters and generates proper keydown
|
3
|
+
# raw characters and generates proper `keydown`, `keypress`/`input`, and `keyup` events on your page.
|
4
4
|
#
|
5
5
|
# For finer control, you can use [`method: Keyboard.down`], [`method: Keyboard.up`], and [`method: Keyboard.insertText`]
|
6
6
|
# to manually fire events as if they were generated from a real keyboard.
|
@@ -15,6 +15,11 @@ module Playwright
|
|
15
15
|
wrap_impl(@impl.all_text_contents)
|
16
16
|
end
|
17
17
|
|
18
|
+
# Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur) on the element.
|
19
|
+
def blur(timeout: nil)
|
20
|
+
wrap_impl(@impl.blur(timeout: unwrap_impl(timeout)))
|
21
|
+
end
|
22
|
+
|
18
23
|
# This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
|
19
24
|
# calculated relative to the main frame viewport - which is usually the same as the browser window.
|
20
25
|
#
|
@@ -58,6 +63,17 @@ module Playwright
|
|
58
63
|
wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
59
64
|
end
|
60
65
|
|
66
|
+
# This method waits for [actionability](../actionability.md) checks, focuses the element, clears it and triggers an
|
67
|
+
# `input` event after clearing.
|
68
|
+
#
|
69
|
+
# If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
|
70
|
+
# However, if the element is inside the `<label>` element that has an associated
|
71
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be cleared
|
72
|
+
# instead.
|
73
|
+
def clear(force: nil, noWaitAfter: nil, timeout: nil)
|
74
|
+
wrap_impl(@impl.clear(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
75
|
+
end
|
76
|
+
|
61
77
|
# This method clicks the element by performing the following steps:
|
62
78
|
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
63
79
|
# 1. Scroll the element into view if needed.
|
@@ -291,7 +307,7 @@ module Playwright
|
|
291
307
|
end
|
292
308
|
|
293
309
|
# Allows locating input elements by the text of the associated label. For example, this method will find the input by
|
294
|
-
# label text Password in the following DOM:
|
310
|
+
# label text "Password" in the following DOM:
|
295
311
|
#
|
296
312
|
# ```html
|
297
313
|
# <label for="password-input">Password:</label>
|
@@ -324,13 +340,14 @@ module Playwright
|
|
324
340
|
role,
|
325
341
|
checked: nil,
|
326
342
|
disabled: nil,
|
343
|
+
exact: nil,
|
327
344
|
expanded: nil,
|
328
345
|
includeHidden: nil,
|
329
346
|
level: nil,
|
330
347
|
name: nil,
|
331
348
|
pressed: nil,
|
332
349
|
selected: nil)
|
333
|
-
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)))
|
350
|
+
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)))
|
334
351
|
end
|
335
352
|
|
336
353
|
# Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
|
@@ -339,12 +356,44 @@ module Playwright
|
|
339
356
|
wrap_impl(@impl.get_by_test_id(unwrap_impl(testId)))
|
340
357
|
end
|
341
358
|
|
342
|
-
# Allows locating elements that contain given text.
|
359
|
+
# Allows locating elements that contain given text. Consider the following DOM structure:
|
360
|
+
#
|
361
|
+
# ```html
|
362
|
+
# <div>Hello <span>world</span></div>
|
363
|
+
# <div>Hello</div>
|
364
|
+
# ```
|
365
|
+
#
|
366
|
+
# You can locate by text substring, exact string, or a regular expression:
|
367
|
+
#
|
368
|
+
# ```python sync
|
369
|
+
# # Matches <span>
|
370
|
+
# page.get_by_text("world")
|
371
|
+
#
|
372
|
+
# # Matches first <div>
|
373
|
+
# page.get_by_text("Hello world")
|
374
|
+
#
|
375
|
+
# # Matches second <div>
|
376
|
+
# page.get_by_text("Hello", exact=True)
|
377
|
+
#
|
378
|
+
# # Matches both <div>s
|
379
|
+
# page.get_by_text(re.compile("Hello"))
|
380
|
+
#
|
381
|
+
# # Matches second <div>
|
382
|
+
# page.get_by_text(re.compile("^hello$", re.IGNORECASE))
|
383
|
+
# ```
|
384
|
+
#
|
385
|
+
# See also [`method: Locator.filter`] that allows to match by another criteria, like an accessible role, and then filter
|
386
|
+
# by the text content.
|
387
|
+
#
|
388
|
+
# > NOTE: Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into
|
389
|
+
# one, turns line breaks into spaces and ignores leading and trailing whitespace.
|
390
|
+
# > NOTE: Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For
|
391
|
+
# example, locating by text `"Log in"` matches `<input type=button value="Log in">`.
|
343
392
|
def get_by_text(text, exact: nil)
|
344
393
|
wrap_impl(@impl.get_by_text(unwrap_impl(text), exact: unwrap_impl(exact)))
|
345
394
|
end
|
346
395
|
|
347
|
-
# Allows locating elements by their title. For example, this method will find the button by its title "
|
396
|
+
# Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
348
397
|
#
|
349
398
|
# ```html
|
350
399
|
# <button title='Place the order'>Order Now</button>
|
@@ -372,10 +421,11 @@ module Playwright
|
|
372
421
|
def hover(
|
373
422
|
force: nil,
|
374
423
|
modifiers: nil,
|
424
|
+
noWaitAfter: nil,
|
375
425
|
position: nil,
|
376
426
|
timeout: nil,
|
377
427
|
trial: nil)
|
378
|
-
wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
428
|
+
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)))
|
379
429
|
end
|
380
430
|
|
381
431
|
# Returns the `element.innerHTML`.
|
data/lib/playwright_api/page.rb
CHANGED
@@ -593,7 +593,7 @@ module Playwright
|
|
593
593
|
end
|
594
594
|
|
595
595
|
# Allows locating input elements by the text of the associated label. For example, this method will find the input by
|
596
|
-
# label text Password in the following DOM:
|
596
|
+
# label text "Password" in the following DOM:
|
597
597
|
#
|
598
598
|
# ```html
|
599
599
|
# <label for="password-input">Password:</label>
|
@@ -626,13 +626,14 @@ module Playwright
|
|
626
626
|
role,
|
627
627
|
checked: nil,
|
628
628
|
disabled: nil,
|
629
|
+
exact: nil,
|
629
630
|
expanded: nil,
|
630
631
|
includeHidden: nil,
|
631
632
|
level: nil,
|
632
633
|
name: nil,
|
633
634
|
pressed: nil,
|
634
635
|
selected: nil)
|
635
|
-
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)))
|
636
|
+
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)))
|
636
637
|
end
|
637
638
|
|
638
639
|
# Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
|
@@ -641,12 +642,44 @@ module Playwright
|
|
641
642
|
wrap_impl(@impl.get_by_test_id(unwrap_impl(testId)))
|
642
643
|
end
|
643
644
|
|
644
|
-
# Allows locating elements that contain given text.
|
645
|
+
# Allows locating elements that contain given text. Consider the following DOM structure:
|
646
|
+
#
|
647
|
+
# ```html
|
648
|
+
# <div>Hello <span>world</span></div>
|
649
|
+
# <div>Hello</div>
|
650
|
+
# ```
|
651
|
+
#
|
652
|
+
# You can locate by text substring, exact string, or a regular expression:
|
653
|
+
#
|
654
|
+
# ```python sync
|
655
|
+
# # Matches <span>
|
656
|
+
# page.get_by_text("world")
|
657
|
+
#
|
658
|
+
# # Matches first <div>
|
659
|
+
# page.get_by_text("Hello world")
|
660
|
+
#
|
661
|
+
# # Matches second <div>
|
662
|
+
# page.get_by_text("Hello", exact=True)
|
663
|
+
#
|
664
|
+
# # Matches both <div>s
|
665
|
+
# page.get_by_text(re.compile("Hello"))
|
666
|
+
#
|
667
|
+
# # Matches second <div>
|
668
|
+
# page.get_by_text(re.compile("^hello$", re.IGNORECASE))
|
669
|
+
# ```
|
670
|
+
#
|
671
|
+
# See also [`method: Locator.filter`] that allows to match by another criteria, like an accessible role, and then filter
|
672
|
+
# by the text content.
|
673
|
+
#
|
674
|
+
# > NOTE: Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into
|
675
|
+
# one, turns line breaks into spaces and ignores leading and trailing whitespace.
|
676
|
+
# > NOTE: Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For
|
677
|
+
# example, locating by text `"Log in"` matches `<input type=button value="Log in">`.
|
645
678
|
def get_by_text(text, exact: nil)
|
646
679
|
wrap_impl(@impl.get_by_text(unwrap_impl(text), exact: unwrap_impl(exact)))
|
647
680
|
end
|
648
681
|
|
649
|
-
# Allows locating elements by their title. For example, this method will find the button by its title "
|
682
|
+
# Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
650
683
|
#
|
651
684
|
# ```html
|
652
685
|
# <button title='Place the order'>Order Now</button>
|
@@ -711,11 +744,12 @@ module Playwright
|
|
711
744
|
selector,
|
712
745
|
force: nil,
|
713
746
|
modifiers: nil,
|
747
|
+
noWaitAfter: nil,
|
714
748
|
position: nil,
|
715
749
|
strict: nil,
|
716
750
|
timeout: nil,
|
717
751
|
trial: nil)
|
718
|
-
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)))
|
752
|
+
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)))
|
719
753
|
end
|
720
754
|
|
721
755
|
# Returns `element.innerHTML`.
|
@@ -1520,12 +1554,6 @@ module Playwright
|
|
1520
1554
|
wrap_impl(@impl.stop_css_coverage)
|
1521
1555
|
end
|
1522
1556
|
|
1523
|
-
# -- inherited from EventEmitter --
|
1524
|
-
# @nodoc
|
1525
|
-
def off(event, callback)
|
1526
|
-
event_emitter_proxy.off(event, callback)
|
1527
|
-
end
|
1528
|
-
|
1529
1557
|
# -- inherited from EventEmitter --
|
1530
1558
|
# @nodoc
|
1531
1559
|
def once(event, callback)
|
@@ -1538,6 +1566,12 @@ module Playwright
|
|
1538
1566
|
event_emitter_proxy.on(event, callback)
|
1539
1567
|
end
|
1540
1568
|
|
1569
|
+
# -- inherited from EventEmitter --
|
1570
|
+
# @nodoc
|
1571
|
+
def off(event, callback)
|
1572
|
+
event_emitter_proxy.off(event, callback)
|
1573
|
+
end
|
1574
|
+
|
1541
1575
|
private def event_emitter_proxy
|
1542
1576
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1543
1577
|
end
|
@@ -96,12 +96,6 @@ module Playwright
|
|
96
96
|
wrap_impl(@impl.electron)
|
97
97
|
end
|
98
98
|
|
99
|
-
# -- inherited from EventEmitter --
|
100
|
-
# @nodoc
|
101
|
-
def off(event, callback)
|
102
|
-
event_emitter_proxy.off(event, callback)
|
103
|
-
end
|
104
|
-
|
105
99
|
# -- inherited from EventEmitter --
|
106
100
|
# @nodoc
|
107
101
|
def once(event, callback)
|
@@ -114,6 +108,12 @@ module Playwright
|
|
114
108
|
event_emitter_proxy.on(event, callback)
|
115
109
|
end
|
116
110
|
|
111
|
+
# -- inherited from EventEmitter --
|
112
|
+
# @nodoc
|
113
|
+
def off(event, callback)
|
114
|
+
event_emitter_proxy.off(event, callback)
|
115
|
+
end
|
116
|
+
|
117
117
|
private def event_emitter_proxy
|
118
118
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
119
119
|
end
|
@@ -10,7 +10,7 @@ module Playwright
|
|
10
10
|
# > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will
|
11
11
|
# complete with `'requestfinished'` event.
|
12
12
|
#
|
13
|
-
# If request gets a 'redirect' response, the request is successfully finished with the
|
13
|
+
# If request gets a 'redirect' response, the request is successfully finished with the `requestfinished` event, and a new
|
14
14
|
# request is issued to a redirected url.
|
15
15
|
class Request < PlaywrightApi
|
16
16
|
|
@@ -161,12 +161,6 @@ module Playwright
|
|
161
161
|
wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
|
162
162
|
end
|
163
163
|
|
164
|
-
# -- inherited from EventEmitter --
|
165
|
-
# @nodoc
|
166
|
-
def off(event, callback)
|
167
|
-
event_emitter_proxy.off(event, callback)
|
168
|
-
end
|
169
|
-
|
170
164
|
# -- inherited from EventEmitter --
|
171
165
|
# @nodoc
|
172
166
|
def once(event, callback)
|
@@ -179,6 +173,12 @@ module Playwright
|
|
179
173
|
event_emitter_proxy.on(event, callback)
|
180
174
|
end
|
181
175
|
|
176
|
+
# -- inherited from EventEmitter --
|
177
|
+
# @nodoc
|
178
|
+
def off(event, callback)
|
179
|
+
event_emitter_proxy.off(event, callback)
|
180
|
+
end
|
181
|
+
|
182
182
|
private def event_emitter_proxy
|
183
183
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
184
184
|
end
|
@@ -110,12 +110,6 @@ module Playwright
|
|
110
110
|
wrap_impl(@impl.from_service_worker?)
|
111
111
|
end
|
112
112
|
|
113
|
-
# -- inherited from EventEmitter --
|
114
|
-
# @nodoc
|
115
|
-
def off(event, callback)
|
116
|
-
event_emitter_proxy.off(event, callback)
|
117
|
-
end
|
118
|
-
|
119
113
|
# -- inherited from EventEmitter --
|
120
114
|
# @nodoc
|
121
115
|
def once(event, callback)
|
@@ -128,6 +122,12 @@ module Playwright
|
|
128
122
|
event_emitter_proxy.on(event, callback)
|
129
123
|
end
|
130
124
|
|
125
|
+
# -- inherited from EventEmitter --
|
126
|
+
# @nodoc
|
127
|
+
def off(event, callback)
|
128
|
+
event_emitter_proxy.off(event, callback)
|
129
|
+
end
|
130
|
+
|
131
131
|
private def event_emitter_proxy
|
132
132
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
133
133
|
end
|
data/lib/playwright_api/route.rb
CHANGED
@@ -118,12 +118,6 @@ module Playwright
|
|
118
118
|
wrap_impl(@impl.redirect_navigation_request(unwrap_impl(url)))
|
119
119
|
end
|
120
120
|
|
121
|
-
# -- inherited from EventEmitter --
|
122
|
-
# @nodoc
|
123
|
-
def off(event, callback)
|
124
|
-
event_emitter_proxy.off(event, callback)
|
125
|
-
end
|
126
|
-
|
127
121
|
# -- inherited from EventEmitter --
|
128
122
|
# @nodoc
|
129
123
|
def once(event, callback)
|
@@ -136,6 +130,12 @@ module Playwright
|
|
136
130
|
event_emitter_proxy.on(event, callback)
|
137
131
|
end
|
138
132
|
|
133
|
+
# -- inherited from EventEmitter --
|
134
|
+
# @nodoc
|
135
|
+
def off(event, callback)
|
136
|
+
event_emitter_proxy.off(event, callback)
|
137
|
+
end
|
138
|
+
|
139
139
|
private def event_emitter_proxy
|
140
140
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
141
141
|
end
|
@@ -54,12 +54,6 @@ module Playwright
|
|
54
54
|
wrap_impl(@impl.text_id_attribute=(unwrap_impl(attribute_name)))
|
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
|
-
|
63
57
|
# -- inherited from EventEmitter --
|
64
58
|
# @nodoc
|
65
59
|
def once(event, callback)
|
@@ -72,6 +66,12 @@ module Playwright
|
|
72
66
|
event_emitter_proxy.on(event, callback)
|
73
67
|
end
|
74
68
|
|
69
|
+
# -- inherited from EventEmitter --
|
70
|
+
# @nodoc
|
71
|
+
def off(event, callback)
|
72
|
+
event_emitter_proxy.off(event, callback)
|
73
|
+
end
|
74
|
+
|
75
75
|
private def event_emitter_proxy
|
76
76
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
77
77
|
end
|
@@ -64,12 +64,6 @@ module Playwright
|
|
64
64
|
wrap_impl(@impl.stop_chunk(path: unwrap_impl(path)))
|
65
65
|
end
|
66
66
|
|
67
|
-
# -- inherited from EventEmitter --
|
68
|
-
# @nodoc
|
69
|
-
def off(event, callback)
|
70
|
-
event_emitter_proxy.off(event, callback)
|
71
|
-
end
|
72
|
-
|
73
67
|
# -- inherited from EventEmitter --
|
74
68
|
# @nodoc
|
75
69
|
def once(event, callback)
|
@@ -82,6 +76,12 @@ module Playwright
|
|
82
76
|
event_emitter_proxy.on(event, callback)
|
83
77
|
end
|
84
78
|
|
79
|
+
# -- inherited from EventEmitter --
|
80
|
+
# @nodoc
|
81
|
+
def off(event, callback)
|
82
|
+
event_emitter_proxy.off(event, callback)
|
83
|
+
end
|
84
|
+
|
85
85
|
private def event_emitter_proxy
|
86
86
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
87
87
|
end
|
@@ -27,12 +27,6 @@ module Playwright
|
|
27
27
|
wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
28
28
|
end
|
29
29
|
|
30
|
-
# -- inherited from EventEmitter --
|
31
|
-
# @nodoc
|
32
|
-
def off(event, callback)
|
33
|
-
event_emitter_proxy.off(event, callback)
|
34
|
-
end
|
35
|
-
|
36
30
|
# -- inherited from EventEmitter --
|
37
31
|
# @nodoc
|
38
32
|
def once(event, callback)
|
@@ -45,6 +39,12 @@ module Playwright
|
|
45
39
|
event_emitter_proxy.on(event, callback)
|
46
40
|
end
|
47
41
|
|
42
|
+
# -- inherited from EventEmitter --
|
43
|
+
# @nodoc
|
44
|
+
def off(event, callback)
|
45
|
+
event_emitter_proxy.off(event, callback)
|
46
|
+
end
|
47
|
+
|
48
48
|
private def event_emitter_proxy
|
49
49
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
50
50
|
end
|