playwright-ruby-client 1.31.1 → 1.33.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/browser_context.md +7 -1
- data/documentation/docs/api/frame.md +10 -3
- data/documentation/docs/api/frame_locator.md +10 -3
- data/documentation/docs/api/locator.md +40 -4
- data/documentation/docs/api/page.md +17 -4
- data/documentation/docs/api/route.md +1 -0
- data/documentation/docs/api/tracing.md +1 -1
- data/documentation/docs/include/api_coverage.md +1 -0
- data/lib/playwright/channel.rb +1 -0
- data/lib/playwright/channel_owners/browser.rb +2 -8
- data/lib/playwright/channel_owners/browser_context.rb +12 -7
- data/lib/playwright/channel_owners/browser_type.rb +13 -6
- data/lib/playwright/channel_owners/frame.rb +14 -2
- data/lib/playwright/channel_owners/local_utils.rb +18 -6
- data/lib/playwright/channel_owners/page.rb +14 -4
- data/lib/playwright/channel_owners/request.rb +6 -1
- data/lib/playwright/channel_owners/route.rb +5 -2
- data/lib/playwright/channel_owners/tracing.rb +61 -15
- data/lib/playwright/connection.rb +23 -1
- data/lib/playwright/frame_locator_impl.rb +9 -3
- data/lib/playwright/locator_impl.rb +39 -10
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright.rb +1 -1
- data/lib/playwright_api/android_device.rb +4 -4
- data/lib/playwright_api/browser_context.rb +13 -7
- data/lib/playwright_api/frame.rb +15 -8
- data/lib/playwright_api/frame_locator.rb +11 -4
- data/lib/playwright_api/locator.rb +38 -6
- data/lib/playwright_api/page.rb +24 -11
- data/lib/playwright_api/request.rb +4 -4
- data/lib/playwright_api/route.rb +2 -1
- data/lib/playwright_api/tracing.rb +2 -2
- data/sig/playwright.rbs +10 -9
- metadata +3 -3
@@ -22,6 +22,7 @@ module Playwright
|
|
22
22
|
@callbacks = {} # Hash [ guid => Promise<ChannelOwner> ]
|
23
23
|
@root_object = RootChannelOwner.new(self)
|
24
24
|
@remote = false
|
25
|
+
@tracing_count = 0
|
25
26
|
end
|
26
27
|
|
27
28
|
attr_reader :local_utils
|
@@ -50,6 +51,14 @@ module Playwright
|
|
50
51
|
ChannelOwners::Playwright.from(result['playwright'])
|
51
52
|
end
|
52
53
|
|
54
|
+
def set_in_tracing(value)
|
55
|
+
if value
|
56
|
+
@tracing_count += 1
|
57
|
+
else
|
58
|
+
@tracing_count -= 1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
53
62
|
def async_send_message_to_server(guid, method, params, metadata: nil)
|
54
63
|
callback = Concurrent::Promises.resolvable_future
|
55
64
|
|
@@ -58,12 +67,21 @@ module Playwright
|
|
58
67
|
# @see https://github.com/YusukeIwaki/puppeteer-ruby/pull/34
|
59
68
|
@callbacks[id] = callback
|
60
69
|
|
70
|
+
_metadata = {}
|
71
|
+
if metadata
|
72
|
+
_metadata[:wallTime] = metadata[:wallTime]
|
73
|
+
_metadata[:apiName] = metadata[:apiName]
|
74
|
+
_metadata[:location] = metadata[:stack].first
|
75
|
+
_metadata[:internal] = !metadata[:apiName]
|
76
|
+
end
|
77
|
+
_metadata.compact!
|
78
|
+
|
61
79
|
message = {
|
62
80
|
id: id,
|
63
81
|
guid: guid,
|
64
82
|
method: method,
|
65
83
|
params: replace_channels_with_guids(params),
|
66
|
-
metadata:
|
84
|
+
metadata: _metadata,
|
67
85
|
}
|
68
86
|
|
69
87
|
begin
|
@@ -73,6 +91,10 @@ module Playwright
|
|
73
91
|
callback.reject(err)
|
74
92
|
raise unless err.is_a?(Transport::AlreadyDisconnectedError)
|
75
93
|
end
|
94
|
+
|
95
|
+
if @tracing_count > 0 && !metadata[:stack].empty? && guid != 'localUtils'
|
96
|
+
@local_utils.add_stack_to_tracing_no_reply(id, metadata[:stack])
|
97
|
+
end
|
76
98
|
end
|
77
99
|
|
78
100
|
callback
|
@@ -10,14 +10,20 @@ module Playwright
|
|
10
10
|
@frame_selector = frame_selector
|
11
11
|
end
|
12
12
|
|
13
|
-
def locator(
|
13
|
+
def locator(
|
14
|
+
selector,
|
15
|
+
has: nil,
|
16
|
+
hasNot: nil,
|
17
|
+
hasNotText: nil,
|
18
|
+
hasText: nil)
|
14
19
|
LocatorImpl.new(
|
15
20
|
frame: @frame,
|
16
21
|
timeout_settings: @timeout_settings,
|
17
22
|
selector: "#{@frame_selector} >> internal:control=enter-frame >> #{selector}",
|
18
|
-
hasText: hasText,
|
19
23
|
has: has,
|
20
|
-
|
24
|
+
hasNot: hasNot,
|
25
|
+
hasNotText: hasNotText,
|
26
|
+
hasText: hasText)
|
21
27
|
end
|
22
28
|
|
23
29
|
def frame_locator(selector)
|
@@ -5,7 +5,7 @@ module Playwright
|
|
5
5
|
define_api_implementation :LocatorImpl do
|
6
6
|
include LocatorUtils
|
7
7
|
|
8
|
-
def initialize(frame:, timeout_settings:, selector:,
|
8
|
+
def initialize(frame:, timeout_settings:, selector:, has: nil, hasNot: nil, hasNotText: nil, hasText: nil)
|
9
9
|
@frame = frame
|
10
10
|
@timeout_settings = timeout_settings
|
11
11
|
selector_scopes = [selector]
|
@@ -16,11 +16,22 @@ module Playwright
|
|
16
16
|
|
17
17
|
if has
|
18
18
|
unless same_frame?(has)
|
19
|
-
raise DifferentFrameError.new
|
19
|
+
raise DifferentFrameError.new('has')
|
20
20
|
end
|
21
21
|
selector_scopes << "internal:has=#{has.send(:selector_json)}"
|
22
22
|
end
|
23
23
|
|
24
|
+
if hasNotText
|
25
|
+
selector_scopes << "internal:has-not-text=#{escape_for_text_selector(hasNotText, false)}"
|
26
|
+
end
|
27
|
+
|
28
|
+
if hasNot
|
29
|
+
unless same_frame?(hasNot)
|
30
|
+
raise DifferentFrameError.new('hasNot')
|
31
|
+
end
|
32
|
+
selector_scopes << "internal:has-not=#{hasNot.send(:selector_json)}"
|
33
|
+
end
|
34
|
+
|
24
35
|
@selector = selector_scopes.join(' >> ')
|
25
36
|
end
|
26
37
|
|
@@ -36,8 +47,8 @@ module Playwright
|
|
36
47
|
end
|
37
48
|
|
38
49
|
class DifferentFrameError < StandardError
|
39
|
-
def initialize
|
40
|
-
super(
|
50
|
+
def initialize(method_name)
|
51
|
+
super("Inner \"#{method_name}\" locator must belong to the same frame.")
|
41
52
|
end
|
42
53
|
end
|
43
54
|
|
@@ -190,14 +201,20 @@ module Playwright
|
|
190
201
|
@frame.fill(@selector, '', strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
|
191
202
|
end
|
192
203
|
|
193
|
-
def locator(
|
204
|
+
def locator(
|
205
|
+
selector,
|
206
|
+
has: nil,
|
207
|
+
hasNot: nil,
|
208
|
+
hasNotText: nil,
|
209
|
+
hasText: nil)
|
194
210
|
LocatorImpl.new(
|
195
211
|
frame: @frame,
|
196
212
|
timeout_settings: @timeout_settings,
|
197
213
|
selector: "#{@selector} >> #{selector}",
|
198
|
-
hasText: hasText,
|
199
214
|
has: has,
|
200
|
-
|
215
|
+
hasNot: hasNot,
|
216
|
+
hasNotText: hasNotText,
|
217
|
+
hasText: hasText)
|
201
218
|
end
|
202
219
|
|
203
220
|
def frame_locator(selector)
|
@@ -216,14 +233,15 @@ module Playwright
|
|
216
233
|
@frame.query_selector_all(@selector)
|
217
234
|
end
|
218
235
|
|
219
|
-
def filter(has: nil, hasText: nil)
|
236
|
+
def filter(has: nil, hasNot: nil, hasNotText: nil, hasText: nil)
|
220
237
|
LocatorImpl.new(
|
221
238
|
frame: @frame,
|
222
239
|
timeout_settings: @timeout_settings,
|
223
240
|
selector: @selector,
|
224
|
-
hasText: hasText,
|
225
241
|
has: has,
|
226
|
-
|
242
|
+
hasNot: hasNot,
|
243
|
+
hasNotText: hasNotText,
|
244
|
+
hasText: hasText)
|
227
245
|
end
|
228
246
|
|
229
247
|
def first
|
@@ -250,6 +268,17 @@ module Playwright
|
|
250
268
|
)
|
251
269
|
end
|
252
270
|
|
271
|
+
def or(locator)
|
272
|
+
unless same_frame?(locator)
|
273
|
+
raise DifferentFrameError.new('locator')
|
274
|
+
end
|
275
|
+
LocatorImpl.new(
|
276
|
+
frame: @frame,
|
277
|
+
timeout_settings: @timeout_settings,
|
278
|
+
selector: "#{@selector} >> internal:or=#{locator.send(:selector_json)}",
|
279
|
+
)
|
280
|
+
end
|
281
|
+
|
253
282
|
def focus(timeout: nil)
|
254
283
|
@frame.focus(@selector, strict: true, timeout: timeout)
|
255
284
|
end
|
data/lib/playwright/version.rb
CHANGED
data/lib/playwright.rb
CHANGED
@@ -159,8 +159,8 @@ module Playwright
|
|
159
159
|
begin
|
160
160
|
playwright = connection.initialize_playwright
|
161
161
|
browser = playwright.send(:pre_launched_browser)
|
162
|
+
browser.browser_type.send(:did_launch_browser, browser)
|
162
163
|
browser.should_close_connection_on_close!
|
163
|
-
browser.send(:update_browser_type, browser.browser_type)
|
164
164
|
Execution.new(connection, PlaywrightApi.wrap(playwright), PlaywrightApi.wrap(browser))
|
165
165
|
rescue
|
166
166
|
connection.stop
|
@@ -194,13 +194,13 @@ module Playwright
|
|
194
194
|
end
|
195
195
|
|
196
196
|
# @nodoc
|
197
|
-
def
|
198
|
-
wrap_impl(@impl.
|
197
|
+
def tap_on(selector, duration: nil, timeout: nil)
|
198
|
+
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
199
199
|
end
|
200
200
|
|
201
201
|
# @nodoc
|
202
|
-
def
|
203
|
-
wrap_impl(@impl.
|
202
|
+
def should_close_connection_on_close!
|
203
|
+
wrap_impl(@impl.should_close_connection_on_close!)
|
204
204
|
end
|
205
205
|
|
206
206
|
# -- inherited from EventEmitter --
|
@@ -302,8 +302,14 @@ module Playwright
|
|
302
302
|
# If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har).
|
303
303
|
#
|
304
304
|
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
|
305
|
-
def route_from_har(
|
306
|
-
|
305
|
+
def route_from_har(
|
306
|
+
har,
|
307
|
+
notFound: nil,
|
308
|
+
update: nil,
|
309
|
+
updateContent: nil,
|
310
|
+
updateMode: nil,
|
311
|
+
url: nil)
|
312
|
+
wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), updateContent: unwrap_impl(updateContent), updateMode: unwrap_impl(updateMode), url: unwrap_impl(url)))
|
307
313
|
end
|
308
314
|
|
309
315
|
#
|
@@ -428,11 +434,6 @@ module Playwright
|
|
428
434
|
wrap_impl(@impl.options=(unwrap_impl(req)))
|
429
435
|
end
|
430
436
|
|
431
|
-
# @nodoc
|
432
|
-
def browser=(req)
|
433
|
-
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
434
|
-
end
|
435
|
-
|
436
437
|
# @nodoc
|
437
438
|
def owner_page=(req)
|
438
439
|
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
@@ -443,6 +444,11 @@ module Playwright
|
|
443
444
|
wrap_impl(@impl.enable_debug_console!)
|
444
445
|
end
|
445
446
|
|
447
|
+
# @nodoc
|
448
|
+
def browser=(req)
|
449
|
+
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
450
|
+
end
|
451
|
+
|
446
452
|
# -- inherited from EventEmitter --
|
447
453
|
# @nodoc
|
448
454
|
def off(event, callback)
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -378,18 +378,20 @@ module Playwright
|
|
378
378
|
end
|
379
379
|
|
380
380
|
#
|
381
|
-
# Allows locating input elements by the text of the associated label.
|
381
|
+
# Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
|
382
382
|
#
|
383
383
|
# **Usage**
|
384
384
|
#
|
385
|
-
# For example, this method will find
|
385
|
+
# For example, this method will find inputs by label "Username" and "Password" in the following DOM:
|
386
386
|
#
|
387
387
|
# ```html
|
388
|
+
# <input aria-label="Username">
|
388
389
|
# <label for="password-input">Password:</label>
|
389
390
|
# <input id="password-input">
|
390
391
|
# ```
|
391
392
|
#
|
392
393
|
# ```python sync
|
394
|
+
# page.get_by_label("Username").fill("john")
|
393
395
|
# page.get_by_label("Password").fill("secret")
|
394
396
|
# ```
|
395
397
|
def get_by_label(text, exact: nil)
|
@@ -662,8 +664,13 @@ module Playwright
|
|
662
664
|
# [Learn more about locators](../locators.md).
|
663
665
|
#
|
664
666
|
# [Learn more about locators](../locators.md).
|
665
|
-
def locator(
|
666
|
-
|
667
|
+
def locator(
|
668
|
+
selector,
|
669
|
+
has: nil,
|
670
|
+
hasNot: nil,
|
671
|
+
hasNotText: nil,
|
672
|
+
hasText: nil)
|
673
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
|
667
674
|
end
|
668
675
|
|
669
676
|
#
|
@@ -1031,13 +1038,13 @@ module Playwright
|
|
1031
1038
|
end
|
1032
1039
|
|
1033
1040
|
# @nodoc
|
1034
|
-
def
|
1035
|
-
wrap_impl(@impl.
|
1041
|
+
def highlight(selector)
|
1042
|
+
wrap_impl(@impl.highlight(unwrap_impl(selector)))
|
1036
1043
|
end
|
1037
1044
|
|
1038
1045
|
# @nodoc
|
1039
|
-
def
|
1040
|
-
wrap_impl(@impl.
|
1046
|
+
def detached=(req)
|
1047
|
+
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
1041
1048
|
end
|
1042
1049
|
|
1043
1050
|
# -- inherited from EventEmitter --
|
@@ -60,18 +60,20 @@ module Playwright
|
|
60
60
|
end
|
61
61
|
|
62
62
|
#
|
63
|
-
# Allows locating input elements by the text of the associated label.
|
63
|
+
# Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
|
64
64
|
#
|
65
65
|
# **Usage**
|
66
66
|
#
|
67
|
-
# For example, this method will find
|
67
|
+
# For example, this method will find inputs by label "Username" and "Password" in the following DOM:
|
68
68
|
#
|
69
69
|
# ```html
|
70
|
+
# <input aria-label="Username">
|
70
71
|
# <label for="password-input">Password:</label>
|
71
72
|
# <input id="password-input">
|
72
73
|
# ```
|
73
74
|
#
|
74
75
|
# ```python sync
|
76
|
+
# page.get_by_label("Username").fill("john")
|
75
77
|
# page.get_by_label("Password").fill("secret")
|
76
78
|
# ```
|
77
79
|
def get_by_label(text, exact: nil)
|
@@ -239,8 +241,13 @@ module Playwright
|
|
239
241
|
# The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options, similar to [`method: Locator.filter`] method.
|
240
242
|
#
|
241
243
|
# [Learn more about locators](../locators.md).
|
242
|
-
def locator(
|
243
|
-
|
244
|
+
def locator(
|
245
|
+
selectorOrLocator,
|
246
|
+
has: nil,
|
247
|
+
hasNot: nil,
|
248
|
+
hasNotText: nil,
|
249
|
+
hasText: nil)
|
250
|
+
wrap_impl(@impl.locator(unwrap_impl(selectorOrLocator), has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
|
244
251
|
end
|
245
252
|
|
246
253
|
#
|
@@ -10,6 +10,12 @@ module Playwright
|
|
10
10
|
# When locator points to a list of elements, returns array of locators, pointing
|
11
11
|
# to respective elements.
|
12
12
|
#
|
13
|
+
# **NOTE**: [`method: Locator.all`] does not wait for elements to match the locator, and instead immediately returns whatever is present in the page.
|
14
|
+
#
|
15
|
+
# When the list of elements changes dynamically, [`method: Locator.all`] will produce unpredictable and flaky results.
|
16
|
+
#
|
17
|
+
# When the list of elements is stable, but loaded dynamically, wait for the full list to finish loading before calling [`method: Locator.all`].
|
18
|
+
#
|
13
19
|
# **Usage**
|
14
20
|
#
|
15
21
|
# ```python sync
|
@@ -391,8 +397,8 @@ module Playwright
|
|
391
397
|
# .filter(has=page.get_by_role("button", name="column 2 button"))
|
392
398
|
# .screenshot()
|
393
399
|
# ```
|
394
|
-
def filter(has: nil, hasText: nil)
|
395
|
-
wrap_impl(@impl.filter(has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
400
|
+
def filter(has: nil, hasNot: nil, hasNotText: nil, hasText: nil)
|
401
|
+
wrap_impl(@impl.filter(has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
|
396
402
|
end
|
397
403
|
|
398
404
|
#
|
@@ -447,18 +453,20 @@ module Playwright
|
|
447
453
|
end
|
448
454
|
|
449
455
|
#
|
450
|
-
# Allows locating input elements by the text of the associated label.
|
456
|
+
# Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
|
451
457
|
#
|
452
458
|
# **Usage**
|
453
459
|
#
|
454
|
-
# For example, this method will find
|
460
|
+
# For example, this method will find inputs by label "Username" and "Password" in the following DOM:
|
455
461
|
#
|
456
462
|
# ```html
|
463
|
+
# <input aria-label="Username">
|
457
464
|
# <label for="password-input">Password:</label>
|
458
465
|
# <input id="password-input">
|
459
466
|
# ```
|
460
467
|
#
|
461
468
|
# ```python sync
|
469
|
+
# page.get_by_label("Username").fill("john")
|
462
470
|
# page.get_by_label("Password").fill("secret")
|
463
471
|
# ```
|
464
472
|
def get_by_label(text, exact: nil)
|
@@ -769,8 +777,13 @@ module Playwright
|
|
769
777
|
# The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options, similar to [`method: Locator.filter`] method.
|
770
778
|
#
|
771
779
|
# [Learn more about locators](../locators.md).
|
772
|
-
def locator(
|
773
|
-
|
780
|
+
def locator(
|
781
|
+
selectorOrLocator,
|
782
|
+
has: nil,
|
783
|
+
hasNot: nil,
|
784
|
+
hasNotText: nil,
|
785
|
+
hasText: nil)
|
786
|
+
wrap_impl(@impl.locator(unwrap_impl(selectorOrLocator), has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
|
774
787
|
end
|
775
788
|
|
776
789
|
#
|
@@ -785,6 +798,25 @@ module Playwright
|
|
785
798
|
wrap_impl(@impl.nth(unwrap_impl(index)))
|
786
799
|
end
|
787
800
|
|
801
|
+
#
|
802
|
+
# Creates a locator that matches either of the two locators.
|
803
|
+
#
|
804
|
+
# **Usage**
|
805
|
+
#
|
806
|
+
# Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
|
807
|
+
#
|
808
|
+
# ```python sync
|
809
|
+
# new_email = page.get_by_role("button", name="New")
|
810
|
+
# dialog = page.get_by_text("Confirm security settings")
|
811
|
+
# expect(new_email.or_(dialog)).to_be_visible()
|
812
|
+
# if (dialog.is_visible())
|
813
|
+
# page.get_by_role("button", name="Dismiss").click()
|
814
|
+
# new_email.click()
|
815
|
+
# ```
|
816
|
+
def or(locator)
|
817
|
+
wrap_impl(@impl.or(unwrap_impl(locator)))
|
818
|
+
end
|
819
|
+
|
788
820
|
#
|
789
821
|
# A page this locator belongs to.
|
790
822
|
def page
|
data/lib/playwright_api/page.rb
CHANGED
@@ -614,18 +614,20 @@ module Playwright
|
|
614
614
|
end
|
615
615
|
|
616
616
|
#
|
617
|
-
# Allows locating input elements by the text of the associated label.
|
617
|
+
# Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
|
618
618
|
#
|
619
619
|
# **Usage**
|
620
620
|
#
|
621
|
-
# For example, this method will find
|
621
|
+
# For example, this method will find inputs by label "Username" and "Password" in the following DOM:
|
622
622
|
#
|
623
623
|
# ```html
|
624
|
+
# <input aria-label="Username">
|
624
625
|
# <label for="password-input">Password:</label>
|
625
626
|
# <input id="password-input">
|
626
627
|
# ```
|
627
628
|
#
|
628
629
|
# ```python sync
|
630
|
+
# page.get_by_label("Username").fill("john")
|
629
631
|
# page.get_by_label("Password").fill("secret")
|
630
632
|
# ```
|
631
633
|
def get_by_label(text, exact: nil)
|
@@ -914,8 +916,13 @@ module Playwright
|
|
914
916
|
# Locator is resolved to the element immediately before performing an action, so a series of actions on the same locator can in fact be performed on different DOM elements. That would happen if the DOM structure between those actions has changed.
|
915
917
|
#
|
916
918
|
# [Learn more about locators](../locators.md).
|
917
|
-
def locator(
|
918
|
-
|
919
|
+
def locator(
|
920
|
+
selector,
|
921
|
+
has: nil,
|
922
|
+
hasNot: nil,
|
923
|
+
hasNotText: nil,
|
924
|
+
hasText: nil)
|
925
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
|
919
926
|
end
|
920
927
|
|
921
928
|
#
|
@@ -1129,8 +1136,14 @@ module Playwright
|
|
1129
1136
|
# If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har).
|
1130
1137
|
#
|
1131
1138
|
# Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
|
1132
|
-
def route_from_har(
|
1133
|
-
|
1139
|
+
def route_from_har(
|
1140
|
+
har,
|
1141
|
+
notFound: nil,
|
1142
|
+
update: nil,
|
1143
|
+
updateContent: nil,
|
1144
|
+
updateMode: nil,
|
1145
|
+
url: nil)
|
1146
|
+
wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), updateContent: unwrap_impl(updateContent), updateMode: unwrap_impl(updateMode), url: unwrap_impl(url)))
|
1134
1147
|
end
|
1135
1148
|
|
1136
1149
|
#
|
@@ -1659,6 +1672,11 @@ module Playwright
|
|
1659
1672
|
raise NotImplementedError.new('wait_for_event is not implemented yet.')
|
1660
1673
|
end
|
1661
1674
|
|
1675
|
+
# @nodoc
|
1676
|
+
def stop_css_coverage
|
1677
|
+
wrap_impl(@impl.stop_css_coverage)
|
1678
|
+
end
|
1679
|
+
|
1662
1680
|
# @nodoc
|
1663
1681
|
def owned_context=(req)
|
1664
1682
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
@@ -1684,11 +1702,6 @@ module Playwright
|
|
1684
1702
|
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1685
1703
|
end
|
1686
1704
|
|
1687
|
-
# @nodoc
|
1688
|
-
def stop_css_coverage
|
1689
|
-
wrap_impl(@impl.stop_css_coverage)
|
1690
|
-
end
|
1691
|
-
|
1692
1705
|
# -- inherited from EventEmitter --
|
1693
1706
|
# @nodoc
|
1694
1707
|
def off(event, callback)
|
@@ -179,13 +179,13 @@ module Playwright
|
|
179
179
|
end
|
180
180
|
|
181
181
|
# @nodoc
|
182
|
-
def
|
183
|
-
wrap_impl(@impl.
|
182
|
+
def apply_fallback_overrides(overrides)
|
183
|
+
wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
|
184
184
|
end
|
185
185
|
|
186
186
|
# @nodoc
|
187
|
-
def
|
188
|
-
wrap_impl(@impl.
|
187
|
+
def header_values(name)
|
188
|
+
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
189
189
|
end
|
190
190
|
|
191
191
|
# -- inherited from EventEmitter --
|
data/lib/playwright_api/route.rb
CHANGED
@@ -119,8 +119,9 @@ module Playwright
|
|
119
119
|
maxRedirects: nil,
|
120
120
|
method: nil,
|
121
121
|
postData: nil,
|
122
|
+
timeout: nil,
|
122
123
|
url: nil)
|
123
|
-
wrap_impl(@impl.fetch(headers: unwrap_impl(headers), maxRedirects: unwrap_impl(maxRedirects), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
|
124
|
+
wrap_impl(@impl.fetch(headers: unwrap_impl(headers), maxRedirects: unwrap_impl(maxRedirects), method: unwrap_impl(method), postData: unwrap_impl(postData), timeout: unwrap_impl(timeout), url: unwrap_impl(url)))
|
124
125
|
end
|
125
126
|
|
126
127
|
#
|
@@ -54,8 +54,8 @@ module Playwright
|
|
54
54
|
# # Save a second trace file with different actions.
|
55
55
|
# context.tracing.stop_chunk(path = "trace2.zip")
|
56
56
|
# ```
|
57
|
-
def start_chunk(title: nil)
|
58
|
-
wrap_impl(@impl.start_chunk(title: unwrap_impl(title)))
|
57
|
+
def start_chunk(name: nil, title: nil)
|
58
|
+
wrap_impl(@impl.start_chunk(name: unwrap_impl(name), title: unwrap_impl(title)))
|
59
59
|
end
|
60
60
|
|
61
61
|
#
|
data/sig/playwright.rbs
CHANGED
@@ -47,7 +47,7 @@ module Playwright
|
|
47
47
|
def abort: (?errorCode: String) -> void
|
48
48
|
def continue: (?headers: Hash[untyped, untyped], ?method: String, ?postData: (String | String | untyped), ?url: String) -> void
|
49
49
|
def fallback: (?headers: Hash[untyped, untyped], ?method: String, ?postData: (String | String | untyped), ?url: String) -> void
|
50
|
-
def fetch: (?headers: Hash[untyped, untyped], ?maxRedirects: Integer, ?method: String, ?postData: (String | String | untyped), ?url: String) -> APIResponse
|
50
|
+
def fetch: (?headers: Hash[untyped, untyped], ?maxRedirects: Integer, ?method: String, ?postData: (String | String | untyped), ?timeout: Float, ?url: String) -> APIResponse
|
51
51
|
def fulfill: (?body: (String | String), ?contentType: String, ?headers: Hash[untyped, untyped], ?json: untyped, ?path: (String | File), ?response: APIResponse, ?status: Integer) -> void
|
52
52
|
def request: -> Request
|
53
53
|
end
|
@@ -184,7 +184,7 @@ module Playwright
|
|
184
184
|
def enabled?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
185
185
|
def hidden?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
186
186
|
def visible?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
187
|
-
def locator: (String selector, ?has: Locator, ?hasText: (String | Regexp)) -> Locator
|
187
|
+
def locator: (String selector, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
188
188
|
def name: -> String
|
189
189
|
def page: -> Page
|
190
190
|
def parent_frame: -> (nil | Frame)
|
@@ -293,7 +293,7 @@ module Playwright
|
|
293
293
|
def enabled?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
294
294
|
def hidden?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
295
295
|
def visible?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
296
|
-
def locator: (String selector, ?has: Locator, ?hasText: (String | Regexp)) -> Locator
|
296
|
+
def locator: (String selector, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
297
297
|
def main_frame: -> Frame
|
298
298
|
def opener: -> (nil | Page)
|
299
299
|
def pause: -> void
|
@@ -303,7 +303,7 @@ module Playwright
|
|
303
303
|
def query_selector_all: (String selector) -> Array[untyped]
|
304
304
|
def reload: (?timeout: Float, ?waitUntil: ("load" | "domcontentloaded" | "networkidle" | "commit")) -> (nil | Response)
|
305
305
|
def route: ((String | Regexp | function) url, function handler, ?times: Integer) -> void
|
306
|
-
def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?url: (String | Regexp)) -> void
|
306
|
+
def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?updateContent: ("embed" | "attach"), ?updateMode: ("full" | "minimal"), ?url: (String | Regexp)) -> void
|
307
307
|
def screenshot: (?animations: ("disabled" | "allow"), ?caret: ("hide" | "initial"), ?clip: Hash[untyped, untyped], ?fullPage: bool, ?mask: Array[untyped], ?omitBackground: bool, ?path: (String | File), ?quality: Integer, ?scale: ("css" | "device"), ?timeout: Float, ?type: ("png" | "jpeg")) -> String
|
308
308
|
def select_option: (String selector, ?element: (ElementHandle | Array[untyped]), ?index: (Integer | Array[untyped]), ?value: (String | Array[untyped]), ?label: (String | Array[untyped]), ?force: bool, ?noWaitAfter: bool, ?strict: bool, ?timeout: Float) -> Array[untyped]
|
309
309
|
def set_checked: (String selector, bool checked, ?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
@@ -368,7 +368,7 @@ module Playwright
|
|
368
368
|
def new_page: () ?{ (Page) -> untyped } -> Page
|
369
369
|
def pages: -> Array[untyped]
|
370
370
|
def route: ((String | Regexp | function) url, function handler, ?times: Integer) -> void
|
371
|
-
def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?url: (String | Regexp)) -> void
|
371
|
+
def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?updateContent: ("embed" | "attach"), ?updateMode: ("full" | "minimal"), ?url: (String | Regexp)) -> void
|
372
372
|
def service_workers: -> Array[untyped]
|
373
373
|
def set_default_navigation_timeout: (Float timeout) -> void
|
374
374
|
def default_navigation_timeout=: (Float timeout) -> void
|
@@ -425,7 +425,7 @@ module Playwright
|
|
425
425
|
|
426
426
|
class Tracing
|
427
427
|
def start: (?name: String, ?screenshots: bool, ?snapshots: bool, ?sources: bool, ?title: String) -> void
|
428
|
-
def start_chunk: (?title: String) -> void
|
428
|
+
def start_chunk: (?name: String, ?title: String) -> void
|
429
429
|
def stop: (?path: (String | File)) -> void
|
430
430
|
def stop_chunk: (?path: (String | File)) -> void
|
431
431
|
end
|
@@ -449,7 +449,7 @@ module Playwright
|
|
449
449
|
def evaluate_all: (String expression, ?arg: untyped) -> untyped
|
450
450
|
def evaluate_handle: (String expression, ?arg: untyped, ?timeout: Float) -> JSHandle
|
451
451
|
def fill: (String value, ?force: bool, ?noWaitAfter: bool, ?timeout: Float) -> void
|
452
|
-
def filter: (?has: Locator, ?hasText: (String | Regexp)) -> Locator
|
452
|
+
def filter: (?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
453
453
|
def first: -> Locator
|
454
454
|
def focus: (?timeout: Float) -> void
|
455
455
|
def frame_locator: (String selector) -> FrameLocator
|
@@ -474,8 +474,9 @@ module Playwright
|
|
474
474
|
def hidden?: (?timeout: Float) -> bool
|
475
475
|
def visible?: (?timeout: Float) -> bool
|
476
476
|
def last: -> Locator
|
477
|
-
def locator: (String
|
477
|
+
def locator: ((String | Locator) selectorOrLocator, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
478
478
|
def nth: (Integer index) -> Locator
|
479
|
+
def or: (Locator locator) -> Locator
|
479
480
|
def page: -> Page
|
480
481
|
def press: (String key, ?delay: Float, ?noWaitAfter: bool, ?timeout: Float) -> void
|
481
482
|
def screenshot: (?animations: ("disabled" | "allow"), ?caret: ("hide" | "initial"), ?mask: Array[untyped], ?omitBackground: bool, ?path: (String | File), ?quality: Integer, ?scale: ("css" | "device"), ?timeout: Float, ?type: ("png" | "jpeg")) -> String
|
@@ -504,7 +505,7 @@ module Playwright
|
|
504
505
|
def get_by_text: ((String | Regexp) text, ?exact: bool) -> Locator
|
505
506
|
def get_by_title: ((String | Regexp) text, ?exact: bool) -> Locator
|
506
507
|
def last: -> FrameLocator
|
507
|
-
def locator: (String
|
508
|
+
def locator: ((String | Locator) selectorOrLocator, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
508
509
|
def nth: (Integer index) -> FrameLocator
|
509
510
|
end
|
510
511
|
|