playwright-ruby-client 0.5.7 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/documentation/README.md +33 -0
  4. data/documentation/babel.config.js +3 -0
  5. data/documentation/docs/api/accessibility.md +7 -0
  6. data/documentation/docs/api/browser.md +185 -0
  7. data/documentation/docs/api/browser_context.md +398 -0
  8. data/documentation/docs/api/browser_type.md +105 -0
  9. data/documentation/docs/api/cdp_session.md +7 -0
  10. data/documentation/docs/api/console_message.md +41 -0
  11. data/documentation/docs/api/dialog.md +74 -0
  12. data/documentation/docs/api/element_handle.md +640 -0
  13. data/documentation/docs/api/experimental/_category_.yml +3 -0
  14. data/documentation/docs/api/experimental/android.md +25 -0
  15. data/documentation/docs/api/experimental/android_device.md +91 -0
  16. data/documentation/docs/api/experimental/android_input.md +38 -0
  17. data/documentation/docs/api/experimental/android_socket.md +7 -0
  18. data/documentation/docs/api/experimental/android_web_view.md +7 -0
  19. data/documentation/docs/api/file_chooser.md +51 -0
  20. data/documentation/docs/api/frame.md +867 -0
  21. data/documentation/docs/api/js_handle.md +116 -0
  22. data/documentation/docs/api/keyboard.md +157 -0
  23. data/documentation/docs/api/mouse.md +69 -0
  24. data/documentation/docs/api/page.md +1469 -0
  25. data/documentation/docs/api/playwright.md +63 -0
  26. data/documentation/docs/api/request.md +188 -0
  27. data/documentation/docs/api/response.md +97 -0
  28. data/documentation/docs/api/route.md +80 -0
  29. data/documentation/docs/api/selectors.md +23 -0
  30. data/documentation/docs/api/touchscreen.md +8 -0
  31. data/documentation/docs/api/tracing.md +54 -0
  32. data/documentation/docs/api/web_socket.md +7 -0
  33. data/documentation/docs/api/worker.md +7 -0
  34. data/documentation/docs/article/api_coverage.mdx +11 -0
  35. data/documentation/docs/article/getting_started.md +152 -0
  36. data/documentation/docs/article/guides/_category_.yml +3 -0
  37. data/documentation/docs/article/guides/download_playwright_driver.md +49 -0
  38. data/documentation/docs/article/guides/launch_browser.md +119 -0
  39. data/documentation/docs/article/guides/rails_integration.md +51 -0
  40. data/{docs → documentation/docs/include}/api_coverage.md +10 -1
  41. data/documentation/docusaurus.config.js +107 -0
  42. data/documentation/package.json +39 -0
  43. data/documentation/sidebars.js +15 -0
  44. data/documentation/src/components/HomepageFeatures.js +61 -0
  45. data/documentation/src/components/HomepageFeatures.module.css +13 -0
  46. data/documentation/src/css/custom.css +44 -0
  47. data/documentation/src/pages/index.js +50 -0
  48. data/documentation/src/pages/index.module.css +41 -0
  49. data/documentation/src/pages/markdown-page.md +7 -0
  50. data/documentation/static/.nojekyll +0 -0
  51. data/documentation/static/img/playwright-logo.svg +9 -0
  52. data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
  53. data/documentation/static/img/undraw_web_development.svg +1 -0
  54. data/documentation/static/img/undraw_windows.svg +1 -0
  55. data/documentation/yarn.lock +8805 -0
  56. data/lib/playwright/channel_owner.rb +3 -0
  57. data/lib/playwright/channel_owners/binding_call.rb +33 -0
  58. data/lib/playwright/channel_owners/browser.rb +27 -2
  59. data/lib/playwright/channel_owners/browser_context.rb +54 -3
  60. data/lib/playwright/channel_owners/browser_type.rb +8 -1
  61. data/lib/playwright/channel_owners/element_handle.rb +17 -16
  62. data/lib/playwright/channel_owners/frame.rb +29 -34
  63. data/lib/playwright/channel_owners/js_handle.rb +2 -10
  64. data/lib/playwright/channel_owners/page.rb +29 -45
  65. data/lib/playwright/download.rb +3 -2
  66. data/lib/playwright/events.rb +4 -0
  67. data/lib/playwright/input_files.rb +0 -8
  68. data/lib/playwright/javascript.rb +0 -10
  69. data/lib/playwright/javascript/expression.rb +2 -7
  70. data/lib/playwright/playwright_api.rb +1 -5
  71. data/lib/playwright/tracing_impl.rb +31 -0
  72. data/lib/playwright/version.rb +2 -1
  73. data/lib/playwright_api/accessibility.rb +7 -88
  74. data/lib/playwright_api/android.rb +8 -65
  75. data/lib/playwright_api/android_device.rb +8 -8
  76. data/lib/playwright_api/browser.rb +15 -126
  77. data/lib/playwright_api/browser_context.rb +63 -429
  78. data/lib/playwright_api/browser_type.rb +33 -84
  79. data/lib/playwright_api/cdp_session.rb +2 -25
  80. data/lib/playwright_api/console_message.rb +8 -6
  81. data/lib/playwright_api/dialog.rb +11 -69
  82. data/lib/playwright_api/element_handle.rb +102 -300
  83. data/lib/playwright_api/file_chooser.rb +0 -21
  84. data/lib/playwright_api/frame.rb +105 -571
  85. data/lib/playwright_api/js_handle.rb +16 -73
  86. data/lib/playwright_api/keyboard.rb +22 -166
  87. data/lib/playwright_api/mouse.rb +1 -45
  88. data/lib/playwright_api/page.rb +202 -1217
  89. data/lib/playwright_api/playwright.rb +14 -99
  90. data/lib/playwright_api/request.rb +15 -93
  91. data/lib/playwright_api/response.rb +7 -7
  92. data/lib/playwright_api/route.rb +9 -86
  93. data/lib/playwright_api/selectors.rb +6 -72
  94. data/lib/playwright_api/tracing.rb +39 -0
  95. data/lib/playwright_api/web_socket.rb +1 -1
  96. data/lib/playwright_api/worker.rb +6 -42
  97. data/playwright.gemspec +2 -2
  98. metadata +59 -20
  99. data/lib/playwright/javascript/function.rb +0 -67
