playwright-ruby-client 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +114 -2
- data/docs/api_coverage.md +351 -0
- data/lib/playwright.rb +7 -1
- data/lib/playwright/android_input_impl.rb +23 -0
- data/lib/playwright/api_implementation.rb +18 -0
- data/lib/playwright/channel.rb +7 -0
- data/lib/playwright/channel_owner.rb +3 -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 +13 -13
- data/lib/playwright/channel_owners/browser_context.rb +9 -1
- data/lib/playwright/channel_owners/download.rb +27 -0
- data/lib/playwright/channel_owners/element_handle.rb +306 -0
- data/lib/playwright/channel_owners/frame.rb +371 -19
- data/lib/playwright/channel_owners/js_handle.rb +51 -0
- data/lib/playwright/channel_owners/page.rb +416 -19
- data/lib/playwright/channel_owners/request.rb +98 -0
- data/lib/playwright/channel_owners/webkit_browser.rb +1 -1
- data/lib/playwright/connection.rb +9 -6
- data/lib/playwright/errors.rb +2 -2
- data/lib/playwright/event_emitter.rb +8 -1
- data/lib/playwright/event_emitter_proxy.rb +49 -0
- data/lib/playwright/file_chooser_impl.rb +23 -0
- data/lib/playwright/http_headers.rb +20 -0
- data/lib/playwright/input_files.rb +42 -0
- data/lib/playwright/javascript/expression.rb +37 -0
- data/lib/playwright/javascript/function.rb +37 -0
- data/lib/playwright/javascript/value_parser.rb +1 -1
- data/lib/playwright/javascript/value_serializer.rb +11 -11
- data/lib/playwright/keyboard_impl.rb +36 -0
- data/lib/playwright/mouse_impl.rb +7 -0
- data/lib/playwright/playwright_api.rb +84 -29
- data/lib/playwright/select_option_values.rb +32 -0
- data/lib/playwright/timeout_settings.rb +2 -2
- data/lib/playwright/touchscreen_impl.rb +7 -0
- data/lib/playwright/url_matcher.rb +19 -0
- data/lib/playwright/utils.rb +18 -0
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright/wait_helper.rb +1 -1
- data/lib/playwright_api/accessibility.rb +46 -6
- data/lib/playwright_api/android.rb +37 -0
- data/lib/playwright_api/android_device.rb +82 -0
- data/lib/playwright_api/android_input.rb +25 -0
- data/lib/playwright_api/binding_call.rb +10 -6
- data/lib/playwright_api/browser.rb +85 -18
- data/lib/playwright_api/browser_context.rb +269 -37
- data/lib/playwright_api/browser_type.rb +60 -11
- data/lib/playwright_api/cdp_session.rb +23 -1
- data/lib/playwright_api/chromium_browser_context.rb +18 -6
- data/lib/playwright_api/console_message.rb +14 -15
- data/lib/playwright_api/dialog.rb +48 -2
- data/lib/playwright_api/download.rb +47 -10
- data/lib/playwright_api/element_handle.rb +269 -110
- data/lib/playwright_api/file_chooser.rb +23 -7
- data/lib/playwright_api/frame.rb +439 -154
- data/lib/playwright_api/js_handle.rb +69 -24
- data/lib/playwright_api/keyboard.rb +99 -9
- data/lib/playwright_api/mouse.rb +22 -0
- data/lib/playwright_api/page.rb +856 -229
- data/lib/playwright_api/playwright.rb +108 -20
- data/lib/playwright_api/request.rb +77 -29
- data/lib/playwright_api/response.rb +10 -13
- data/lib/playwright_api/route.rb +49 -0
- data/lib/playwright_api/selectors.rb +20 -8
- 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 +1 -0
- metadata +33 -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,26 +40,38 @@ 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
|
46
54
|
|
47
55
|
# -- inherited from EventEmitter --
|
48
56
|
# @nodoc
|
49
|
-
def
|
50
|
-
|
57
|
+
def once(event, callback)
|
58
|
+
event_emitter_proxy.once(event, callback)
|
51
59
|
end
|
52
60
|
|
53
61
|
# -- inherited from EventEmitter --
|
54
62
|
# @nodoc
|
55
|
-
def
|
56
|
-
|
63
|
+
def on(event, callback)
|
64
|
+
event_emitter_proxy.on(event, callback)
|
57
65
|
end
|
58
66
|
|
59
67
|
# -- inherited from EventEmitter --
|
60
68
|
# @nodoc
|
61
|
-
def
|
62
|
-
|
69
|
+
def off(event, callback)
|
70
|
+
event_emitter_proxy.off(event, callback)
|
71
|
+
end
|
72
|
+
|
73
|
+
private def event_emitter_proxy
|
74
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
63
75
|
end
|
64
76
|
end
|
65
77
|
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'
|
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.1.0
|
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-18 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
|
@@ -165,10 +179,14 @@ files:
|
|
165
179
|
- Rakefile
|
166
180
|
- bin/console
|
167
181
|
- bin/setup
|
182
|
+
- docs/api_coverage.md
|
168
183
|
- lib/playwright.rb
|
184
|
+
- lib/playwright/android_input_impl.rb
|
185
|
+
- lib/playwright/api_implementation.rb
|
169
186
|
- lib/playwright/channel.rb
|
170
187
|
- lib/playwright/channel_owner.rb
|
171
188
|
- lib/playwright/channel_owners/android.rb
|
189
|
+
- lib/playwright/channel_owners/android_device.rb
|
172
190
|
- lib/playwright/channel_owners/binding_call.rb
|
173
191
|
- lib/playwright/channel_owners/browser.rb
|
174
192
|
- lib/playwright/channel_owners/browser_context.rb
|
@@ -176,6 +194,7 @@ files:
|
|
176
194
|
- lib/playwright/channel_owners/chromium_browser.rb
|
177
195
|
- lib/playwright/channel_owners/chromium_browser_context.rb
|
178
196
|
- lib/playwright/channel_owners/console_message.rb
|
197
|
+
- lib/playwright/channel_owners/download.rb
|
179
198
|
- lib/playwright/channel_owners/electron.rb
|
180
199
|
- lib/playwright/channel_owners/element_handle.rb
|
181
200
|
- lib/playwright/channel_owners/firefox_browser.rb
|
@@ -190,19 +209,31 @@ files:
|
|
190
209
|
- lib/playwright/connection.rb
|
191
210
|
- lib/playwright/errors.rb
|
192
211
|
- lib/playwright/event_emitter.rb
|
212
|
+
- lib/playwright/event_emitter_proxy.rb
|
193
213
|
- lib/playwright/events.rb
|
214
|
+
- lib/playwright/file_chooser_impl.rb
|
215
|
+
- lib/playwright/http_headers.rb
|
216
|
+
- lib/playwright/input_files.rb
|
194
217
|
- lib/playwright/javascript.rb
|
195
218
|
- lib/playwright/javascript/expression.rb
|
196
219
|
- lib/playwright/javascript/function.rb
|
197
220
|
- lib/playwright/javascript/value_parser.rb
|
198
221
|
- lib/playwright/javascript/value_serializer.rb
|
222
|
+
- lib/playwright/keyboard_impl.rb
|
223
|
+
- lib/playwright/mouse_impl.rb
|
199
224
|
- lib/playwright/playwright_api.rb
|
225
|
+
- lib/playwright/select_option_values.rb
|
200
226
|
- lib/playwright/timeout_settings.rb
|
227
|
+
- lib/playwright/touchscreen_impl.rb
|
201
228
|
- lib/playwright/transport.rb
|
229
|
+
- lib/playwright/url_matcher.rb
|
202
230
|
- lib/playwright/utils.rb
|
203
231
|
- lib/playwright/version.rb
|
204
232
|
- lib/playwright/wait_helper.rb
|
205
233
|
- lib/playwright_api/accessibility.rb
|
234
|
+
- lib/playwright_api/android.rb
|
235
|
+
- lib/playwright_api/android_device.rb
|
236
|
+
- lib/playwright_api/android_input.rb
|
206
237
|
- lib/playwright_api/binding_call.rb
|
207
238
|
- lib/playwright_api/browser.rb
|
208
239
|
- lib/playwright_api/browser_context.rb
|