playwright-ruby-client 1.39.1 → 1.41.beta1
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/api_request_context.md +1 -2
- data/documentation/docs/api/browser.md +1 -1
- data/documentation/docs/api/browser_context.md +10 -1
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/download.md +1 -2
- data/documentation/docs/api/element_handle.md +5 -1
- data/documentation/docs/api/frame.md +4 -1
- data/documentation/docs/api/locator.md +5 -1
- data/documentation/docs/api/locator_assertions.md +12 -2
- data/documentation/docs/api/page.md +16 -3
- data/documentation/docs/api/tracing.md +2 -2
- data/documentation/docs/article/guides/rails_integration.md +80 -51
- data/documentation/docs/article/guides/rspec_integration.md +59 -0
- data/documentation/docs/include/api_coverage.md +2 -0
- data/documentation/docusaurus.config.js +1 -1
- data/documentation/package.json +7 -7
- data/documentation/yarn.lock +4641 -5023
- data/lib/playwright/api_response_impl.rb +2 -2
- data/lib/playwright/channel_owners/api_request_context.rb +12 -3
- data/lib/playwright/channel_owners/browser.rb +11 -7
- data/lib/playwright/channel_owners/browser_context.rb +40 -15
- data/lib/playwright/channel_owners/element_handle.rb +2 -0
- data/lib/playwright/channel_owners/frame.rb +38 -14
- data/lib/playwright/channel_owners/page.rb +36 -16
- data/lib/playwright/channel_owners/web_socket.rb +8 -13
- data/lib/playwright/connection.rb +18 -2
- data/lib/playwright/errors.rb +20 -2
- data/lib/playwright/input_files.rb +4 -4
- data/lib/playwright/locator_assertions_impl.rb +15 -15
- data/lib/playwright/locator_impl.rb +2 -0
- data/lib/playwright/test.rb +2 -2
- data/lib/playwright/utils.rb +3 -10
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/waiter.rb +146 -0
- data/lib/playwright.rb +1 -1
- data/lib/playwright_api/api_request_context.rb +1 -2
- data/lib/playwright_api/browser.rb +2 -2
- data/lib/playwright_api/browser_context.rb +9 -3
- data/lib/playwright_api/browser_type.rb +2 -1
- data/lib/playwright_api/download.rb +1 -2
- data/lib/playwright_api/element_handle.rb +6 -2
- data/lib/playwright_api/frame.rb +4 -1
- data/lib/playwright_api/locator.rb +6 -2
- data/lib/playwright_api/locator_assertions.rb +14 -4
- data/lib/playwright_api/page.rb +20 -10
- data/lib/playwright_api/request.rb +4 -4
- data/lib/playwright_api/tracing.rb +2 -2
- data/lib/playwright_api/worker.rb +4 -4
- data/sig/playwright.rbs +12 -10
- metadata +7 -6
- data/lib/playwright/wait_helper.rb +0 -73
@@ -79,7 +79,7 @@ module Playwright
|
|
79
79
|
expected
|
80
80
|
end
|
81
81
|
|
82
|
-
private def to_expected_text_values(items, match_substring
|
82
|
+
private def to_expected_text_values(items, match_substring: false, normalize_white_space: false, ignore_case: false)
|
83
83
|
return [] unless items.respond_to?(:each)
|
84
84
|
|
85
85
|
items.each.with_object([]) do |item, out|
|
@@ -109,9 +109,9 @@ module Playwright
|
|
109
109
|
if expected.respond_to?(:each)
|
110
110
|
expected_text = to_expected_text_values(
|
111
111
|
expected,
|
112
|
-
true,
|
113
|
-
true,
|
114
|
-
ignoreCase,
|
112
|
+
match_substring: true,
|
113
|
+
normalize_white_space: true,
|
114
|
+
ignore_case: ignoreCase,
|
115
115
|
)
|
116
116
|
|
117
117
|
expect_impl(
|
@@ -127,9 +127,9 @@ module Playwright
|
|
127
127
|
else
|
128
128
|
expected_text = to_expected_text_values(
|
129
129
|
[expected],
|
130
|
-
true,
|
131
|
-
true,
|
132
|
-
ignoreCase
|
130
|
+
match_substring: true,
|
131
|
+
normalize_white_space: true,
|
132
|
+
ignore_case: ignoreCase,
|
133
133
|
)
|
134
134
|
|
135
135
|
expect_impl(
|
@@ -146,8 +146,8 @@ module Playwright
|
|
146
146
|
end
|
147
147
|
_define_negation :to_contain_text
|
148
148
|
|
149
|
-
def to_have_attribute(name, value, timeout: nil)
|
150
|
-
expected_text = to_expected_text_values([value])
|
149
|
+
def to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
|
150
|
+
expected_text = to_expected_text_values([value], ignore_case: ignoreCase)
|
151
151
|
expect_impl(
|
152
152
|
"to.have.attribute.value",
|
153
153
|
{
|
@@ -278,9 +278,9 @@ module Playwright
|
|
278
278
|
if expected.respond_to?(:each)
|
279
279
|
expected_text = to_expected_text_values(
|
280
280
|
expected,
|
281
|
-
true,
|
282
|
-
true,
|
283
|
-
ignoreCase,
|
281
|
+
match_substring: true,
|
282
|
+
normalize_white_space: true,
|
283
|
+
ignore_case: ignoreCase,
|
284
284
|
)
|
285
285
|
expect_impl(
|
286
286
|
"to.have.text.array",
|
@@ -295,9 +295,9 @@ module Playwright
|
|
295
295
|
else
|
296
296
|
expected_text = to_expected_text_values(
|
297
297
|
[expected],
|
298
|
-
true,
|
299
|
-
true,
|
300
|
-
ignoreCase,
|
298
|
+
match_substring: true,
|
299
|
+
normalize_white_space: true,
|
300
|
+
ignore_case: ignoreCase,
|
301
301
|
)
|
302
302
|
expect_impl(
|
303
303
|
"to.have.text",
|
@@ -363,6 +363,7 @@ module Playwright
|
|
363
363
|
path: nil,
|
364
364
|
quality: nil,
|
365
365
|
scale: nil,
|
366
|
+
style: nil,
|
366
367
|
timeout: nil,
|
367
368
|
type: nil)
|
368
369
|
|
@@ -376,6 +377,7 @@ module Playwright
|
|
376
377
|
path: path,
|
377
378
|
quality: quality,
|
378
379
|
scale: scale,
|
380
|
+
style: style,
|
379
381
|
timeout: options[:timeout],
|
380
382
|
type: type)
|
381
383
|
end
|
data/lib/playwright/test.rb
CHANGED
@@ -60,9 +60,9 @@ module Playwright
|
|
60
60
|
# to_be_visible => be_visible
|
61
61
|
# not_to_be_visible => not_be_visible
|
62
62
|
root_method_name = method_name.gsub("to_", "")
|
63
|
-
Matchers.define_method
|
63
|
+
Matchers.send(:define_method, root_method_name) do |*args, **kwargs|
|
64
64
|
Matchers::PlaywrightMatcher.new(method_name, *args, **kwargs)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
end
|
68
|
+
end
|
data/lib/playwright/utils.rb
CHANGED
@@ -70,17 +70,10 @@ module Playwright
|
|
70
70
|
end
|
71
71
|
|
72
72
|
module Errors
|
73
|
-
module
|
73
|
+
module TargetClosedErrorMethods
|
74
74
|
# @param err [Exception]
|
75
|
-
private def
|
76
|
-
|
77
|
-
|
78
|
-
[
|
79
|
-
'Browser has been closed',
|
80
|
-
'Target page, context or browser has been closed',
|
81
|
-
].any? do |closed_message|
|
82
|
-
err.message.end_with?(closed_message)
|
83
|
-
end
|
75
|
+
private def target_closed_error?(err)
|
76
|
+
err.is_a?(TargetClosedError)
|
84
77
|
end
|
85
78
|
end
|
86
79
|
end
|
data/lib/playwright/version.rb
CHANGED
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module Playwright
|
4
|
+
# ref: https://github.com/microsoft/playwright-python/blob/v1.40.0/playwright/_impl/_waiter.py
|
5
|
+
# ref: https://github.com/microsoft/playwright/blob/v1.40.0/packages/playwright-core/src/client/waiter.ts
|
6
|
+
class Waiter
|
7
|
+
def initialize(channel_owner, wait_name:)
|
8
|
+
@result = Concurrent::Promises.resolvable_future
|
9
|
+
@wait_id = SecureRandom.hex(16)
|
10
|
+
@event = wait_name
|
11
|
+
@channel = channel_owner.channel
|
12
|
+
@registered_listeners = Set.new
|
13
|
+
@logs = []
|
14
|
+
wait_for_event_info_before
|
15
|
+
end
|
16
|
+
|
17
|
+
private def wait_for_event_info_before
|
18
|
+
@channel.async_send_message_to_server(
|
19
|
+
"waitForEventInfo",
|
20
|
+
{
|
21
|
+
"info": {
|
22
|
+
"waitId": @wait_id,
|
23
|
+
"phase": "before",
|
24
|
+
"event": @event,
|
25
|
+
}
|
26
|
+
},
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
private def wait_for_event_info_after(error: nil)
|
31
|
+
@channel.async_send_message_to_server(
|
32
|
+
"waitForEventInfo",
|
33
|
+
{
|
34
|
+
"info": {
|
35
|
+
"waitId": @wait_id,
|
36
|
+
"phase": "after",
|
37
|
+
"error": error,
|
38
|
+
}.compact,
|
39
|
+
},
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def reject_on_event(emitter, event, error_or_proc, predicate: nil)
|
44
|
+
listener = -> (*args) {
|
45
|
+
if !predicate || predicate.call(*args)
|
46
|
+
if error_or_proc.respond_to?(:call)
|
47
|
+
reject(error_or_proc.call)
|
48
|
+
else
|
49
|
+
reject(error_or_proc)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
}
|
53
|
+
emitter.on(event, listener)
|
54
|
+
@registered_listeners << [emitter, event, listener]
|
55
|
+
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
def reject_on_timeout(timeout_ms, message)
|
60
|
+
return if timeout_ms <= 0
|
61
|
+
|
62
|
+
Concurrent::Promises.schedule(timeout_ms / 1000.0) do
|
63
|
+
reject(TimeoutError.new(message: message))
|
64
|
+
end.rescue do |err|
|
65
|
+
puts err, err.backtrace
|
66
|
+
end
|
67
|
+
|
68
|
+
self
|
69
|
+
end
|
70
|
+
|
71
|
+
private def cleanup
|
72
|
+
@registered_listeners.each do |emitter, event, listener|
|
73
|
+
emitter.off(event, listener)
|
74
|
+
end
|
75
|
+
@registered_listeners.clear
|
76
|
+
end
|
77
|
+
|
78
|
+
private def fulfill(result)
|
79
|
+
cleanup
|
80
|
+
unless @result.resolved?
|
81
|
+
@result.fulfill(result)
|
82
|
+
end
|
83
|
+
wait_for_event_info_after
|
84
|
+
end
|
85
|
+
|
86
|
+
private def reject(error)
|
87
|
+
cleanup
|
88
|
+
klass = error.is_a?(TimeoutError) ? TimeoutError : Error
|
89
|
+
ex = klass.new(message: "#{error.message}#{format_log_recording(@logs)}")
|
90
|
+
unless @result.resolved?
|
91
|
+
@result.reject(ex)
|
92
|
+
end
|
93
|
+
wait_for_event_info_after(error: ex)
|
94
|
+
end
|
95
|
+
|
96
|
+
# @param [Playwright::EventEmitter]
|
97
|
+
# @param
|
98
|
+
def wait_for_event(emitter, event, predicate: nil)
|
99
|
+
listener = -> (*args) {
|
100
|
+
begin
|
101
|
+
if !predicate || predicate.call(*args)
|
102
|
+
fulfill(args.first)
|
103
|
+
end
|
104
|
+
rescue => err
|
105
|
+
reject(err)
|
106
|
+
end
|
107
|
+
}
|
108
|
+
emitter.on(event, listener)
|
109
|
+
@registered_listeners << [emitter, event, listener]
|
110
|
+
|
111
|
+
self
|
112
|
+
end
|
113
|
+
|
114
|
+
attr_reader :result
|
115
|
+
|
116
|
+
def log(message)
|
117
|
+
@logs << message
|
118
|
+
begin
|
119
|
+
@channel.async_send_message_to_server(
|
120
|
+
"waitForEventInfo",
|
121
|
+
{
|
122
|
+
"info": {
|
123
|
+
"waitId": @wait_id,
|
124
|
+
"phase": "log",
|
125
|
+
"message": message,
|
126
|
+
},
|
127
|
+
},
|
128
|
+
)
|
129
|
+
rescue => err
|
130
|
+
# ignore
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# @param logs [Array<String>]
|
135
|
+
private def format_log_recording(logs)
|
136
|
+
return "" if logs.empty?
|
137
|
+
|
138
|
+
header = " logs "
|
139
|
+
header_length = 60
|
140
|
+
left_length = ((header_length - header.length) / 2.0).to_i
|
141
|
+
right_length = header_length - header.length - left_length
|
142
|
+
new_line = "\n"
|
143
|
+
"#{new_line}#{'=' * left_length}#{header}#{'=' * right_length}#{new_line}#{logs.join(new_line)}#{new_line}#{'=' * header_length}"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/lib/playwright.rb
CHANGED
@@ -29,7 +29,7 @@ require 'playwright/transport'
|
|
29
29
|
require 'playwright/url_matcher'
|
30
30
|
require 'playwright/version'
|
31
31
|
require 'playwright/video'
|
32
|
-
require 'playwright/
|
32
|
+
require 'playwright/waiter'
|
33
33
|
|
34
34
|
require 'playwright/playwright_api'
|
35
35
|
# load generated files
|
@@ -86,8 +86,7 @@ module Playwright
|
|
86
86
|
end
|
87
87
|
|
88
88
|
#
|
89
|
-
# All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: APIResponse.body`].
|
90
|
-
# discards all stored responses, and makes [`method: APIResponse.body`] throw "Response disposed" error.
|
89
|
+
# All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: APIResponse.body`].This method discards all its resources, calling any method on disposed `APIRequestContext` will throw an exception.
|
91
90
|
def dispose
|
92
91
|
wrap_impl(@impl.dispose)
|
93
92
|
end
|
@@ -34,8 +34,8 @@ module Playwright
|
|
34
34
|
# **NOTE**: This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on any `BrowserContext`'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
|
35
35
|
#
|
36
36
|
# The `Browser` object itself is considered to be disposed and cannot be used anymore.
|
37
|
-
def close
|
38
|
-
wrap_impl(@impl.close)
|
37
|
+
def close(reason: nil)
|
38
|
+
wrap_impl(@impl.close(reason: unwrap_impl(reason)))
|
39
39
|
end
|
40
40
|
|
41
41
|
#
|
@@ -105,8 +105,8 @@ module Playwright
|
|
105
105
|
# Closes the browser context. All the pages that belong to the browser context will be closed.
|
106
106
|
#
|
107
107
|
# **NOTE**: The default browser context cannot be closed.
|
108
|
-
def close
|
109
|
-
wrap_impl(@impl.close)
|
108
|
+
def close(reason: nil)
|
109
|
+
wrap_impl(@impl.close(reason: unwrap_impl(reason)))
|
110
110
|
end
|
111
111
|
|
112
112
|
#
|
@@ -135,7 +135,7 @@ module Playwright
|
|
135
135
|
#
|
136
136
|
# def run(playwright: Playwright):
|
137
137
|
# webkit = playwright.webkit
|
138
|
-
# browser = webkit.launch(headless=
|
138
|
+
# browser = webkit.launch(headless=False)
|
139
139
|
# context = browser.new_context()
|
140
140
|
# context.expose_binding("pageURL", lambda source: source["page"].url)
|
141
141
|
# page = context.new_page()
|
@@ -384,6 +384,12 @@ module Playwright
|
|
384
384
|
wrap_impl(@impl.storage_state(path: unwrap_impl(path)))
|
385
385
|
end
|
386
386
|
|
387
|
+
#
|
388
|
+
# Removes all routes created with [`method: BrowserContext.route`] and [`method: BrowserContext.routeFromHAR`].
|
389
|
+
def unroute_all(behavior: nil)
|
390
|
+
wrap_impl(@impl.unroute_all(behavior: unwrap_impl(behavior)))
|
391
|
+
end
|
392
|
+
|
387
393
|
#
|
388
394
|
# Removes a route created with [`method: BrowserContext.route`]. When `handler` is not specified, removes all
|
389
395
|
# routes for the `url`.
|
@@ -129,6 +129,7 @@ module Playwright
|
|
129
129
|
env: nil,
|
130
130
|
executablePath: nil,
|
131
131
|
extraHTTPHeaders: nil,
|
132
|
+
firefoxUserPrefs: nil,
|
132
133
|
forcedColors: nil,
|
133
134
|
geolocation: nil,
|
134
135
|
handleSIGHUP: nil,
|
@@ -164,7 +165,7 @@ module Playwright
|
|
164
165
|
userAgent: nil,
|
165
166
|
viewport: nil,
|
166
167
|
&block)
|
167
|
-
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
168
|
+
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
168
169
|
end
|
169
170
|
|
170
171
|
#
|
@@ -45,8 +45,7 @@ module Playwright
|
|
45
45
|
end
|
46
46
|
|
47
47
|
#
|
48
|
-
# Returns path to the downloaded file
|
49
|
-
# wait for the download to finish if necessary. The method throws when connected remotely.
|
48
|
+
# Returns path to the downloaded file for a successful download, or throws for a failed/canceled download. The method will wait for the download to finish if necessary. The method throws when connected remotely.
|
50
49
|
#
|
51
50
|
# Note that the download's file name is a random GUID, use [`method: Download.suggestedFilename`]
|
52
51
|
# to get suggested file name.
|
@@ -154,13 +154,16 @@ module Playwright
|
|
154
154
|
#
|
155
155
|
# Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
|
156
156
|
# properties:
|
157
|
+
# - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
|
158
|
+
# - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
|
157
159
|
# - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
|
160
|
+
# - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
|
158
161
|
# - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
|
159
162
|
# - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
|
160
163
|
# - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
|
161
164
|
# - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
|
162
165
|
# - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
|
163
|
-
# - [
|
166
|
+
# - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
|
164
167
|
#
|
165
168
|
# You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
|
166
169
|
#
|
@@ -379,9 +382,10 @@ module Playwright
|
|
379
382
|
path: nil,
|
380
383
|
quality: nil,
|
381
384
|
scale: nil,
|
385
|
+
style: nil,
|
382
386
|
timeout: nil,
|
383
387
|
type: nil)
|
384
|
-
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), mask: unwrap_impl(mask), maskColor: unwrap_impl(maskColor), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
388
|
+
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), mask: unwrap_impl(mask), maskColor: unwrap_impl(maskColor), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), style: unwrap_impl(style), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
385
389
|
end
|
386
390
|
|
387
391
|
#
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -149,13 +149,16 @@ module Playwright
|
|
149
149
|
#
|
150
150
|
# Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
|
151
151
|
# properties:
|
152
|
+
# - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
|
153
|
+
# - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
|
152
154
|
# - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
|
155
|
+
# - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
|
153
156
|
# - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
|
154
157
|
# - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
|
155
158
|
# - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
|
156
159
|
# - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
|
157
160
|
# - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
|
158
|
-
# - [
|
161
|
+
# - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
|
159
162
|
#
|
160
163
|
# You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
|
161
164
|
#
|
@@ -257,13 +257,16 @@ module Playwright
|
|
257
257
|
#
|
258
258
|
# Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
|
259
259
|
# properties:
|
260
|
+
# - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
|
261
|
+
# - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
|
260
262
|
# - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
|
263
|
+
# - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
|
261
264
|
# - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
|
262
265
|
# - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
|
263
266
|
# - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
|
264
267
|
# - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
|
265
268
|
# - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
|
266
|
-
# - [
|
269
|
+
# - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
|
267
270
|
#
|
268
271
|
# You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
|
269
272
|
#
|
@@ -950,9 +953,10 @@ module Playwright
|
|
950
953
|
path: nil,
|
951
954
|
quality: nil,
|
952
955
|
scale: nil,
|
956
|
+
style: nil,
|
953
957
|
timeout: nil,
|
954
958
|
type: nil)
|
955
|
-
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), mask: unwrap_impl(mask), maskColor: unwrap_impl(maskColor), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
959
|
+
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), mask: unwrap_impl(mask), maskColor: unwrap_impl(maskColor), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), style: unwrap_impl(style), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
956
960
|
end
|
957
961
|
|
958
962
|
#
|
@@ -80,8 +80,8 @@ module Playwright
|
|
80
80
|
|
81
81
|
#
|
82
82
|
# The opposite of [`method: LocatorAssertions.toHaveAttribute`].
|
83
|
-
def not_to_have_attribute(name, value, timeout: nil)
|
84
|
-
wrap_impl(@impl.not_to_have_attribute(unwrap_impl(name), unwrap_impl(value), timeout: unwrap_impl(timeout)))
|
83
|
+
def not_to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
|
84
|
+
wrap_impl(@impl.not_to_have_attribute(unwrap_impl(name), unwrap_impl(value), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
|
85
85
|
end
|
86
86
|
|
87
87
|
#
|
@@ -301,6 +301,11 @@ module Playwright
|
|
301
301
|
#
|
302
302
|
# Ensures the `Locator` points to an element that contains the given text. You can use regular expressions for the value as well.
|
303
303
|
#
|
304
|
+
# **Details**
|
305
|
+
#
|
306
|
+
# When `expected` parameter is a string, Playwright will normalize whitespaces and line breaks both in the actual text and
|
307
|
+
# in the expected string before matching. When regular expression is used, the actual text is matched as is.
|
308
|
+
#
|
304
309
|
# **Usage**
|
305
310
|
#
|
306
311
|
# ```python sync
|
@@ -360,8 +365,8 @@ module Playwright
|
|
360
365
|
# locator = page.locator("input")
|
361
366
|
# expect(locator).to_have_attribute("type", "text")
|
362
367
|
# ```
|
363
|
-
def to_have_attribute(name, value, timeout: nil)
|
364
|
-
wrap_impl(@impl.to_have_attribute(unwrap_impl(name), unwrap_impl(value), timeout: unwrap_impl(timeout)))
|
368
|
+
def to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
|
369
|
+
wrap_impl(@impl.to_have_attribute(unwrap_impl(name), unwrap_impl(value), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
|
365
370
|
end
|
366
371
|
|
367
372
|
#
|
@@ -458,6 +463,11 @@ module Playwright
|
|
458
463
|
#
|
459
464
|
# Ensures the `Locator` points to an element with the given text. You can use regular expressions for the value as well.
|
460
465
|
#
|
466
|
+
# **Details**
|
467
|
+
#
|
468
|
+
# When `expected` parameter is a string, Playwright will normalize whitespaces and line breaks both in the actual text and
|
469
|
+
# in the expected string before matching. When regular expression is used, the actual text is matched as is.
|
470
|
+
#
|
461
471
|
# **Usage**
|
462
472
|
#
|
463
473
|
# ```python sync
|
data/lib/playwright_api/page.rb
CHANGED
@@ -166,8 +166,8 @@ module Playwright
|
|
166
166
|
#
|
167
167
|
# **NOTE**: if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled
|
168
168
|
# manually via [`event: Page.dialog`] event.
|
169
|
-
def close(runBeforeUnload: nil)
|
170
|
-
wrap_impl(@impl.close(runBeforeUnload: unwrap_impl(runBeforeUnload)))
|
169
|
+
def close(reason: nil, runBeforeUnload: nil)
|
170
|
+
wrap_impl(@impl.close(reason: unwrap_impl(reason), runBeforeUnload: unwrap_impl(runBeforeUnload)))
|
171
171
|
end
|
172
172
|
|
173
173
|
#
|
@@ -225,13 +225,16 @@ module Playwright
|
|
225
225
|
#
|
226
226
|
# Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial
|
227
227
|
# properties:
|
228
|
+
# - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
|
229
|
+
# - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
|
228
230
|
# - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
|
231
|
+
# - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
|
229
232
|
# - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
|
230
233
|
# - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
|
231
234
|
# - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
|
232
235
|
# - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
|
233
236
|
# - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
|
234
|
-
# - [
|
237
|
+
# - [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)
|
235
238
|
#
|
236
239
|
# You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
|
237
240
|
#
|
@@ -442,7 +445,7 @@ module Playwright
|
|
442
445
|
#
|
443
446
|
# def run(playwright: Playwright):
|
444
447
|
# webkit = playwright.webkit
|
445
|
-
# browser = webkit.launch(headless=
|
448
|
+
# browser = webkit.launch(headless=False)
|
446
449
|
# context = browser.new_context()
|
447
450
|
# page = context.new_page()
|
448
451
|
# page.expose_binding("pageURL", lambda source: source["page"].url)
|
@@ -1159,9 +1162,10 @@ module Playwright
|
|
1159
1162
|
path: nil,
|
1160
1163
|
quality: nil,
|
1161
1164
|
scale: nil,
|
1165
|
+
style: nil,
|
1162
1166
|
timeout: nil,
|
1163
1167
|
type: nil)
|
1164
|
-
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), clip: unwrap_impl(clip), fullPage: unwrap_impl(fullPage), mask: unwrap_impl(mask), maskColor: unwrap_impl(maskColor), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
1168
|
+
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), clip: unwrap_impl(clip), fullPage: unwrap_impl(fullPage), mask: unwrap_impl(mask), maskColor: unwrap_impl(maskColor), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), style: unwrap_impl(style), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
1165
1169
|
end
|
1166
1170
|
|
1167
1171
|
#
|
@@ -1373,6 +1377,12 @@ module Playwright
|
|
1373
1377
|
wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
1374
1378
|
end
|
1375
1379
|
|
1380
|
+
#
|
1381
|
+
# Removes all routes created with [`method: Page.route`] and [`method: Page.routeFromHAR`].
|
1382
|
+
def unroute_all(behavior: nil)
|
1383
|
+
wrap_impl(@impl.unroute_all(behavior: unwrap_impl(behavior)))
|
1384
|
+
end
|
1385
|
+
|
1376
1386
|
#
|
1377
1387
|
# Removes a route created with [`method: Page.route`]. When `handler` is not specified, removes all routes for
|
1378
1388
|
# the `url`.
|
@@ -1685,6 +1695,11 @@ module Playwright
|
|
1685
1695
|
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1686
1696
|
end
|
1687
1697
|
|
1698
|
+
# @nodoc
|
1699
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1700
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1701
|
+
end
|
1702
|
+
|
1688
1703
|
# @nodoc
|
1689
1704
|
def owned_context=(req)
|
1690
1705
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
@@ -1695,11 +1710,6 @@ module Playwright
|
|
1695
1710
|
wrap_impl(@impl.guid)
|
1696
1711
|
end
|
1697
1712
|
|
1698
|
-
# @nodoc
|
1699
|
-
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1700
|
-
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1701
|
-
end
|
1702
|
-
|
1703
1713
|
# -- inherited from EventEmitter --
|
1704
1714
|
# @nodoc
|
1705
1715
|
def off(event, callback)
|
@@ -196,13 +196,13 @@ module Playwright
|
|
196
196
|
end
|
197
197
|
|
198
198
|
# @nodoc
|
199
|
-
def
|
200
|
-
wrap_impl(@impl.
|
199
|
+
def header_values(name)
|
200
|
+
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
201
201
|
end
|
202
202
|
|
203
203
|
# @nodoc
|
204
|
-
def
|
205
|
-
wrap_impl(@impl.
|
204
|
+
def apply_fallback_overrides(overrides)
|
205
|
+
wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
|
206
206
|
end
|
207
207
|
|
208
208
|
# -- inherited from EventEmitter --
|
@@ -20,7 +20,7 @@ module Playwright
|
|
20
20
|
# **Usage**
|
21
21
|
#
|
22
22
|
# ```python sync
|
23
|
-
# context.tracing.start(
|
23
|
+
# context.tracing.start(screenshots=True, snapshots=True)
|
24
24
|
# page = context.new_page()
|
25
25
|
# page.goto("https://playwright.dev")
|
26
26
|
# context.tracing.stop(path = "trace.zip")
|
@@ -40,7 +40,7 @@ module Playwright
|
|
40
40
|
# **Usage**
|
41
41
|
#
|
42
42
|
# ```python sync
|
43
|
-
# context.tracing.start(
|
43
|
+
# context.tracing.start(screenshots=True, snapshots=True)
|
44
44
|
# page = context.new_page()
|
45
45
|
# page.goto("https://playwright.dev")
|
46
46
|
#
|
@@ -47,13 +47,13 @@ module Playwright
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# @nodoc
|
50
|
-
def
|
51
|
-
wrap_impl(@impl.
|
50
|
+
def page=(req)
|
51
|
+
wrap_impl(@impl.page=(unwrap_impl(req)))
|
52
52
|
end
|
53
53
|
|
54
54
|
# @nodoc
|
55
|
-
def
|
56
|
-
wrap_impl(@impl.
|
55
|
+
def context=(req)
|
56
|
+
wrap_impl(@impl.context=(unwrap_impl(req)))
|
57
57
|
end
|
58
58
|
|
59
59
|
# -- inherited from EventEmitter --
|