@@ -4,73 +4,7 @@ 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
  # ```
@@ -78,12 +12,6 @@ module Playwright
78
12
  wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
79
13
  end
80
14
 
81
- # -- inherited from EventEmitter --
82
- # @nodoc
83
- def once(event, callback)
84
- event_emitter_proxy.once(event, callback)
85
- end
86
-
87
15
  # -- inherited from EventEmitter --
88
16
  # @nodoc
89
17
  def on(event, callback)
@@ -96,6 +24,12 @@ module Playwright
96
24
  event_emitter_proxy.off(event, callback)
97
25
  end
98
26
 
27
+ # -- inherited from EventEmitter --
28
+ # @nodoc
29
+ def once(event, callback)
30
+ event_emitter_proxy.once(event, callback)
31
+ end
32
+
99
33
  private def event_emitter_proxy
100
34
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
101
35
  end
@@ -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)
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 = 'The Ruby binding of playwright driver'
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.5.7
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-05-31 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
- - docs/api_coverage.md
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
@@ -244,7 +282,6 @@ files:
244
282
  - lib/playwright/input_files.rb
245
283
  - lib/playwright/javascript.rb
246
284
  - lib/playwright/javascript/expression.rb
247
- - lib/playwright/javascript/function.rb
248
285
  - lib/playwright/javascript/value_parser.rb
249
286
  - lib/playwright/javascript/value_serializer.rb
250
287
  - lib/playwright/keyboard_impl.rb
@@ -254,6 +291,7 @@ files:
254
291
  - lib/playwright/select_option_values.rb
255
292
  - lib/playwright/timeout_settings.rb
256
293
  - lib/playwright/touchscreen_impl.rb
294
+ - lib/playwright/tracing_impl.rb
257
295
  - lib/playwright/transport.rb
258
296
  - lib/playwright/url_matcher.rb
259
297
  - lib/playwright/utils.rb
@@ -285,6 +323,7 @@ files:
285
323
  - lib/playwright_api/route.rb
286
324
  - lib/playwright_api/selectors.rb
287
325
  - lib/playwright_api/touchscreen.rb
326
+ - lib/playwright_api/tracing.rb
288
327
  - lib/playwright_api/web_socket.rb
289
328
  - lib/playwright_api/worker.rb
290
329
  - playwright.gemspec
@@ -300,7 +339,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
339
  requirements:
301
340
  - - ">="
302
341
  - !ruby/object:Gem::Version
303
- version: '0'
342
+ version: '2.4'
304
343
  required_rubygems_version: !ruby/object:Gem::Requirement
305
344
  requirements:
306
345
  - - ">="
@@ -310,5 +349,5 @@ requirements: []
310
349
  rubygems_version: 3.2.15
311
350
  signing_key:
312
351
  specification_version: 4
313
- summary: The Ruby binding of playwright driver
352
+ summary: The Ruby binding of playwright driver 1.12.0
314
353
  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