playwright-ruby-client 0.6.0 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +188 -0
- data/documentation/docs/api/browser_context.md +397 -0
- data/documentation/docs/api/browser_type.md +158 -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 +26 -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 +79 -0
- data/documentation/docs/api/selectors.md +23 -0
- data/documentation/docs/api/touchscreen.md +8 -0
- data/documentation/docs/api/tracing.md +47 -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 +205 -0
- data/documentation/docs/article/guides/recording_video.md +79 -0
- data/{docs → documentation/docs/include}/api_coverage.md +4 -3
- 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 +8785 -0
- data/lib/playwright/channel_owners/binding_call.rb +33 -0
- data/lib/playwright/channel_owners/browser.rb +15 -27
- data/lib/playwright/channel_owners/browser_context.rb +15 -7
- data/lib/playwright/channel_owners/browser_type.rb +23 -8
- data/lib/playwright/channel_owners/element_handle.rb +2 -10
- data/lib/playwright/channel_owners/frame.rb +6 -28
- data/lib/playwright/channel_owners/js_handle.rb +2 -10
- data/lib/playwright/channel_owners/page.rb +18 -8
- data/lib/playwright/channel_owners/worker.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 +9 -9
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright_api/accessibility.rb +7 -89
- data/lib/playwright_api/android.rb +10 -66
- data/lib/playwright_api/android_device.rb +10 -9
- data/lib/playwright_api/browser.rb +21 -172
- data/lib/playwright_api/browser_context.rb +54 -617
- data/lib/playwright_api/browser_type.rb +20 -108
- data/lib/playwright_api/cdp_session.rb +2 -25
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +11 -92
- data/lib/playwright_api/element_handle.rb +60 -362
- data/lib/playwright_api/file_chooser.rb +0 -28
- data/lib/playwright_api/frame.rb +74 -713
- data/lib/playwright_api/js_handle.rb +16 -90
- data/lib/playwright_api/keyboard.rb +21 -213
- data/lib/playwright_api/mouse.rb +1 -45
- data/lib/playwright_api/page.rb +181 -1647
- data/lib/playwright_api/playwright.rb +14 -117
- data/lib/playwright_api/request.rb +15 -121
- data/lib/playwright_api/response.rb +7 -7
- data/lib/playwright_api/route.rb +8 -105
- data/lib/playwright_api/selectors.rb +6 -97
- data/lib/playwright_api/tracing.rb +7 -73
- data/lib/playwright_api/web_socket.rb +1 -1
- data/lib/playwright_api/worker.rb +28 -42
- metadata +57 -4
- data/lib/playwright/javascript/function.rb +0 -67
@@ -4,111 +4,14 @@ module Playwright
|
|
4
4
|
class Selectors < PlaywrightApi
|
5
5
|
|
6
6
|
# An example of registering selector engine that queries elements based on a tag name:
|
7
|
-
#
|
8
7
|
#
|
9
|
-
# ```js
|
10
|
-
# const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'.
|
11
|
-
#
|
12
|
-
# (async () => {
|
13
|
-
# // Must be a function that evaluates to a selector engine instance.
|
14
|
-
# const createTagNameEngine = () => ({
|
15
|
-
# // Returns the first element matching given selector in the root's subtree.
|
16
|
-
# query(root, selector) {
|
17
|
-
# return root.querySelector(selector);
|
18
|
-
# },
|
19
|
-
#
|
20
|
-
# // Returns all elements matching given selector in the root's subtree.
|
21
|
-
# queryAll(root, selector) {
|
22
|
-
# return Array.from(root.querySelectorAll(selector));
|
23
|
-
# }
|
24
|
-
# });
|
25
|
-
#
|
26
|
-
# // Register the engine. Selectors will be prefixed with "tag=".
|
27
|
-
# await selectors.register('tag', createTagNameEngine);
|
28
|
-
#
|
29
|
-
# const browser = await firefox.launch();
|
30
|
-
# const page = await browser.newPage();
|
31
|
-
# await page.setContent(`<div><button>Click me</button></div>`);
|
32
|
-
#
|
33
|
-
# // Use the selector prefixed with its name.
|
34
|
-
# const button = await page.$('tag=button');
|
35
|
-
# // Combine it with other selector engines.
|
36
|
-
# await page.click('tag=div >> text="Click me"');
|
37
|
-
# // Can use it in any methods supporting selectors.
|
38
|
-
# const buttonCount = await page.$$eval('tag=button', buttons => buttons.length);
|
39
|
-
#
|
40
|
-
# await browser.close();
|
41
|
-
# })();
|
42
|
-
# ```
|
43
|
-
#
|
44
|
-
# ```java
|
45
|
-
# // Script that evaluates to a selector engine instance.
|
46
|
-
# String createTagNameEngine = "{\n" +
|
47
|
-
# " // Returns the first element matching given selector in the root's subtree.\n" +
|
48
|
-
# " query(root, selector) {\n" +
|
49
|
-
# " return root.querySelector(selector);\n" +
|
50
|
-
# " },\n" +
|
51
|
-
# " // Returns all elements matching given selector in the root's subtree.\n" +
|
52
|
-
# " queryAll(root, selector) {\n" +
|
53
|
-
# " return Array.from(root.querySelectorAll(selector));\n" +
|
54
|
-
# " }\n" +
|
55
|
-
# "}";
|
56
|
-
# // Register the engine. Selectors will be prefixed with "tag=".
|
57
|
-
# playwright.selectors().register("tag", createTagNameEngine);
|
58
|
-
# Browser browser = playwright.firefox().launch();
|
59
|
-
# Page page = browser.newPage();
|
60
|
-
# page.setContent("<div><button>Click me</button></div>");
|
61
|
-
# // Use the selector prefixed with its name.
|
62
|
-
# ElementHandle button = page.querySelector("tag=button");
|
63
|
-
# // Combine it with other selector engines.
|
64
|
-
# page.click("tag=div >> text=\"Click me\"");
|
65
|
-
# // Can use it in any methods supporting selectors.
|
66
|
-
# int buttonCount = (int) page.evalOnSelectorAll("tag=button", "buttons => buttons.length");
|
67
|
-
# browser.close();
|
68
|
-
# ```
|
69
|
-
#
|
70
|
-
# ```python async
|
71
|
-
# # FIXME: add snippet
|
72
|
-
# ```
|
73
|
-
#
|
74
8
|
# ```python sync
|
75
9
|
# # FIXME: add snippet
|
76
10
|
# ```
|
77
|
-
#
|
78
|
-
# ```csharp
|
79
|
-
# using var playwright = await Playwright.CreateAsync();
|
80
|
-
# // Script that evaluates to a selector engine instance.
|
81
|
-
# await playwright.Selectors.RegisterAsync("tag", @"{
|
82
|
-
# // Returns the first element matching given selector in the root's subtree.
|
83
|
-
# query(root, selector) {
|
84
|
-
# return root.querySelector(selector);
|
85
|
-
# },
|
86
|
-
# // Returns all elements matching given selector in the root's subtree.
|
87
|
-
# queryAll(root, selector) {
|
88
|
-
# return Array.from(root.querySelectorAll(selector));
|
89
|
-
# }
|
90
|
-
# }");
|
91
|
-
#
|
92
|
-
# await using var browser = await playwright.Chromium.LaunchAsync();
|
93
|
-
# var page = await browser.NewPageAsync();
|
94
|
-
# await page.SetContentAsync("<div><button>Click me</button></div>");
|
95
|
-
# // Use the selector prefixed with its name.
|
96
|
-
# var button = await page.QuerySelectorAsync("tag=button");
|
97
|
-
# // Combine it with other selector engines.
|
98
|
-
# await page.ClickAsync("tag=div >> text=\"Click me\"");
|
99
|
-
# // Can use it in any methods supporting selectors.
|
100
|
-
# int buttonCount = await page.EvalOnSelectorAllAsync<int>("tag=button", "buttons => buttons.length");
|
101
|
-
# ```
|
102
11
|
def register(name, contentScript: nil, path: nil, script: nil)
|
103
12
|
wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
|
104
13
|
end
|
105
14
|
|
106
|
-
# -- inherited from EventEmitter --
|
107
|
-
# @nodoc
|
108
|
-
def off(event, callback)
|
109
|
-
event_emitter_proxy.off(event, callback)
|
110
|
-
end
|
111
|
-
|
112
15
|
# -- inherited from EventEmitter --
|
113
16
|
# @nodoc
|
114
17
|
def once(event, callback)
|
@@ -121,6 +24,12 @@ module Playwright
|
|
121
24
|
event_emitter_proxy.on(event, callback)
|
122
25
|
end
|
123
26
|
|
27
|
+
# -- inherited from EventEmitter --
|
28
|
+
# @nodoc
|
29
|
+
def off(event, callback)
|
30
|
+
event_emitter_proxy.off(event, callback)
|
31
|
+
end
|
32
|
+
|
124
33
|
private def event_emitter_proxy
|
125
34
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
126
35
|
end
|
@@ -1,99 +1,33 @@
|
|
1
1
|
module Playwright
|
2
2
|
# API for collecting and saving Playwright traces. Playwright traces can be opened using the Playwright CLI after
|
3
3
|
# Playwright script runs.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Start with specifying the folder traces will be stored in:
|
6
|
-
#
|
7
6
|
#
|
8
|
-
# ```js
|
9
|
-
# const browser = await chromium.launch({ traceDir: 'traces' });
|
10
|
-
# const context = await browser.newContext();
|
11
|
-
# await context.tracing.start({ name: 'trace', screenshots: true, snapshots: true });
|
12
|
-
# const page = await context.newPage();
|
13
|
-
# await page.goto('https://playwright.dev');
|
14
|
-
# await context.tracing.stop();
|
15
|
-
# await context.tracing.export('trace.zip');
|
16
|
-
# ```
|
17
|
-
#
|
18
|
-
# ```java
|
19
|
-
# Browser browser = chromium.launch(new BrowserType.LaunchOptions().setTraceDir("trace"));
|
20
|
-
# BrowserContext context = browser.newContext();
|
21
|
-
# context.tracing.start(page, new Tracing.StartOptions()
|
22
|
-
# .setName("trace")
|
23
|
-
# .setScreenshots(true)
|
24
|
-
# .setSnapshots(true);
|
25
|
-
# Page page = context.newPage();
|
26
|
-
# page.goto("https://playwright.dev");
|
27
|
-
# context.tracing.stop();
|
28
|
-
# context.tracing.export(Paths.get("trace.zip")))
|
29
|
-
# ```
|
30
|
-
#
|
31
|
-
# ```python async
|
32
|
-
# browser = await chromium.launch(traceDir='traces')
|
33
|
-
# context = await browser.new_context()
|
34
|
-
# await context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
35
|
-
# await page.goto("https://playwright.dev")
|
36
|
-
# await context.tracing.stop()
|
37
|
-
# await context.tracing.export("trace.zip")
|
38
|
-
# ```
|
39
|
-
#
|
40
7
|
# ```python sync
|
41
|
-
# browser = chromium.launch(
|
8
|
+
# browser = chromium.launch()
|
42
9
|
# context = browser.new_context()
|
43
|
-
# context.tracing.start(
|
10
|
+
# context.tracing.start(screenshots=True, snapshots=True)
|
44
11
|
# page.goto("https://playwright.dev")
|
45
|
-
# context.tracing.stop()
|
46
|
-
# context.tracing.export("trace.zip")
|
12
|
+
# context.tracing.stop(path = "trace.zip")
|
47
13
|
# ```
|
48
14
|
class Tracing < PlaywrightApi
|
49
15
|
|
50
|
-
# Export trace into the file with the given name. Should be called after the tracing has stopped.
|
51
|
-
def export(path)
|
52
|
-
wrap_impl(@impl.export(unwrap_impl(path)))
|
53
|
-
end
|
54
|
-
|
55
16
|
# Start tracing.
|
56
|
-
#
|
57
17
|
#
|
58
|
-
# ```js
|
59
|
-
# await context.tracing.start({ name: 'trace', screenshots: true, snapshots: true });
|
60
|
-
# const page = await context.newPage();
|
61
|
-
# await page.goto('https://playwright.dev');
|
62
|
-
# await context.tracing.stop();
|
63
|
-
# await context.tracing.export('trace.zip');
|
64
|
-
# ```
|
65
|
-
#
|
66
|
-
# ```java
|
67
|
-
# context.tracing.start(page, new Tracing.StartOptions()
|
68
|
-
# .setName("trace")
|
69
|
-
# .setScreenshots(true)
|
70
|
-
# .setSnapshots(true);
|
71
|
-
# Page page = context.newPage();
|
72
|
-
# page.goto('https://playwright.dev');
|
73
|
-
# context.tracing.stop();
|
74
|
-
# context.tracing.export(Paths.get("trace.zip")))
|
75
|
-
# ```
|
76
|
-
#
|
77
|
-
# ```python async
|
78
|
-
# await context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
79
|
-
# await page.goto("https://playwright.dev")
|
80
|
-
# await context.tracing.stop()
|
81
|
-
# await context.tracing.export("trace.zip")
|
82
|
-
# ```
|
83
|
-
#
|
84
18
|
# ```python sync
|
85
19
|
# context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
86
20
|
# page.goto("https://playwright.dev")
|
87
21
|
# context.tracing.stop()
|
88
|
-
# context.tracing.
|
22
|
+
# context.tracing.stop(path = "trace.zip")
|
89
23
|
# ```
|
90
24
|
def start(name: nil, screenshots: nil, snapshots: nil)
|
91
25
|
wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots)))
|
92
26
|
end
|
93
27
|
|
94
28
|
# Stop tracing.
|
95
|
-
def stop
|
96
|
-
wrap_impl(@impl.stop)
|
29
|
+
def stop(path: nil)
|
30
|
+
wrap_impl(@impl.stop(path: unwrap_impl(path)))
|
97
31
|
end
|
98
32
|
end
|
99
33
|
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
|
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.6.
|
4
|
+
version: 0.6.5
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -193,7 +193,60 @@ files:
|
|
193
193
|
- Rakefile
|
194
194
|
- bin/console
|
195
195
|
- bin/setup
|
196
|
-
-
|
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/article/guides/recording_video.md
|
234
|
+
- documentation/docs/include/api_coverage.md
|
235
|
+
- documentation/docusaurus.config.js
|
236
|
+
- documentation/package.json
|
237
|
+
- documentation/sidebars.js
|
238
|
+
- documentation/src/components/HomepageFeatures.js
|
239
|
+
- documentation/src/components/HomepageFeatures.module.css
|
240
|
+
- documentation/src/css/custom.css
|
241
|
+
- documentation/src/pages/index.js
|
242
|
+
- documentation/src/pages/index.module.css
|
243
|
+
- documentation/src/pages/markdown-page.md
|
244
|
+
- documentation/static/.nojekyll
|
245
|
+
- documentation/static/img/playwright-logo.svg
|
246
|
+
- documentation/static/img/undraw_dropdown_menu.svg
|
247
|
+
- documentation/static/img/undraw_web_development.svg
|
248
|
+
- documentation/static/img/undraw_windows.svg
|
249
|
+
- documentation/yarn.lock
|
197
250
|
- lib/playwright.rb
|
198
251
|
- lib/playwright/android_input_impl.rb
|
199
252
|
- lib/playwright/api_implementation.rb
|
@@ -219,6 +272,7 @@ files:
|
|
219
272
|
- lib/playwright/channel_owners/route.rb
|
220
273
|
- lib/playwright/channel_owners/selectors.rb
|
221
274
|
- lib/playwright/channel_owners/stream.rb
|
275
|
+
- lib/playwright/channel_owners/worker.rb
|
222
276
|
- lib/playwright/connection.rb
|
223
277
|
- lib/playwright/download.rb
|
224
278
|
- lib/playwright/errors.rb
|
@@ -230,7 +284,6 @@ files:
|
|
230
284
|
- lib/playwright/input_files.rb
|
231
285
|
- lib/playwright/javascript.rb
|
232
286
|
- lib/playwright/javascript/expression.rb
|
233
|
-
- lib/playwright/javascript/function.rb
|
234
287
|
- lib/playwright/javascript/value_parser.rb
|
235
288
|
- lib/playwright/javascript/value_serializer.rb
|
236
289
|
- lib/playwright/keyboard_impl.rb
|
@@ -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
|