playwright-ruby-client 0.5.9 → 0.6.3
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 +1 -1
- data/documentation/README.md +33 -0
- data/documentation/babel.config.js +3 -0
- data/documentation/docs/api/accessibility.md +7 -0
- data/documentation/docs/api/browser.md +187 -0
- data/documentation/docs/api/browser_context.md +397 -0
- data/documentation/docs/api/browser_type.md +105 -0
- data/documentation/docs/api/cdp_session.md +7 -0
- data/documentation/docs/api/console_message.md +41 -0
- data/documentation/docs/api/dialog.md +71 -0
- data/documentation/docs/api/element_handle.md +618 -0
- data/documentation/docs/api/experimental/_category_.yml +3 -0
- data/documentation/docs/api/experimental/android.md +25 -0
- data/documentation/docs/api/experimental/android_device.md +92 -0
- data/documentation/docs/api/experimental/android_input.md +38 -0
- data/documentation/docs/api/experimental/android_socket.md +7 -0
- data/documentation/docs/api/experimental/android_web_view.md +7 -0
- data/documentation/docs/api/file_chooser.md +50 -0
- data/documentation/docs/api/frame.md +866 -0
- data/documentation/docs/api/js_handle.md +113 -0
- data/documentation/docs/api/keyboard.md +157 -0
- data/documentation/docs/api/mouse.md +69 -0
- data/documentation/docs/api/page.md +1402 -0
- data/documentation/docs/api/playwright.md +63 -0
- data/documentation/docs/api/request.md +188 -0
- data/documentation/docs/api/response.md +97 -0
- data/documentation/docs/api/route.md +80 -0
- data/documentation/docs/api/selectors.md +23 -0
- data/documentation/docs/api/touchscreen.md +8 -0
- data/documentation/docs/api/tracing.md +54 -0
- data/documentation/docs/api/web_socket.md +7 -0
- data/documentation/docs/api/worker.md +24 -0
- data/documentation/docs/article/api_coverage.mdx +11 -0
- data/documentation/docs/article/getting_started.md +152 -0
- data/documentation/docs/article/guides/_category_.yml +3 -0
- data/documentation/docs/article/guides/download_playwright_driver.md +49 -0
- data/documentation/docs/article/guides/launch_browser.md +119 -0
- data/documentation/docs/article/guides/rails_integration.md +162 -0
- data/{docs → documentation/docs/include}/api_coverage.md +12 -1
- data/documentation/docusaurus.config.js +107 -0
- data/documentation/package.json +39 -0
- data/documentation/sidebars.js +15 -0
- data/documentation/src/components/HomepageFeatures.js +61 -0
- data/documentation/src/components/HomepageFeatures.module.css +13 -0
- data/documentation/src/css/custom.css +44 -0
- data/documentation/src/pages/index.js +50 -0
- data/documentation/src/pages/index.module.css +41 -0
- data/documentation/src/pages/markdown-page.md +7 -0
- data/documentation/static/.nojekyll +0 -0
- data/documentation/static/img/playwright-logo.svg +9 -0
- data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
- data/documentation/static/img/undraw_web_development.svg +1 -0
- data/documentation/static/img/undraw_windows.svg +1 -0
- data/documentation/yarn.lock +8805 -0
- data/lib/playwright/channel_owners/binding_call.rb +33 -0
- data/lib/playwright/channel_owners/browser.rb +11 -2
- data/lib/playwright/channel_owners/browser_context.rb +58 -6
- data/lib/playwright/channel_owners/browser_type.rb +8 -1
- data/lib/playwright/channel_owners/element_handle.rb +17 -16
- data/lib/playwright/channel_owners/frame.rb +24 -34
- data/lib/playwright/channel_owners/js_handle.rb +2 -10
- data/lib/playwright/channel_owners/page.rb +37 -52
- data/lib/playwright/channel_owners/worker.rb +4 -0
- data/lib/playwright/download.rb +3 -2
- data/lib/playwright/events.rb +4 -0
- data/lib/playwright/input_files.rb +0 -8
- data/lib/playwright/javascript.rb +0 -10
- data/lib/playwright/javascript/expression.rb +2 -7
- data/lib/playwright/playwright_api.rb +16 -1
- data/lib/playwright/tracing_impl.rb +31 -0
- data/lib/playwright/version.rb +2 -1
- data/lib/playwright_api/accessibility.rb +7 -88
- data/lib/playwright_api/android.rb +2 -59
- data/lib/playwright_api/android_device.rb +6 -5
- data/lib/playwright_api/browser.rb +13 -122
- data/lib/playwright_api/browser_context.rb +66 -433
- data/lib/playwright_api/browser_type.rb +28 -78
- data/lib/playwright_api/cdp_session.rb +2 -25
- data/lib/playwright_api/console_message.rb +2 -0
- data/lib/playwright_api/dialog.rb +5 -63
- data/lib/playwright_api/element_handle.rb +96 -294
- data/lib/playwright_api/file_chooser.rb +0 -21
- data/lib/playwright_api/frame.rb +98 -564
- data/lib/playwright_api/js_handle.rb +10 -67
- data/lib/playwright_api/keyboard.rb +22 -166
- data/lib/playwright_api/mouse.rb +1 -45
- data/lib/playwright_api/page.rb +223 -1224
- data/lib/playwright_api/playwright.rb +8 -93
- data/lib/playwright_api/request.rb +9 -87
- data/lib/playwright_api/response.rb +1 -1
- data/lib/playwright_api/route.rb +3 -80
- data/lib/playwright_api/selectors.rb +0 -66
- data/lib/playwright_api/tracing.rb +39 -0
- data/lib/playwright_api/web_socket.rb +1 -1
- data/lib/playwright_api/worker.rb +28 -42
- data/playwright.gemspec +2 -2
- metadata +60 -20
- data/lib/playwright/javascript/function.rb +0 -67
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Playwright
|
|
2
|
+
# API for collecting and saving Playwright traces. Playwright traces can be opened using the Playwright CLI after
|
|
3
|
+
# Playwright script runs.
|
|
4
|
+
#
|
|
5
|
+
# Start with specifying the folder traces will be stored in:
|
|
6
|
+
#
|
|
7
|
+
# ```python sync
|
|
8
|
+
# browser = chromium.launch(traceDir='traces')
|
|
9
|
+
# context = browser.new_context()
|
|
10
|
+
# context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
|
11
|
+
# page.goto("https://playwright.dev")
|
|
12
|
+
# context.tracing.stop()
|
|
13
|
+
# context.tracing.export("trace.zip")
|
|
14
|
+
# ```
|
|
15
|
+
class Tracing < PlaywrightApi
|
|
16
|
+
|
|
17
|
+
# Export trace into the file with the given name. Should be called after the tracing has stopped.
|
|
18
|
+
def export(path)
|
|
19
|
+
wrap_impl(@impl.export(unwrap_impl(path)))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Start tracing.
|
|
23
|
+
#
|
|
24
|
+
# ```python sync
|
|
25
|
+
# context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
|
26
|
+
# page.goto("https://playwright.dev")
|
|
27
|
+
# context.tracing.stop()
|
|
28
|
+
# context.tracing.export("trace.zip")
|
|
29
|
+
# ```
|
|
30
|
+
def start(name: nil, screenshots: nil, snapshots: nil)
|
|
31
|
+
wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots)))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Stop tracing.
|
|
35
|
+
def stop
|
|
36
|
+
wrap_impl(@impl.stop)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -19,7 +19,7 @@ module Playwright
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# > NOTE: In most cases, you should use [`method: WebSocket.waitForEvent`].
|
|
22
|
-
#
|
|
22
|
+
#
|
|
23
23
|
# Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and
|
|
24
24
|
# waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is closed before the `event` is
|
|
25
25
|
# fired.
|
|
@@ -2,61 +2,25 @@ module Playwright
|
|
|
2
2
|
# The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker`
|
|
3
3
|
# event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the
|
|
4
4
|
# worker is gone.
|
|
5
|
-
#
|
|
6
5
|
#
|
|
7
|
-
# ```js
|
|
8
|
-
# page.on('worker', worker => {
|
|
9
|
-
# console.log('Worker created: ' + worker.url());
|
|
10
|
-
# worker.on('close', worker => console.log('Worker destroyed: ' + worker.url()));
|
|
11
|
-
# });
|
|
12
|
-
#
|
|
13
|
-
# console.log('Current workers:');
|
|
14
|
-
# for (const worker of page.workers())
|
|
15
|
-
# console.log(' ' + worker.url());
|
|
16
|
-
# ```
|
|
17
|
-
#
|
|
18
|
-
# ```java
|
|
19
|
-
# page.onWorker(worker -> {
|
|
20
|
-
# System.out.println("Worker created: " + worker.url());
|
|
21
|
-
# worker.onClose(worker1 -> System.out.println("Worker destroyed: " + worker1.url()));
|
|
22
|
-
# });
|
|
23
|
-
# System.out.println("Current workers:");
|
|
24
|
-
# for (Worker worker : page.workers())
|
|
25
|
-
# System.out.println(" " + worker.url());
|
|
26
|
-
# ```
|
|
27
|
-
#
|
|
28
6
|
# ```py
|
|
29
7
|
# def handle_worker(worker):
|
|
30
8
|
# print("worker created: " + worker.url)
|
|
31
9
|
# worker.on("close", lambda: print("worker destroyed: " + worker.url))
|
|
32
|
-
#
|
|
10
|
+
#
|
|
33
11
|
# page.on('worker', handle_worker)
|
|
34
|
-
#
|
|
12
|
+
#
|
|
35
13
|
# print("current workers:")
|
|
36
14
|
# for worker in page.workers:
|
|
37
15
|
# print(" " + worker.url)
|
|
38
16
|
# ```
|
|
39
|
-
#
|
|
40
|
-
# ```csharp
|
|
41
|
-
# Page.Worker += (_, worker) =>
|
|
42
|
-
# {
|
|
43
|
-
# Console.WriteLine($"Worker created: {worker.Url}");
|
|
44
|
-
# worker.Close += (_, _) => Console.WriteLine($"Worker closed {worker.Url}");
|
|
45
|
-
# };
|
|
46
|
-
#
|
|
47
|
-
# Console.WriteLine("Current Workers:");
|
|
48
|
-
# foreach(var pageWorker in Page.Workers)
|
|
49
|
-
# {
|
|
50
|
-
# Console.WriteLine($"\tWorker: {pageWorker.Url}");
|
|
51
|
-
# }
|
|
52
|
-
# ```
|
|
53
17
|
class Worker < PlaywrightApi
|
|
54
18
|
|
|
55
19
|
# Returns the return value of `expression`.
|
|
56
|
-
#
|
|
20
|
+
#
|
|
57
21
|
# If the function passed to the [`method: Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate`] would
|
|
58
22
|
# wait for the promise to resolve and return its value.
|
|
59
|
-
#
|
|
23
|
+
#
|
|
60
24
|
# If the function passed to the [`method: Worker.evaluate`] returns a non-[Serializable] value, then
|
|
61
25
|
# [`method: Worker.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are
|
|
62
26
|
# not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
|
|
@@ -65,10 +29,10 @@ module Playwright
|
|
|
65
29
|
end
|
|
66
30
|
|
|
67
31
|
# Returns the return value of `expression` as a `JSHandle`.
|
|
68
|
-
#
|
|
32
|
+
#
|
|
69
33
|
# The only difference between [`method: Worker.evaluate`] and [`method: Worker.evaluateHandle`] is that
|
|
70
34
|
# [`method: Worker.evaluateHandle`] returns `JSHandle`.
|
|
71
|
-
#
|
|
35
|
+
#
|
|
72
36
|
# If the function passed to the [`method: Worker.evaluateHandle`] returns a [Promise], then
|
|
73
37
|
# [`method: Worker.evaluateHandle`] would wait for the promise to resolve and return its value.
|
|
74
38
|
def evaluate_handle(expression, arg: nil)
|
|
@@ -78,5 +42,27 @@ module Playwright
|
|
|
78
42
|
def url
|
|
79
43
|
raise NotImplementedError.new('url is not implemented yet.')
|
|
80
44
|
end
|
|
45
|
+
|
|
46
|
+
# -- inherited from EventEmitter --
|
|
47
|
+
# @nodoc
|
|
48
|
+
def once(event, callback)
|
|
49
|
+
event_emitter_proxy.once(event, callback)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# -- inherited from EventEmitter --
|
|
53
|
+
# @nodoc
|
|
54
|
+
def on(event, callback)
|
|
55
|
+
event_emitter_proxy.on(event, callback)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# -- inherited from EventEmitter --
|
|
59
|
+
# @nodoc
|
|
60
|
+
def off(event, callback)
|
|
61
|
+
event_emitter_proxy.off(event, callback)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private def event_emitter_proxy
|
|
65
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
66
|
+
end
|
|
81
67
|
end
|
|
82
68
|
end
|
data/playwright.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
spec.authors = ['YusukeIwaki']
|
|
12
12
|
spec.email = ['q7w8e9w8q7w8e9@yahoo.co.jp']
|
|
13
13
|
|
|
14
|
-
spec.summary =
|
|
14
|
+
spec.summary = "The Ruby binding of playwright driver #{Playwright::COMPATIBLE_PLAYWRIGHT_VERSION}"
|
|
15
15
|
spec.homepage = 'https://github.com/YusukeIwaki/playwright-ruby-client'
|
|
16
16
|
spec.license = 'MIT'
|
|
17
17
|
|
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
25
|
spec.require_paths = ['lib']
|
|
26
26
|
|
|
27
|
+
spec.required_ruby_version = '>= 2.4'
|
|
27
28
|
spec.add_dependency 'concurrent-ruby', '>= 1.1.6'
|
|
28
29
|
spec.add_dependency 'mime-types', '>= 3.0'
|
|
29
30
|
spec.add_development_dependency 'bundler', '~> 2.2.3'
|
|
@@ -33,7 +34,6 @@ Gem::Specification.new do |spec|
|
|
|
33
34
|
spec.add_development_dependency 'rake', '~> 13.0.3'
|
|
34
35
|
spec.add_development_dependency 'rspec', '~> 3.10.0 '
|
|
35
36
|
spec.add_development_dependency 'rspec_junit_formatter' # for CircleCI.
|
|
36
|
-
spec.add_development_dependency 'rubocop', '~> 1.7.0'
|
|
37
37
|
spec.add_development_dependency 'rubocop-rspec'
|
|
38
38
|
spec.add_development_dependency 'sinatra'
|
|
39
39
|
spec.add_development_dependency 'webrick'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playwright-ruby-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- YusukeIwaki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|
|
@@ -136,20 +136,6 @@ dependencies:
|
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
-
- !ruby/object:Gem::Dependency
|
|
140
|
-
name: rubocop
|
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
|
142
|
-
requirements:
|
|
143
|
-
- - "~>"
|
|
144
|
-
- !ruby/object:Gem::Version
|
|
145
|
-
version: 1.7.0
|
|
146
|
-
type: :development
|
|
147
|
-
prerelease: false
|
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
-
requirements:
|
|
150
|
-
- - "~>"
|
|
151
|
-
- !ruby/object:Gem::Version
|
|
152
|
-
version: 1.7.0
|
|
153
139
|
- !ruby/object:Gem::Dependency
|
|
154
140
|
name: rubocop-rspec
|
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -207,7 +193,59 @@ files:
|
|
|
207
193
|
- Rakefile
|
|
208
194
|
- bin/console
|
|
209
195
|
- bin/setup
|
|
210
|
-
-
|
|
196
|
+
- documentation/README.md
|
|
197
|
+
- documentation/babel.config.js
|
|
198
|
+
- documentation/docs/api/accessibility.md
|
|
199
|
+
- documentation/docs/api/browser.md
|
|
200
|
+
- documentation/docs/api/browser_context.md
|
|
201
|
+
- documentation/docs/api/browser_type.md
|
|
202
|
+
- documentation/docs/api/cdp_session.md
|
|
203
|
+
- documentation/docs/api/console_message.md
|
|
204
|
+
- documentation/docs/api/dialog.md
|
|
205
|
+
- documentation/docs/api/element_handle.md
|
|
206
|
+
- documentation/docs/api/experimental/_category_.yml
|
|
207
|
+
- documentation/docs/api/experimental/android.md
|
|
208
|
+
- documentation/docs/api/experimental/android_device.md
|
|
209
|
+
- documentation/docs/api/experimental/android_input.md
|
|
210
|
+
- documentation/docs/api/experimental/android_socket.md
|
|
211
|
+
- documentation/docs/api/experimental/android_web_view.md
|
|
212
|
+
- documentation/docs/api/file_chooser.md
|
|
213
|
+
- documentation/docs/api/frame.md
|
|
214
|
+
- documentation/docs/api/js_handle.md
|
|
215
|
+
- documentation/docs/api/keyboard.md
|
|
216
|
+
- documentation/docs/api/mouse.md
|
|
217
|
+
- documentation/docs/api/page.md
|
|
218
|
+
- documentation/docs/api/playwright.md
|
|
219
|
+
- documentation/docs/api/request.md
|
|
220
|
+
- documentation/docs/api/response.md
|
|
221
|
+
- documentation/docs/api/route.md
|
|
222
|
+
- documentation/docs/api/selectors.md
|
|
223
|
+
- documentation/docs/api/touchscreen.md
|
|
224
|
+
- documentation/docs/api/tracing.md
|
|
225
|
+
- documentation/docs/api/web_socket.md
|
|
226
|
+
- documentation/docs/api/worker.md
|
|
227
|
+
- documentation/docs/article/api_coverage.mdx
|
|
228
|
+
- documentation/docs/article/getting_started.md
|
|
229
|
+
- documentation/docs/article/guides/_category_.yml
|
|
230
|
+
- documentation/docs/article/guides/download_playwright_driver.md
|
|
231
|
+
- documentation/docs/article/guides/launch_browser.md
|
|
232
|
+
- documentation/docs/article/guides/rails_integration.md
|
|
233
|
+
- documentation/docs/include/api_coverage.md
|
|
234
|
+
- documentation/docusaurus.config.js
|
|
235
|
+
- documentation/package.json
|
|
236
|
+
- documentation/sidebars.js
|
|
237
|
+
- documentation/src/components/HomepageFeatures.js
|
|
238
|
+
- documentation/src/components/HomepageFeatures.module.css
|
|
239
|
+
- documentation/src/css/custom.css
|
|
240
|
+
- documentation/src/pages/index.js
|
|
241
|
+
- documentation/src/pages/index.module.css
|
|
242
|
+
- documentation/src/pages/markdown-page.md
|
|
243
|
+
- documentation/static/.nojekyll
|
|
244
|
+
- documentation/static/img/playwright-logo.svg
|
|
245
|
+
- documentation/static/img/undraw_dropdown_menu.svg
|
|
246
|
+
- documentation/static/img/undraw_web_development.svg
|
|
247
|
+
- documentation/static/img/undraw_windows.svg
|
|
248
|
+
- documentation/yarn.lock
|
|
211
249
|
- lib/playwright.rb
|
|
212
250
|
- lib/playwright/android_input_impl.rb
|
|
213
251
|
- lib/playwright/api_implementation.rb
|
|
@@ -233,6 +271,7 @@ files:
|
|
|
233
271
|
- lib/playwright/channel_owners/route.rb
|
|
234
272
|
- lib/playwright/channel_owners/selectors.rb
|
|
235
273
|
- lib/playwright/channel_owners/stream.rb
|
|
274
|
+
- lib/playwright/channel_owners/worker.rb
|
|
236
275
|
- lib/playwright/connection.rb
|
|
237
276
|
- lib/playwright/download.rb
|
|
238
277
|
- lib/playwright/errors.rb
|
|
@@ -244,7 +283,6 @@ files:
|
|
|
244
283
|
- lib/playwright/input_files.rb
|
|
245
284
|
- lib/playwright/javascript.rb
|
|
246
285
|
- lib/playwright/javascript/expression.rb
|
|
247
|
-
- lib/playwright/javascript/function.rb
|
|
248
286
|
- lib/playwright/javascript/value_parser.rb
|
|
249
287
|
- lib/playwright/javascript/value_serializer.rb
|
|
250
288
|
- lib/playwright/keyboard_impl.rb
|
|
@@ -254,6 +292,7 @@ files:
|
|
|
254
292
|
- lib/playwright/select_option_values.rb
|
|
255
293
|
- lib/playwright/timeout_settings.rb
|
|
256
294
|
- lib/playwright/touchscreen_impl.rb
|
|
295
|
+
- lib/playwright/tracing_impl.rb
|
|
257
296
|
- lib/playwright/transport.rb
|
|
258
297
|
- lib/playwright/url_matcher.rb
|
|
259
298
|
- lib/playwright/utils.rb
|
|
@@ -285,6 +324,7 @@ files:
|
|
|
285
324
|
- lib/playwright_api/route.rb
|
|
286
325
|
- lib/playwright_api/selectors.rb
|
|
287
326
|
- lib/playwright_api/touchscreen.rb
|
|
327
|
+
- lib/playwright_api/tracing.rb
|
|
288
328
|
- lib/playwright_api/web_socket.rb
|
|
289
329
|
- lib/playwright_api/worker.rb
|
|
290
330
|
- playwright.gemspec
|
|
@@ -300,7 +340,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
300
340
|
requirements:
|
|
301
341
|
- - ">="
|
|
302
342
|
- !ruby/object:Gem::Version
|
|
303
|
-
version: '
|
|
343
|
+
version: '2.4'
|
|
304
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
345
|
requirements:
|
|
306
346
|
- - ">="
|
|
@@ -310,5 +350,5 @@ requirements: []
|
|
|
310
350
|
rubygems_version: 3.2.15
|
|
311
351
|
signing_key:
|
|
312
352
|
specification_version: 4
|
|
313
|
-
summary: The Ruby binding of playwright driver
|
|
353
|
+
summary: The Ruby binding of playwright driver 1.12.0
|
|
314
354
|
test_files: []
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
module Playwright
|
|
2
|
-
module JavaScript
|
|
3
|
-
class Function
|
|
4
|
-
def initialize(definition, arg)
|
|
5
|
-
@definition = definition
|
|
6
|
-
@serialized_arg = ValueSerializer.new(arg).serialize
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def evaluate(channel)
|
|
10
|
-
value = channel.send_message_to_server(
|
|
11
|
-
'evaluateExpression',
|
|
12
|
-
expression: @definition,
|
|
13
|
-
isFunction: true,
|
|
14
|
-
arg: @serialized_arg,
|
|
15
|
-
)
|
|
16
|
-
ValueParser.new(value).parse
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def evaluate_handle(channel)
|
|
20
|
-
resp = channel.send_message_to_server(
|
|
21
|
-
'evaluateExpressionHandle',
|
|
22
|
-
expression: @definition,
|
|
23
|
-
isFunction: true,
|
|
24
|
-
arg: @serialized_arg,
|
|
25
|
-
)
|
|
26
|
-
::Playwright::ChannelOwner.from(resp)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def eval_on_selector(channel, selector)
|
|
30
|
-
value = channel.send_message_to_server(
|
|
31
|
-
'evalOnSelector',
|
|
32
|
-
selector: selector,
|
|
33
|
-
expression: @definition,
|
|
34
|
-
isFunction: true,
|
|
35
|
-
arg: @serialized_arg,
|
|
36
|
-
)
|
|
37
|
-
ValueParser.new(value).parse
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def eval_on_selector_all(channel, selector)
|
|
41
|
-
value = channel.send_message_to_server(
|
|
42
|
-
'evalOnSelectorAll',
|
|
43
|
-
selector: selector,
|
|
44
|
-
expression: @definition,
|
|
45
|
-
isFunction: true,
|
|
46
|
-
arg: @serialized_arg,
|
|
47
|
-
)
|
|
48
|
-
ValueParser.new(value).parse
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def wait_for_function(channel, polling:, timeout:)
|
|
52
|
-
params = {
|
|
53
|
-
expression: @definition,
|
|
54
|
-
isFunction: true,
|
|
55
|
-
arg: @serialized_arg,
|
|
56
|
-
polling: polling,
|
|
57
|
-
timeout: timeout,
|
|
58
|
-
}.compact
|
|
59
|
-
if polling.is_a?(Numeric)
|
|
60
|
-
params[:pollingInterval] = polling
|
|
61
|
-
end
|
|
62
|
-
resp = channel.send_message_to_server('waitForFunction', params)
|
|
63
|
-
ChannelOwners::JSHandle.from(resp)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|