playwright-ruby-client 0.0.4 → 0.0.9
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 +120 -6
- data/docs/api_coverage.md +351 -0
- data/lib/playwright.rb +9 -0
- data/lib/playwright/channel_owner.rb +16 -2
- data/lib/playwright/channel_owners/android.rb +10 -1
- data/lib/playwright/channel_owners/android_device.rb +163 -0
- data/lib/playwright/channel_owners/browser.rb +20 -27
- data/lib/playwright/channel_owners/browser_context.rb +51 -0
- data/lib/playwright/channel_owners/console_message.rb +0 -4
- data/lib/playwright/channel_owners/element_handle.rb +306 -0
- data/lib/playwright/channel_owners/frame.rb +473 -7
- data/lib/playwright/channel_owners/js_handle.rb +51 -0
- data/lib/playwright/channel_owners/page.rb +589 -4
- data/lib/playwright/channel_owners/request.rb +98 -0
- data/lib/playwright/channel_owners/webkit_browser.rb +1 -1
- data/lib/playwright/connection.rb +15 -14
- data/lib/playwright/errors.rb +1 -1
- data/lib/playwright/event_emitter.rb +17 -1
- data/lib/playwright/http_headers.rb +20 -0
- data/lib/playwright/input_files.rb +42 -0
- data/lib/playwright/input_type.rb +19 -0
- data/lib/playwright/input_types/android_input.rb +19 -0
- data/lib/playwright/input_types/keyboard.rb +32 -0
- data/lib/playwright/input_types/mouse.rb +4 -0
- data/lib/playwright/input_types/touchscreen.rb +4 -0
- data/lib/playwright/javascript.rb +13 -0
- data/lib/playwright/javascript/expression.rb +67 -0
- data/lib/playwright/javascript/function.rb +67 -0
- data/lib/playwright/javascript/value_parser.rb +75 -0
- data/lib/playwright/javascript/value_serializer.rb +54 -0
- data/lib/playwright/playwright_api.rb +45 -25
- data/lib/playwright/select_option_values.rb +32 -0
- data/lib/playwright/timeout_settings.rb +19 -0
- data/lib/playwright/url_matcher.rb +19 -0
- data/lib/playwright/utils.rb +37 -0
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright/wait_helper.rb +73 -0
- data/lib/playwright_api/accessibility.rb +46 -6
- data/lib/playwright_api/android.rb +33 -0
- data/lib/playwright_api/android_device.rb +78 -0
- data/lib/playwright_api/android_input.rb +25 -0
- data/lib/playwright_api/binding_call.rb +18 -0
- data/lib/playwright_api/browser.rb +93 -12
- data/lib/playwright_api/browser_context.rb +279 -28
- data/lib/playwright_api/browser_type.rb +68 -5
- data/lib/playwright_api/cdp_session.rb +23 -1
- data/lib/playwright_api/chromium_browser_context.rb +26 -0
- data/lib/playwright_api/console_message.rb +20 -7
- data/lib/playwright_api/dialog.rb +48 -2
- data/lib/playwright_api/download.rb +19 -4
- data/lib/playwright_api/element_handle.rb +278 -104
- data/lib/playwright_api/file_chooser.rb +20 -3
- data/lib/playwright_api/frame.rb +452 -147
- data/lib/playwright_api/js_handle.rb +78 -19
- data/lib/playwright_api/keyboard.rb +99 -9
- data/lib/playwright_api/mouse.rb +22 -0
- data/lib/playwright_api/page.rb +864 -222
- data/lib/playwright_api/playwright.rb +116 -14
- data/lib/playwright_api/request.rb +86 -24
- data/lib/playwright_api/response.rb +18 -7
- data/lib/playwright_api/route.rb +49 -0
- data/lib/playwright_api/selectors.rb +28 -2
- data/lib/playwright_api/video.rb +8 -0
- data/lib/playwright_api/web_socket.rb +0 -8
- data/lib/playwright_api/worker.rb +25 -13
- data/playwright.gemspec +3 -0
- metadata +66 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
module Playwright
|
2
|
-
# Selectors can be used to install custom selector engines. See
|
3
|
-
#
|
2
|
+
# Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more
|
3
|
+
# information.
|
4
4
|
class Selectors < PlaywrightApi
|
5
5
|
|
6
6
|
# An example of registering selector engine that queries elements based on a tag name:
|
@@ -40,8 +40,34 @@ module Playwright
|
|
40
40
|
# await browser.close();
|
41
41
|
# })();
|
42
42
|
# ```
|
43
|
+
#
|
44
|
+
# ```python async
|
45
|
+
# # FIXME: add snippet
|
46
|
+
# ```
|
47
|
+
#
|
48
|
+
# ```python sync
|
49
|
+
# # FIXME: add snippet
|
50
|
+
# ```
|
43
51
|
def register(name, script, contentScript: nil)
|
44
52
|
raise NotImplementedError.new('register is not implemented yet.')
|
45
53
|
end
|
54
|
+
|
55
|
+
# -- inherited from EventEmitter --
|
56
|
+
# @nodoc
|
57
|
+
def on(event, callback)
|
58
|
+
wrap_impl(@impl.on(unwrap_impl(event), unwrap_impl(callback)))
|
59
|
+
end
|
60
|
+
|
61
|
+
# -- inherited from EventEmitter --
|
62
|
+
# @nodoc
|
63
|
+
def off(event, callback)
|
64
|
+
wrap_impl(@impl.off(unwrap_impl(event), unwrap_impl(callback)))
|
65
|
+
end
|
66
|
+
|
67
|
+
# -- inherited from EventEmitter --
|
68
|
+
# @nodoc
|
69
|
+
def once(event, callback)
|
70
|
+
wrap_impl(@impl.once(unwrap_impl(event), unwrap_impl(callback)))
|
71
|
+
end
|
46
72
|
end
|
47
73
|
end
|
data/lib/playwright_api/video.rb
CHANGED
@@ -5,6 +5,14 @@ module Playwright
|
|
5
5
|
# ```js
|
6
6
|
# console.log(await page.video().path());
|
7
7
|
# ```
|
8
|
+
#
|
9
|
+
# ```python async
|
10
|
+
# print(await page.video.path())
|
11
|
+
# ```
|
12
|
+
#
|
13
|
+
# ```python sync
|
14
|
+
# print(page.video.path())
|
15
|
+
# ```
|
8
16
|
class Video < PlaywrightApi
|
9
17
|
|
10
18
|
# Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem
|
@@ -11,13 +11,5 @@ module Playwright
|
|
11
11
|
def url
|
12
12
|
raise NotImplementedError.new('url is not implemented yet.')
|
13
13
|
end
|
14
|
-
|
15
|
-
# Returns the event data value.
|
16
|
-
#
|
17
|
-
# Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
|
18
|
-
# value. Will throw an error if the webSocket is closed before the event is fired.
|
19
|
-
def wait_for_event(event, optionsOrPredicate: nil)
|
20
|
-
raise NotImplementedError.new('wait_for_event is not implemented yet.')
|
21
|
-
end
|
22
14
|
end
|
23
15
|
end
|
@@ -14,28 +14,40 @@ module Playwright
|
|
14
14
|
# for (const worker of page.workers())
|
15
15
|
# console.log(' ' + worker.url());
|
16
16
|
# ```
|
17
|
+
#
|
18
|
+
# ```py
|
19
|
+
# def handle_worker(worker):
|
20
|
+
# print("worker created: " + worker.url)
|
21
|
+
# worker.on("close", lambda: print("worker destroyed: " + worker.url))
|
22
|
+
#
|
23
|
+
# page.on('worker', handle_worker)
|
24
|
+
#
|
25
|
+
# print("current workers:")
|
26
|
+
# for worker in page.workers:
|
27
|
+
# print(" " + worker.url)
|
28
|
+
# ```
|
17
29
|
class Worker < PlaywrightApi
|
18
30
|
|
19
|
-
# Returns the return value of `
|
31
|
+
# Returns the return value of `expression`.
|
20
32
|
#
|
21
|
-
# If the function passed to the `
|
22
|
-
# to resolve and return its value.
|
33
|
+
# If the function passed to the [`method: Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate`] would
|
34
|
+
# wait for the promise to resolve and return its value.
|
23
35
|
#
|
24
|
-
# If the function passed to the `
|
25
|
-
# `undefined`.
|
26
|
-
# `-0`, `NaN`, `Infinity`, `-Infinity
|
27
|
-
def evaluate(
|
36
|
+
# If the function passed to the [`method: Worker.evaluate`] returns a non-[Serializable] value, then
|
37
|
+
# [`method: Worker.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are
|
38
|
+
# not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
|
39
|
+
def evaluate(expression, arg: nil)
|
28
40
|
raise NotImplementedError.new('evaluate is not implemented yet.')
|
29
41
|
end
|
30
42
|
|
31
|
-
# Returns the return value of `
|
43
|
+
# Returns the return value of `expression` as a `JSHandle`.
|
32
44
|
#
|
33
|
-
# The only difference between `
|
34
|
-
#
|
45
|
+
# The only difference between [`method: Worker.evaluate`] and [`method: Worker.evaluateHandle`] is that
|
46
|
+
# [`method: Worker.evaluateHandle`] returns `JSHandle`.
|
35
47
|
#
|
36
|
-
# If the function passed to the `
|
37
|
-
# the promise to resolve and return its value.
|
38
|
-
def evaluate_handle(
|
48
|
+
# If the function passed to the [`method: Worker.evaluateHandle`] returns a [Promise], then
|
49
|
+
# [`method: Worker.evaluateHandle`] would wait for the promise to resolve and return its value.
|
50
|
+
def evaluate_handle(expression, arg: nil)
|
39
51
|
raise NotImplementedError.new('evaluate_handle is not implemented yet.')
|
40
52
|
end
|
41
53
|
|
data/playwright.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
27
|
spec.add_dependency 'concurrent-ruby'
|
28
|
+
spec.add_dependency 'mime-types', '>= 3.0'
|
28
29
|
spec.add_development_dependency 'bundler', '~> 2.2.3'
|
29
30
|
spec.add_development_dependency 'dry-inflector'
|
30
31
|
spec.add_development_dependency 'pry-byebug'
|
@@ -32,4 +33,6 @@ Gem::Specification.new do |spec|
|
|
32
33
|
spec.add_development_dependency 'rspec', '~> 3.10.0 '
|
33
34
|
spec.add_development_dependency 'rubocop', '~> 1.7.0'
|
34
35
|
spec.add_development_dependency 'rubocop-rspec'
|
36
|
+
spec.add_development_dependency 'sinatra'
|
37
|
+
spec.add_development_dependency 'webrick'
|
35
38
|
end
|
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.0.
|
4
|
+
version: 0.0.9
|
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-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mime-types
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,34 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sinatra
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: webrick
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
125
167
|
description:
|
126
168
|
email:
|
127
169
|
- q7w8e9w8q7w8e9@yahoo.co.jp
|
@@ -137,10 +179,12 @@ files:
|
|
137
179
|
- Rakefile
|
138
180
|
- bin/console
|
139
181
|
- bin/setup
|
182
|
+
- docs/api_coverage.md
|
140
183
|
- lib/playwright.rb
|
141
184
|
- lib/playwright/channel.rb
|
142
185
|
- lib/playwright/channel_owner.rb
|
143
186
|
- lib/playwright/channel_owners/android.rb
|
187
|
+
- lib/playwright/channel_owners/android_device.rb
|
144
188
|
- lib/playwright/channel_owners/binding_call.rb
|
145
189
|
- lib/playwright/channel_owners/browser.rb
|
146
190
|
- lib/playwright/channel_owners/browser_context.rb
|
@@ -163,10 +207,30 @@ files:
|
|
163
207
|
- lib/playwright/errors.rb
|
164
208
|
- lib/playwright/event_emitter.rb
|
165
209
|
- lib/playwright/events.rb
|
210
|
+
- lib/playwright/http_headers.rb
|
211
|
+
- lib/playwright/input_files.rb
|
212
|
+
- lib/playwright/input_type.rb
|
213
|
+
- lib/playwright/input_types/android_input.rb
|
214
|
+
- lib/playwright/input_types/keyboard.rb
|
215
|
+
- lib/playwright/input_types/mouse.rb
|
216
|
+
- lib/playwright/input_types/touchscreen.rb
|
217
|
+
- lib/playwright/javascript.rb
|
218
|
+
- lib/playwright/javascript/expression.rb
|
219
|
+
- lib/playwright/javascript/function.rb
|
220
|
+
- lib/playwright/javascript/value_parser.rb
|
221
|
+
- lib/playwright/javascript/value_serializer.rb
|
166
222
|
- lib/playwright/playwright_api.rb
|
223
|
+
- lib/playwright/select_option_values.rb
|
224
|
+
- lib/playwright/timeout_settings.rb
|
167
225
|
- lib/playwright/transport.rb
|
226
|
+
- lib/playwright/url_matcher.rb
|
227
|
+
- lib/playwright/utils.rb
|
168
228
|
- lib/playwright/version.rb
|
229
|
+
- lib/playwright/wait_helper.rb
|
169
230
|
- lib/playwright_api/accessibility.rb
|
231
|
+
- lib/playwright_api/android.rb
|
232
|
+
- lib/playwright_api/android_device.rb
|
233
|
+
- lib/playwright_api/android_input.rb
|
170
234
|
- lib/playwright_api/binding_call.rb
|
171
235
|
- lib/playwright_api/browser.rb
|
172
236
|
- lib/playwright_api/browser_context.rb
|