playwright-ruby-client 1.14.beta2 → 1.15.beta2
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/README.md +10 -14
- data/documentation/docs/api/accessibility.md +16 -17
- data/documentation/docs/api/browser.md +4 -0
- data/documentation/docs/api/browser_context.md +5 -1
- data/documentation/docs/api/browser_type.md +2 -0
- data/documentation/docs/api/element_handle.md +30 -5
- data/documentation/docs/api/experimental/android.md +15 -2
- data/documentation/docs/api/experimental/android_device.md +2 -0
- data/documentation/docs/api/frame.md +86 -104
- data/documentation/docs/api/locator.md +69 -40
- data/documentation/docs/api/mouse.md +3 -4
- data/documentation/docs/api/page.md +38 -7
- data/documentation/docs/api/request.md +42 -20
- data/documentation/docs/api/response.md +18 -1
- data/documentation/docs/api/selectors.md +29 -3
- data/documentation/docs/api/tracing.md +51 -16
- data/documentation/docs/api/worker.md +12 -11
- data/documentation/docs/article/getting_started.md +10 -1
- data/documentation/docs/article/guides/download_playwright_driver.md +9 -0
- data/documentation/docs/article/guides/inspector.md +1 -1
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +56 -3
- data/documentation/docs/article/guides/rails_integration.md +4 -2
- data/documentation/docs/article/guides/rails_integration_with_null_driver.md +86 -0
- data/documentation/docs/article/guides/recording_video.md +1 -1
- data/documentation/docs/article/guides/semi_automation.md +2 -2
- data/documentation/docs/article/guides/use_storage_state.md +78 -0
- data/documentation/docs/include/api_coverage.md +11 -0
- data/documentation/docusaurus.config.js +1 -0
- data/documentation/package.json +2 -2
- data/documentation/src/pages/index.js +0 -1
- data/documentation/static/img/playwright-ruby-client.png +0 -0
- data/documentation/yarn.lock +625 -549
- data/lib/playwright/channel.rb +36 -2
- data/lib/playwright/channel_owners/artifact.rb +6 -2
- data/lib/playwright/channel_owners/browser.rb +4 -0
- data/lib/playwright/channel_owners/browser_context.rb +21 -14
- data/lib/playwright/channel_owners/browser_type.rb +0 -1
- data/lib/playwright/channel_owners/element_handle.rb +10 -2
- data/lib/playwright/channel_owners/frame.rb +8 -0
- data/lib/playwright/channel_owners/page.rb +20 -4
- data/lib/playwright/channel_owners/playwright.rb +9 -0
- data/lib/playwright/channel_owners/request.rb +46 -25
- data/lib/playwright/channel_owners/response.rb +41 -5
- data/lib/playwright/connection.rb +8 -11
- data/lib/playwright/http_headers.rb +9 -4
- data/lib/playwright/locator_impl.rb +11 -3
- data/lib/playwright/{route_handler_entry.rb → route_handler.rb} +30 -2
- data/lib/playwright/tracing_impl.rb +18 -7
- data/lib/playwright/transport.rb +2 -0
- data/lib/playwright/utils.rb +8 -1
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/web_socket_transport.rb +2 -0
- data/lib/playwright.rb +45 -5
- data/lib/playwright_api/android.rb +21 -8
- data/lib/playwright_api/android_device.rb +11 -9
- data/lib/playwright_api/browser.rb +12 -8
- data/lib/playwright_api/browser_context.rb +12 -8
- data/lib/playwright_api/browser_type.rb +9 -7
- 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 +31 -8
- data/lib/playwright_api/frame.rb +35 -12
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +41 -2
- data/lib/playwright_api/page.rb +43 -15
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +29 -7
- data/lib/playwright_api/response.rb +23 -7
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +38 -7
- data/lib/playwright_api/tracing.rb +33 -4
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- metadata +7 -4
|
@@ -31,17 +31,12 @@ module Playwright
|
|
|
31
31
|
@transport.stop
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
callback = Concurrent::Promises.resolvable_future
|
|
40
|
-
@waiting_for_object[guid] = callback
|
|
41
|
-
callback.value!
|
|
34
|
+
def initialize_playwright
|
|
35
|
+
result = send_message_to_server('', 'initialize', { sdkLanguage: 'ruby' })
|
|
36
|
+
ChannelOwners::Playwright.from(result['playwright'])
|
|
42
37
|
end
|
|
43
38
|
|
|
44
|
-
def async_send_message_to_server(guid, method, params)
|
|
39
|
+
def async_send_message_to_server(guid, method, params, metadata: nil)
|
|
45
40
|
callback = Concurrent::Promises.resolvable_future
|
|
46
41
|
|
|
47
42
|
with_generated_id do |id|
|
|
@@ -54,7 +49,9 @@ module Playwright
|
|
|
54
49
|
guid: guid,
|
|
55
50
|
method: method,
|
|
56
51
|
params: replace_channels_with_guids(params),
|
|
52
|
+
metadata: metadata || {},
|
|
57
53
|
}
|
|
54
|
+
|
|
58
55
|
begin
|
|
59
56
|
@transport.send_message(message)
|
|
60
57
|
rescue => err
|
|
@@ -67,8 +64,8 @@ module Playwright
|
|
|
67
64
|
callback
|
|
68
65
|
end
|
|
69
66
|
|
|
70
|
-
def send_message_to_server(guid, method, params)
|
|
71
|
-
async_send_message_to_server(guid, method, params).value!
|
|
67
|
+
def send_message_to_server(guid, method, params, metadata: nil)
|
|
68
|
+
async_send_message_to_server(guid, method, params, metadata: metadata).value!
|
|
72
69
|
end
|
|
73
70
|
|
|
74
71
|
private
|
|
@@ -11,10 +11,15 @@ module Playwright
|
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
module Parser
|
|
15
|
+
def parse_headers_as_array(serialized_headers, downcase)
|
|
16
|
+
serialized_headers.map do |header|
|
|
17
|
+
name = downcase ? header['name'].downcase : header['name']
|
|
18
|
+
value = header['value']
|
|
19
|
+
|
|
20
|
+
[name, value]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
18
23
|
end
|
|
19
24
|
end
|
|
20
25
|
end
|
|
@@ -142,7 +142,7 @@ module Playwright
|
|
|
142
142
|
LocatorImpl.new(
|
|
143
143
|
frame: @frame,
|
|
144
144
|
timeout_settings: @timeout_settings,
|
|
145
|
-
selector: "#{@selector} >>
|
|
145
|
+
selector: "#{@selector} >> nth=0",
|
|
146
146
|
)
|
|
147
147
|
end
|
|
148
148
|
|
|
@@ -150,7 +150,7 @@ module Playwright
|
|
|
150
150
|
LocatorImpl.new(
|
|
151
151
|
frame: @frame,
|
|
152
152
|
timeout_settings: @timeout_settings,
|
|
153
|
-
selector: "#{@selector} >>
|
|
153
|
+
selector: "#{@selector} >> nth=-1",
|
|
154
154
|
)
|
|
155
155
|
end
|
|
156
156
|
|
|
@@ -158,7 +158,7 @@ module Playwright
|
|
|
158
158
|
LocatorImpl.new(
|
|
159
159
|
frame: @frame,
|
|
160
160
|
timeout_settings: @timeout_settings,
|
|
161
|
-
selector: "#{@selector} >>
|
|
161
|
+
selector: "#{@selector} >> nth=#{index}",
|
|
162
162
|
)
|
|
163
163
|
end
|
|
164
164
|
|
|
@@ -303,6 +303,14 @@ module Playwright
|
|
|
303
303
|
trial: trial)
|
|
304
304
|
end
|
|
305
305
|
|
|
306
|
+
def set_checked(checked, **options)
|
|
307
|
+
if checked
|
|
308
|
+
check(**options)
|
|
309
|
+
else
|
|
310
|
+
uncheck(**options)
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
306
314
|
def all_inner_texts
|
|
307
315
|
@frame.eval_on_selector_all(@selector, 'ee => ee.map(e => e.innerText)')
|
|
308
316
|
end
|
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
module Playwright
|
|
2
|
-
class
|
|
2
|
+
class RouteHandler
|
|
3
|
+
class CountDown
|
|
4
|
+
def initialize(count)
|
|
5
|
+
@count = count
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def handle
|
|
9
|
+
return false if @count <= 0
|
|
10
|
+
|
|
11
|
+
@count = @count - 1
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class StubCounter
|
|
17
|
+
def handle
|
|
18
|
+
true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
3
22
|
# @param url [String]
|
|
4
23
|
# @param base_url [String|nil]
|
|
5
24
|
# @param handler [Proc]
|
|
6
|
-
|
|
25
|
+
# @param times [Integer|nil]
|
|
26
|
+
def initialize(url, base_url, handler, times)
|
|
7
27
|
@url_value = url
|
|
8
28
|
@url_matcher = UrlMatcher.new(url, base_url: base_url)
|
|
9
29
|
@handler = handler
|
|
30
|
+
@counter =
|
|
31
|
+
if times
|
|
32
|
+
CountDown.new(times)
|
|
33
|
+
else
|
|
34
|
+
StubCounter.new
|
|
35
|
+
end
|
|
10
36
|
end
|
|
11
37
|
|
|
12
38
|
def handle(route, request)
|
|
39
|
+
return false unless @counter.handle
|
|
40
|
+
|
|
13
41
|
if @url_matcher.match?(request.url)
|
|
14
42
|
@handler.call(route, request)
|
|
15
43
|
true
|
|
@@ -12,19 +12,30 @@ module Playwright
|
|
|
12
12
|
snapshots: snapshots,
|
|
13
13
|
}.compact
|
|
14
14
|
@channel.send_message_to_server('tracingStart', params)
|
|
15
|
+
@channel.send_message_to_server('tracingStartChunk')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def start_chunk
|
|
19
|
+
@channel.send_message_to_server('tracingStartChunk')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def stop_chunk(path: nil)
|
|
23
|
+
do_stop_chunk(path: path)
|
|
15
24
|
end
|
|
16
25
|
|
|
17
|
-
# Stop tracing.
|
|
18
26
|
def stop(path: nil)
|
|
19
|
-
|
|
27
|
+
do_stop_chunk(path: path)
|
|
20
28
|
@channel.send_message_to_server('tracingStop')
|
|
21
29
|
end
|
|
22
30
|
|
|
23
|
-
private def
|
|
24
|
-
resp = @channel.send_message_to_server('
|
|
25
|
-
artifact = ChannelOwners::Artifact.
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
private def do_stop_chunk(path:)
|
|
32
|
+
resp = @channel.send_message_to_server('tracingStopChunk', save: !path.nil?)
|
|
33
|
+
artifact = ChannelOwners::Artifact.from_nullable(resp)
|
|
34
|
+
return unless artifact
|
|
35
|
+
|
|
36
|
+
if @context.browser.send(:remote?)
|
|
37
|
+
artifact.update_as_remote
|
|
38
|
+
end
|
|
28
39
|
artifact.save_as(path)
|
|
29
40
|
artifact.delete
|
|
30
41
|
end
|
data/lib/playwright/transport.rb
CHANGED
data/lib/playwright/utils.rb
CHANGED
|
@@ -3,7 +3,6 @@ module Playwright
|
|
|
3
3
|
module PrepareBrowserContextOptions
|
|
4
4
|
# @see https://github.com/microsoft/playwright/blob/5a2cfdbd47ed3c3deff77bb73e5fac34241f649d/src/client/browserContext.ts#L265
|
|
5
5
|
private def prepare_browser_context_options(params)
|
|
6
|
-
params[:sdkLanguage] = 'ruby'
|
|
7
6
|
if params[:noViewport] == 0
|
|
8
7
|
params.delete(:noViewport)
|
|
9
8
|
params[:noDefaultViewport] = true
|
|
@@ -11,6 +10,14 @@ module Playwright
|
|
|
11
10
|
if params[:extraHTTPHeaders]
|
|
12
11
|
params[:extraHTTPHeaders] = ::Playwright::HttpHeaders.new(params[:extraHTTPHeaders]).as_serialized
|
|
13
12
|
end
|
|
13
|
+
if params[:record_har_path]
|
|
14
|
+
params[:recordHar] = {
|
|
15
|
+
path: params.delete(:record_har_path)
|
|
16
|
+
}
|
|
17
|
+
if params[:record_har_omit_content]
|
|
18
|
+
params[:recordHar][:omitContent] = params.delete(:record_har_omit_content)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
14
21
|
if params[:record_video_dir]
|
|
15
22
|
params[:recordVideo] = {
|
|
16
23
|
dir: params.delete(:record_video_dir)
|
data/lib/playwright/version.rb
CHANGED
data/lib/playwright.rb
CHANGED
|
@@ -20,7 +20,7 @@ require 'playwright/channel_owner'
|
|
|
20
20
|
require 'playwright/http_headers'
|
|
21
21
|
require 'playwright/input_files'
|
|
22
22
|
require 'playwright/connection'
|
|
23
|
-
require 'playwright/
|
|
23
|
+
require 'playwright/route_handler'
|
|
24
24
|
require 'playwright/select_option_values'
|
|
25
25
|
require 'playwright/timeout_settings'
|
|
26
26
|
require 'playwright/transport'
|
|
@@ -35,16 +35,18 @@ Dir[File.join(__dir__, 'playwright_api', '*.rb')].each { |f| require f }
|
|
|
35
35
|
|
|
36
36
|
module Playwright
|
|
37
37
|
class Execution
|
|
38
|
-
def initialize(connection, playwright)
|
|
38
|
+
def initialize(connection, playwright, browser = nil)
|
|
39
39
|
@connection = connection
|
|
40
40
|
@playwright = playwright
|
|
41
|
+
@browser = browser
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
def stop
|
|
45
|
+
@browser&.close
|
|
44
46
|
@connection.stop
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
attr_reader :playwright
|
|
49
|
+
attr_reader :playwright, :browser
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
# Recommended to call this method with block.
|
|
@@ -64,7 +66,7 @@ module Playwright
|
|
|
64
66
|
|
|
65
67
|
execution =
|
|
66
68
|
begin
|
|
67
|
-
playwright = connection.
|
|
69
|
+
playwright = connection.initialize_playwright
|
|
68
70
|
Execution.new(connection, PlaywrightApi.wrap(playwright))
|
|
69
71
|
rescue
|
|
70
72
|
connection.stop
|
|
@@ -100,7 +102,7 @@ module Playwright
|
|
|
100
102
|
|
|
101
103
|
execution =
|
|
102
104
|
begin
|
|
103
|
-
playwright = connection.
|
|
105
|
+
playwright = connection.initialize_playwright
|
|
104
106
|
Execution.new(connection, PlaywrightApi.wrap(playwright))
|
|
105
107
|
rescue
|
|
106
108
|
connection.stop
|
|
@@ -117,4 +119,42 @@ module Playwright
|
|
|
117
119
|
execution
|
|
118
120
|
end
|
|
119
121
|
end
|
|
122
|
+
|
|
123
|
+
# Connects to Playwright server, launched by `npx playwright launch-server chromium` or `playwright.chromium.launchServer()`
|
|
124
|
+
#
|
|
125
|
+
# Playwright.connect_to_browser_server('ws://....') do |browser|
|
|
126
|
+
# page = browser.new_page
|
|
127
|
+
# ...
|
|
128
|
+
# end
|
|
129
|
+
#
|
|
130
|
+
# @experimental
|
|
131
|
+
module_function def connect_to_browser_server(ws_endpoint, &block)
|
|
132
|
+
require 'playwright/web_socket_client'
|
|
133
|
+
require 'playwright/web_socket_transport'
|
|
134
|
+
|
|
135
|
+
transport = WebSocketTransport.new(ws_endpoint: ws_endpoint)
|
|
136
|
+
connection = Connection.new(transport)
|
|
137
|
+
connection.async_run
|
|
138
|
+
|
|
139
|
+
execution =
|
|
140
|
+
begin
|
|
141
|
+
playwright = connection.initialize_playwright
|
|
142
|
+
browser = playwright.send(:pre_launched_browser)
|
|
143
|
+
browser.send(:update_as_remote)
|
|
144
|
+
Execution.new(connection, PlaywrightApi.wrap(playwright), PlaywrightApi.wrap(browser))
|
|
145
|
+
rescue
|
|
146
|
+
connection.stop
|
|
147
|
+
raise
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if block
|
|
151
|
+
begin
|
|
152
|
+
block.call(execution.browser)
|
|
153
|
+
ensure
|
|
154
|
+
execution.stop
|
|
155
|
+
end
|
|
156
|
+
else
|
|
157
|
+
execution
|
|
158
|
+
end
|
|
159
|
+
end
|
|
120
160
|
end
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
module Playwright
|
|
2
|
-
# Playwright has **experimental** support for Android automation.
|
|
3
|
-
#
|
|
2
|
+
# Playwright has **experimental** support for Android automation. This includes Chrome for Android and Android WebView.
|
|
3
|
+
#
|
|
4
|
+
# *Requirements*
|
|
5
|
+
# - Android device or AVD Emulator.
|
|
6
|
+
# - [ADB daemon](https://developer.android.com/studio/command-line/adb) running and authenticated with your device.
|
|
7
|
+
# Typically running `adb devices` is all you need to do.
|
|
8
|
+
# - [`Chrome 87`](https://play.google.com/store/apps/details?id=com.android.chrome) or newer installed on the device
|
|
9
|
+
# - "Enable command line on non-rooted devices" enabled in `chrome://flags`.
|
|
10
|
+
#
|
|
11
|
+
# *Known limitations*
|
|
12
|
+
# - Raw USB operation is not yet supported, so you need ADB.
|
|
13
|
+
# - Device needs to be awake to produce screenshots. Enabling "Stay awake" developer mode will help.
|
|
14
|
+
# - We didn't run all the tests against the device, so not everything works.
|
|
15
|
+
#
|
|
16
|
+
# *How to run*
|
|
4
17
|
#
|
|
5
18
|
# An example of the Android automation script would be:
|
|
6
19
|
#
|
|
@@ -25,20 +38,20 @@ module Playwright
|
|
|
25
38
|
|
|
26
39
|
# -- inherited from EventEmitter --
|
|
27
40
|
# @nodoc
|
|
28
|
-
def
|
|
29
|
-
event_emitter_proxy.
|
|
41
|
+
def off(event, callback)
|
|
42
|
+
event_emitter_proxy.off(event, callback)
|
|
30
43
|
end
|
|
31
44
|
|
|
32
45
|
# -- inherited from EventEmitter --
|
|
33
46
|
# @nodoc
|
|
34
|
-
def
|
|
35
|
-
event_emitter_proxy.
|
|
47
|
+
def once(event, callback)
|
|
48
|
+
event_emitter_proxy.once(event, callback)
|
|
36
49
|
end
|
|
37
50
|
|
|
38
51
|
# -- inherited from EventEmitter --
|
|
39
52
|
# @nodoc
|
|
40
|
-
def
|
|
41
|
-
event_emitter_proxy.
|
|
53
|
+
def on(event, callback)
|
|
54
|
+
event_emitter_proxy.on(event, callback)
|
|
42
55
|
end
|
|
43
56
|
|
|
44
57
|
private def event_emitter_proxy
|
|
@@ -46,6 +46,7 @@ module Playwright
|
|
|
46
46
|
command: nil,
|
|
47
47
|
deviceScaleFactor: nil,
|
|
48
48
|
extraHTTPHeaders: nil,
|
|
49
|
+
forcedColors: nil,
|
|
49
50
|
geolocation: nil,
|
|
50
51
|
hasTouch: nil,
|
|
51
52
|
httpCredentials: nil,
|
|
@@ -62,11 +63,12 @@ module Playwright
|
|
|
62
63
|
record_video_size: nil,
|
|
63
64
|
reducedMotion: nil,
|
|
64
65
|
screen: nil,
|
|
66
|
+
strictSelectors: nil,
|
|
65
67
|
timezoneId: nil,
|
|
66
68
|
userAgent: nil,
|
|
67
69
|
viewport: nil,
|
|
68
70
|
&block)
|
|
69
|
-
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
71
|
+
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
# Performs a long tap on the widget defined by `selector`.
|
|
@@ -162,14 +164,20 @@ module Playwright
|
|
|
162
164
|
raise NotImplementedError.new('web_views is not implemented yet.')
|
|
163
165
|
end
|
|
164
166
|
|
|
167
|
+
# @nodoc
|
|
168
|
+
def tree
|
|
169
|
+
wrap_impl(@impl.tree)
|
|
170
|
+
end
|
|
171
|
+
|
|
165
172
|
# @nodoc
|
|
166
173
|
def tap_on(selector, duration: nil, timeout: nil)
|
|
167
174
|
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
|
168
175
|
end
|
|
169
176
|
|
|
177
|
+
# -- inherited from EventEmitter --
|
|
170
178
|
# @nodoc
|
|
171
|
-
def
|
|
172
|
-
|
|
179
|
+
def off(event, callback)
|
|
180
|
+
event_emitter_proxy.off(event, callback)
|
|
173
181
|
end
|
|
174
182
|
|
|
175
183
|
# -- inherited from EventEmitter --
|
|
@@ -184,12 +192,6 @@ module Playwright
|
|
|
184
192
|
event_emitter_proxy.on(event, callback)
|
|
185
193
|
end
|
|
186
194
|
|
|
187
|
-
# -- inherited from EventEmitter --
|
|
188
|
-
# @nodoc
|
|
189
|
-
def off(event, callback)
|
|
190
|
-
event_emitter_proxy.off(event, callback)
|
|
191
|
-
end
|
|
192
|
-
|
|
193
195
|
private def event_emitter_proxy
|
|
194
196
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
195
197
|
end
|
|
@@ -70,6 +70,7 @@ module Playwright
|
|
|
70
70
|
colorScheme: nil,
|
|
71
71
|
deviceScaleFactor: nil,
|
|
72
72
|
extraHTTPHeaders: nil,
|
|
73
|
+
forcedColors: nil,
|
|
73
74
|
geolocation: nil,
|
|
74
75
|
hasTouch: nil,
|
|
75
76
|
httpCredentials: nil,
|
|
@@ -88,11 +89,12 @@ module Playwright
|
|
|
88
89
|
reducedMotion: nil,
|
|
89
90
|
screen: nil,
|
|
90
91
|
storageState: nil,
|
|
92
|
+
strictSelectors: nil,
|
|
91
93
|
timezoneId: nil,
|
|
92
94
|
userAgent: nil,
|
|
93
95
|
viewport: nil,
|
|
94
96
|
&block)
|
|
95
|
-
wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
97
|
+
wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
# Creates a new page in a new browser context. Closing this page will close the context as well.
|
|
@@ -107,6 +109,7 @@ module Playwright
|
|
|
107
109
|
colorScheme: nil,
|
|
108
110
|
deviceScaleFactor: nil,
|
|
109
111
|
extraHTTPHeaders: nil,
|
|
112
|
+
forcedColors: nil,
|
|
110
113
|
geolocation: nil,
|
|
111
114
|
hasTouch: nil,
|
|
112
115
|
httpCredentials: nil,
|
|
@@ -125,11 +128,12 @@ module Playwright
|
|
|
125
128
|
reducedMotion: nil,
|
|
126
129
|
screen: nil,
|
|
127
130
|
storageState: nil,
|
|
131
|
+
strictSelectors: nil,
|
|
128
132
|
timezoneId: nil,
|
|
129
133
|
userAgent: nil,
|
|
130
134
|
viewport: nil,
|
|
131
135
|
&block)
|
|
132
|
-
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
136
|
+
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
|
133
137
|
end
|
|
134
138
|
|
|
135
139
|
# > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
|
@@ -164,20 +168,20 @@ module Playwright
|
|
|
164
168
|
|
|
165
169
|
# -- inherited from EventEmitter --
|
|
166
170
|
# @nodoc
|
|
167
|
-
def
|
|
168
|
-
event_emitter_proxy.
|
|
171
|
+
def off(event, callback)
|
|
172
|
+
event_emitter_proxy.off(event, callback)
|
|
169
173
|
end
|
|
170
174
|
|
|
171
175
|
# -- inherited from EventEmitter --
|
|
172
176
|
# @nodoc
|
|
173
|
-
def
|
|
174
|
-
event_emitter_proxy.
|
|
177
|
+
def once(event, callback)
|
|
178
|
+
event_emitter_proxy.once(event, callback)
|
|
175
179
|
end
|
|
176
180
|
|
|
177
181
|
# -- inherited from EventEmitter --
|
|
178
182
|
# @nodoc
|
|
179
|
-
def
|
|
180
|
-
event_emitter_proxy.
|
|
183
|
+
def on(event, callback)
|
|
184
|
+
event_emitter_proxy.on(event, callback)
|
|
181
185
|
end
|
|
182
186
|
|
|
183
187
|
private def event_emitter_proxy
|