puppeteer-ruby 0.0.3 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +30 -0
  3. data/.github/stale.yml +16 -0
  4. data/.rubocop.yml +4 -5
  5. data/README.md +4 -1
  6. data/docs/Puppeteer.html +2020 -0
  7. data/docs/Puppeteer/AsyncAwaitBehavior.html +105 -0
  8. data/docs/Puppeteer/Browser.html +2148 -0
  9. data/docs/Puppeteer/BrowserContext.html +809 -0
  10. data/docs/Puppeteer/BrowserFetcher.html +214 -0
  11. data/docs/Puppeteer/BrowserRunner.html +914 -0
  12. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +477 -0
  13. data/docs/Puppeteer/CDPSession.html +813 -0
  14. data/docs/Puppeteer/CDPSession/Error.html +124 -0
  15. data/docs/Puppeteer/ConcurrentRubyUtils.html +430 -0
  16. data/docs/Puppeteer/Connection.html +960 -0
  17. data/docs/Puppeteer/Connection/MessageCallback.html +434 -0
  18. data/docs/Puppeteer/Connection/ProtocolError.html +216 -0
  19. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +217 -0
  20. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +244 -0
  21. data/docs/Puppeteer/ConsoleMessage.html +565 -0
  22. data/docs/Puppeteer/ConsoleMessage/Location.html +433 -0
  23. data/docs/Puppeteer/DOMWorld.html +2219 -0
  24. data/docs/Puppeteer/DOMWorld/DetachedError.html +124 -0
  25. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +124 -0
  26. data/docs/Puppeteer/DebugPrint.html +233 -0
  27. data/docs/Puppeteer/Device.html +470 -0
  28. data/docs/Puppeteer/Devices.html +139 -0
  29. data/docs/Puppeteer/ElementHandle.html +2224 -0
  30. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +206 -0
  31. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +206 -0
  32. data/docs/Puppeteer/ElementHandle/Point.html +481 -0
  33. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +124 -0
  34. data/docs/Puppeteer/EmulationManager.html +454 -0
  35. data/docs/Puppeteer/EventCallbackable.html +433 -0
  36. data/docs/Puppeteer/EventCallbackable/EventListeners.html +435 -0
  37. data/docs/Puppeteer/ExecutionContext.html +998 -0
  38. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +124 -0
  39. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +357 -0
  40. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +389 -0
  41. data/docs/Puppeteer/FileChooser.html +455 -0
  42. data/docs/Puppeteer/Frame.html +3677 -0
  43. data/docs/Puppeteer/FrameManager.html +2410 -0
  44. data/docs/Puppeteer/FrameManager/NavigationError.html +124 -0
  45. data/docs/Puppeteer/IfPresent.html +222 -0
  46. data/docs/Puppeteer/JSHandle.html +1352 -0
  47. data/docs/Puppeteer/Keyboard.html +1557 -0
  48. data/docs/Puppeteer/Keyboard/KeyDefinition.html +831 -0
  49. data/docs/Puppeteer/Keyboard/KeyDescription.html +603 -0
  50. data/docs/Puppeteer/Launcher.html +237 -0
  51. data/docs/Puppeteer/Launcher/Base.html +385 -0
  52. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +124 -0
  53. data/docs/Puppeteer/Launcher/BrowserOptions.html +441 -0
  54. data/docs/Puppeteer/Launcher/Chrome.html +669 -0
  55. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +382 -0
  56. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +531 -0
  57. data/docs/Puppeteer/Launcher/LaunchOptions.html +893 -0
  58. data/docs/Puppeteer/LifecycleWatcher.html +834 -0
  59. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +363 -0
  60. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +206 -0
  61. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +124 -0
  62. data/docs/Puppeteer/Mouse.html +1105 -0
  63. data/docs/Puppeteer/Mouse/Button.html +136 -0
  64. data/docs/Puppeteer/NetworkManager.html +901 -0
  65. data/docs/Puppeteer/NetworkManager/Credentials.html +385 -0
  66. data/docs/Puppeteer/Page.html +5970 -0
  67. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +206 -0
  68. data/docs/Puppeteer/Page/ScreenshotOptions.html +845 -0
  69. data/docs/Puppeteer/Page/ScriptTag.html +555 -0
  70. data/docs/Puppeteer/Page/StyleTag.html +448 -0
  71. data/docs/Puppeteer/Page/TargetCrashedError.html +124 -0
  72. data/docs/Puppeteer/RemoteObject.html +1016 -0
  73. data/docs/Puppeteer/Target.html +1314 -0
  74. data/docs/Puppeteer/Target/InitializeFailure.html +124 -0
  75. data/docs/Puppeteer/Target/TargetInfo.html +729 -0
  76. data/docs/Puppeteer/TimeoutError.html +135 -0
  77. data/docs/Puppeteer/TimeoutSettings.html +496 -0
  78. data/docs/Puppeteer/TouchScreen.html +464 -0
  79. data/docs/Puppeteer/Viewport.html +757 -0
  80. data/docs/Puppeteer/WaitTask.html +637 -0
  81. data/docs/Puppeteer/WaitTask/TerminatedError.html +124 -0
  82. data/docs/Puppeteer/WaitTask/TimeoutError.html +206 -0
  83. data/docs/Puppeteer/WebSocket.html +673 -0
  84. data/docs/Puppeteer/WebSocket/DriverImpl.html +412 -0
  85. data/docs/Puppeteer/WebSocketTransport.html +600 -0
  86. data/docs/Puppeteer/WebSocktTransportError.html +124 -0
  87. data/docs/_index.html +809 -0
  88. data/docs/class_list.html +51 -0
  89. data/docs/css/common.css +1 -0
  90. data/docs/css/full_list.css +58 -0
  91. data/docs/css/style.css +496 -0
  92. data/docs/file.README.html +123 -0
  93. data/docs/file_list.html +56 -0
  94. data/docs/frames.html +17 -0
  95. data/docs/index.html +123 -0
  96. data/docs/js/app.js +314 -0
  97. data/docs/js/full_list.js +216 -0
  98. data/docs/js/jquery.js +4 -0
  99. data/docs/method_list.html +3971 -0
  100. data/docs/top-level-namespace.html +126 -0
  101. data/lib/puppeteer.rb +16 -8
  102. data/lib/puppeteer/async_await_behavior.rb +6 -0
  103. data/lib/puppeteer/browser.rb +24 -5
  104. data/lib/puppeteer/browser_runner.rb +1 -1
  105. data/lib/puppeteer/cdp_session.rb +33 -11
  106. data/lib/puppeteer/connection.rb +1 -1
  107. data/lib/puppeteer/dom_world.rb +142 -121
  108. data/lib/puppeteer/element_handle.rb +223 -181
  109. data/lib/puppeteer/execution_context.rb +41 -17
  110. data/lib/puppeteer/file_chooser.rb +29 -0
  111. data/lib/puppeteer/frame.rb +23 -15
  112. data/lib/puppeteer/frame_manager.rb +7 -9
  113. data/lib/puppeteer/js_handle.rb +3 -3
  114. data/lib/puppeteer/keyboard.rb +1 -1
  115. data/lib/puppeteer/keyboard/us_keyboard_layout.rb +4 -4
  116. data/lib/puppeteer/launcher.rb +0 -1
  117. data/lib/puppeteer/launcher/chrome.rb +48 -2
  118. data/lib/puppeteer/lifecycle_watcher.rb +9 -4
  119. data/lib/puppeteer/mouse.rb +10 -7
  120. data/lib/puppeteer/page.rb +134 -70
  121. data/lib/puppeteer/remote_object.rb +11 -1
  122. data/lib/puppeteer/target.rb +16 -13
  123. data/lib/puppeteer/version.rb +1 -1
  124. data/lib/puppeteer/wait_task.rb +183 -1
  125. data/puppeteer-ruby.gemspec +4 -1
  126. metadata +143 -4
@@ -0,0 +1,139 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Puppeteer::Devices
8
+
9
+ &mdash; Documentation by YARD 0.9.24
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Puppeteer::Devices";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (D)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span>
41
+ &raquo;
42
+ <span class="title">Devices</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Puppeteer::Devices
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Puppeteer::Devices</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/puppeteer/devices.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Instead of Puppeteer::DEVICES[“iPhone X”], Puppeteer::DEVICES[“iPad Pro”],</p>
106
+ <ul><li>
107
+ <p>Puppeteer::Devices.iPhone_X</p>
108
+ </li><li>
109
+ <p>Puppeteer::Devices.iPad_Pro</p>
110
+ </li></ul>
111
+
112
+ <p>etc…</p>
113
+
114
+
115
+ </div>
116
+ </div>
117
+ <div class="tags">
118
+
119
+
120
+ </div>
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ </div>
130
+
131
+ <div id="footer">
132
+ Generated on Tue Jun 9 00:13:40 2020 by
133
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
+ 0.9.24 (ruby-2.6.3).
135
+ </div>
136
+
137
+ </div>
138
+ </body>
139
+ </html>
@@ -0,0 +1,2224 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Puppeteer::ElementHandle
8
+
9
+ &mdash; Documentation by YARD 0.9.24
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Puppeteer::ElementHandle";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (E)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span>
41
+ &raquo;
42
+ <span class="title">ElementHandle</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Puppeteer::ElementHandle
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></li>
78
+
79
+ <li class="next">Puppeteer::ElementHandle</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+ <dl>
93
+ <dt>Includes:</dt>
94
+ <dd><span class='object_link'><a href="IfPresent.html" title="Puppeteer::IfPresent (module)">IfPresent</a></span></dd>
95
+ </dl>
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <dl>
103
+ <dt>Defined in:</dt>
104
+ <dd>lib/puppeteer/element_handle.rb</dd>
105
+ </dl>
106
+
107
+ </div>
108
+
109
+ <h2>Defined Under Namespace</h2>
110
+ <p class="children">
111
+
112
+
113
+
114
+
115
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="ElementHandle/ElementNotFoundError.html" title="Puppeteer::ElementHandle::ElementNotFoundError (class)">ElementNotFoundError</a></span>, <span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span>, <span class='object_link'><a href="ElementHandle/Point.html" title="Puppeteer::ElementHandle::Point (class)">Point</a></span>, <span class='object_link'><a href="ElementHandle/ScrollIntoViewError.html" title="Puppeteer::ElementHandle::ScrollIntoViewError (class)">ScrollIntoViewError</a></span>
116
+
117
+
118
+ </p>
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <h2>Instance Attribute Summary</h2>
126
+
127
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></h3>
128
+ <p class="inherited"><span class='object_link'><a href="JSHandle.html#context-instance_method" title="Puppeteer::JSHandle#context (method)">#context</a></span>, <span class='object_link'><a href="JSHandle.html#remote_object-instance_method" title="Puppeteer::JSHandle#remote_object (method)">#remote_object</a></span></p>
129
+
130
+
131
+
132
+ <h2>
133
+ Instance Method Summary
134
+ <small><a href="#" class="summary_toggle">collapse</a></small>
135
+ </h2>
136
+
137
+ <ul class="summary">
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#as_element-instance_method" title="#as_element (instance method)">#<strong>as_element</strong> &#x21d2; Object </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'></div></span>
157
+
158
+ </li>
159
+
160
+
161
+ <li class="public ">
162
+ <span class="summary_signature">
163
+
164
+ <a href="#async_press-instance_method" title="#async_press (instance method)">#<strong>async_press</strong> &#x21d2; Future </a>
165
+
166
+
167
+
168
+ </span>
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <span class="summary_desc"><div class='inline'></div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#async_Seval-instance_method" title="#async_Seval (instance method)">#<strong>async_Seval</strong> &#x21d2; Object </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'>
201
+ <p>`$eval()` in JavaScript.</p>
202
+ </div></span>
203
+
204
+ </li>
205
+
206
+
207
+ <li class="public ">
208
+ <span class="summary_signature">
209
+
210
+ <a href="#async_SSeval-instance_method" title="#async_SSeval (instance method)">#<strong>async_SSeval</strong> &#x21d2; Object </a>
211
+
212
+
213
+
214
+ </span>
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+ <span class="summary_desc"><div class='inline'>
225
+ <p>`$$eval()` in JavaScript.</p>
226
+ </div></span>
227
+
228
+ </li>
229
+
230
+
231
+ <li class="public ">
232
+ <span class="summary_signature">
233
+
234
+ <a href="#async_type_text-instance_method" title="#async_type_text (instance method)">#<strong>async_type_text</strong> &#x21d2; Future </a>
235
+
236
+
237
+
238
+ </span>
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'></div></span>
249
+
250
+ </li>
251
+
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#click-instance_method" title="#click (instance method)">#<strong>click</strong>(delay: nil, button: nil, click_count: nil) &#x21d2; Object </a>
257
+
258
+
259
+
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'></div></span>
271
+
272
+ </li>
273
+
274
+
275
+ <li class="public ">
276
+ <span class="summary_signature">
277
+
278
+ <a href="#clickable_point-instance_method" title="#clickable_point (instance method)">#<strong>clickable_point</strong> &#x21d2; Object </a>
279
+
280
+
281
+
282
+ </span>
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+ <span class="summary_desc"><div class='inline'></div></span>
293
+
294
+ </li>
295
+
296
+
297
+ <li class="public ">
298
+ <span class="summary_signature">
299
+
300
+ <a href="#content_frame-instance_method" title="#content_frame (instance method)">#<strong>content_frame</strong> &#x21d2; Object </a>
301
+
302
+
303
+
304
+ </span>
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <span class="summary_desc"><div class='inline'></div></span>
315
+
316
+ </li>
317
+
318
+
319
+ <li class="public ">
320
+ <span class="summary_signature">
321
+
322
+ <a href="#focus-instance_method" title="#focus (instance method)">#<strong>focus</strong> &#x21d2; Object </a>
323
+
324
+
325
+
326
+ </span>
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+ <span class="summary_desc"><div class='inline'></div></span>
337
+
338
+ </li>
339
+
340
+
341
+ <li class="public ">
342
+ <span class="summary_signature">
343
+
344
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(context:, client:, remote_object:, page:, frame_manager:) &#x21d2; ElementHandle </a>
345
+
346
+
347
+
348
+ </span>
349
+
350
+
351
+ <span class="note title constructor">constructor</span>
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+ <span class="summary_desc"><div class='inline'>
361
+ <p>A new instance of ElementHandle.</p>
362
+ </div></span>
363
+
364
+ </li>
365
+
366
+
367
+ <li class="public ">
368
+ <span class="summary_signature">
369
+
370
+ <a href="#press-instance_method" title="#press (instance method)">#<strong>press</strong>(key, delay: nil) &#x21d2; Object </a>
371
+
372
+
373
+
374
+ </span>
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+ <span class="summary_desc"><div class='inline'></div></span>
385
+
386
+ </li>
387
+
388
+
389
+ <li class="public ">
390
+ <span class="summary_signature">
391
+
392
+ <a href="#S-instance_method" title="#S (instance method)">#<strong>S</strong>(selector) &#x21d2; Object </a>
393
+
394
+
395
+
396
+ </span>
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+ <span class="summary_desc"><div class='inline'>
407
+ <p>`$()` in JavaScript.</p>
408
+ </div></span>
409
+
410
+ </li>
411
+
412
+
413
+ <li class="public ">
414
+ <span class="summary_signature">
415
+
416
+ <a href="#scroll_into_view_if_needed-instance_method" title="#scroll_into_view_if_needed (instance method)">#<strong>scroll_into_view_if_needed</strong> &#x21d2; Object </a>
417
+
418
+
419
+
420
+ </span>
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+ <span class="summary_desc"><div class='inline'></div></span>
431
+
432
+ </li>
433
+
434
+
435
+ <li class="public ">
436
+ <span class="summary_signature">
437
+
438
+ <a href="#select-instance_method" title="#select (instance method)">#<strong>select</strong>(*values) &#x21d2; Array&lt;String&gt; </a>
439
+
440
+
441
+
442
+ </span>
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+ <span class="summary_desc"><div class='inline'></div></span>
453
+
454
+ </li>
455
+
456
+
457
+ <li class="public ">
458
+ <span class="summary_signature">
459
+
460
+ <a href="#Seval-instance_method" title="#Seval (instance method)">#<strong>Seval</strong>(selector, page_function, *args) &#x21d2; Object </a>
461
+
462
+
463
+
464
+ </span>
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+ <span class="summary_desc"><div class='inline'>
475
+ <p>`$eval()` in JavaScript.</p>
476
+ </div></span>
477
+
478
+ </li>
479
+
480
+
481
+ <li class="public ">
482
+ <span class="summary_signature">
483
+
484
+ <a href="#SS-instance_method" title="#SS (instance method)">#<strong>SS</strong>(selector) &#x21d2; Object </a>
485
+
486
+
487
+
488
+ </span>
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+ <span class="summary_desc"><div class='inline'>
499
+ <p>`$$()` in JavaScript.</p>
500
+ </div></span>
501
+
502
+ </li>
503
+
504
+
505
+ <li class="public ">
506
+ <span class="summary_signature">
507
+
508
+ <a href="#SSeval-instance_method" title="#SSeval (instance method)">#<strong>SSeval</strong>(selector, page_function, *args) &#x21d2; Object </a>
509
+
510
+
511
+
512
+ </span>
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+ <span class="summary_desc"><div class='inline'>
523
+ <p>`$$eval()` in JavaScript.</p>
524
+ </div></span>
525
+
526
+ </li>
527
+
528
+
529
+ <li class="public ">
530
+ <span class="summary_signature">
531
+
532
+ <a href="#Sx-instance_method" title="#Sx (instance method)">#<strong>Sx</strong>(expression) &#x21d2; Array&lt;ElementHandle&gt; </a>
533
+
534
+
535
+
536
+ </span>
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+ <span class="summary_desc"><div class='inline'>
547
+ <p>`$x()` in JavaScript.</p>
548
+ </div></span>
549
+
550
+ </li>
551
+
552
+
553
+ <li class="public ">
554
+ <span class="summary_signature">
555
+
556
+ <a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong>(&amp;block) &#x21d2; Object </a>
557
+
558
+
559
+
560
+ </span>
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+ <span class="summary_desc"><div class='inline'></div></span>
571
+
572
+ </li>
573
+
574
+
575
+ <li class="public ">
576
+ <span class="summary_signature">
577
+
578
+ <a href="#type_text-instance_method" title="#type_text (instance method)">#<strong>type_text</strong>(text, delay: nil) &#x21d2; Object </a>
579
+
580
+
581
+
582
+ </span>
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+ <span class="summary_desc"><div class='inline'></div></span>
593
+
594
+ </li>
595
+
596
+
597
+ <li class="public ">
598
+ <span class="summary_signature">
599
+
600
+ <a href="#upload_file-instance_method" title="#upload_file (instance method)">#<strong>upload_file</strong>(*file_paths) &#x21d2; Object </a>
601
+
602
+
603
+
604
+ </span>
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+
614
+ <span class="summary_desc"><div class='inline'></div></span>
615
+
616
+ </li>
617
+
618
+
619
+ </ul>
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="IfPresent.html" title="Puppeteer::IfPresent (module)">IfPresent</a></span></h3>
632
+ <p class="inherited"><span class='object_link'><a href="IfPresent.html#if_present-instance_method" title="Puppeteer::IfPresent#if_present (method)">#if_present</a></span></p>
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></h3>
643
+ <p class="inherited"><span class='object_link'><a href="JSHandle.html#async_evaluate-instance_method" title="Puppeteer::JSHandle#async_evaluate (method)">#async_evaluate</a></span>, <span class='object_link'><a href="JSHandle.html#async_evaluate_handle-instance_method" title="Puppeteer::JSHandle#async_evaluate_handle (method)">#async_evaluate_handle</a></span>, <span class='object_link'><a href="JSHandle.html#create-class_method" title="Puppeteer::JSHandle.create (method)">create</a></span>, <span class='object_link'><a href="JSHandle.html#dispose-instance_method" title="Puppeteer::JSHandle#dispose (method)">#dispose</a></span>, <span class='object_link'><a href="JSHandle.html#disposed%3F-instance_method" title="Puppeteer::JSHandle#disposed? (method)">#disposed?</a></span>, <span class='object_link'><a href="JSHandle.html#evaluate-instance_method" title="Puppeteer::JSHandle#evaluate (method)">#evaluate</a></span>, <span class='object_link'><a href="JSHandle.html#evaluate_handle-instance_method" title="Puppeteer::JSHandle#evaluate_handle (method)">#evaluate_handle</a></span>, <span class='object_link'><a href="JSHandle.html#execution_context-instance_method" title="Puppeteer::JSHandle#execution_context (method)">#execution_context</a></span>, <span class='object_link'><a href="JSHandle.html#json_value-instance_method" title="Puppeteer::JSHandle#json_value (method)">#json_value</a></span>, <span class='object_link'><a href="JSHandle.html#properties-instance_method" title="Puppeteer::JSHandle#properties (method)">#properties</a></span></p>
644
+ <div id="constructor_details" class="method_details_list">
645
+ <h2>Constructor Details</h2>
646
+
647
+ <div class="method_details first">
648
+ <h3 class="signature first" id="initialize-instance_method">
649
+
650
+ #<strong>initialize</strong>(context:, client:, remote_object:, page:, frame_manager:) &#x21d2; <tt><span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span></tt>
651
+
652
+
653
+
654
+
655
+
656
+ </h3><div class="docstring">
657
+ <div class="discussion">
658
+
659
+ <p>Returns a new instance of ElementHandle.</p>
660
+
661
+
662
+ </div>
663
+ </div>
664
+ <div class="tags">
665
+ <p class="tag_title">Parameters:</p>
666
+ <ul class="param">
667
+
668
+ <li>
669
+
670
+ <span class='name'>context</span>
671
+
672
+
673
+ <span class='type'>(<tt><span class='object_link'><a href="ExecutionContext.html" title="Puppeteer::ExecutionContext (class)">Puppeteer::ExecutionContext</a></span></tt>)</span>
674
+
675
+
676
+
677
+ </li>
678
+
679
+ <li>
680
+
681
+ <span class='name'>client</span>
682
+
683
+
684
+ <span class='type'>(<tt><span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">Puppeteer::CDPSession</a></span></tt>)</span>
685
+
686
+
687
+
688
+ </li>
689
+
690
+ <li>
691
+
692
+ <span class='name'>remote_object</span>
693
+
694
+
695
+ <span class='type'>(<tt><span class='object_link'><a href="RemoteObject.html" title="Puppeteer::RemoteObject (class)">Puppeteer::RemoteObject</a></span></tt>)</span>
696
+
697
+
698
+
699
+ </li>
700
+
701
+ <li>
702
+
703
+ <span class='name'>page</span>
704
+
705
+
706
+ <span class='type'>(<tt><span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Puppeteer::Page</a></span></tt>)</span>
707
+
708
+
709
+
710
+ </li>
711
+
712
+ <li>
713
+
714
+ <span class='name'>frame_manager</span>
715
+
716
+
717
+ <span class='type'>(<tt><span class='object_link'><a href="FrameManager.html" title="Puppeteer::FrameManager (class)">Puppeteer::FrameManager</a></span></tt>)</span>
718
+
719
+
720
+
721
+ </li>
722
+
723
+ </ul>
724
+
725
+
726
+ </div><table class="source_code">
727
+ <tr>
728
+ <td>
729
+ <pre class="lines">
730
+
731
+
732
+ 12
733
+ 13
734
+ 14
735
+ 15
736
+ 16
737
+ 17</pre>
738
+ </td>
739
+ <td>
740
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 12</span>
741
+
742
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>context:</span><span class='comma'>,</span> <span class='label'>client:</span><span class='comma'>,</span> <span class='label'>remote_object:</span><span class='comma'>,</span> <span class='label'>page:</span><span class='comma'>,</span> <span class='label'>frame_manager:</span><span class='rparen'>)</span>
743
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='label'>context:</span> <span class='id identifier rubyid_context'>context</span><span class='comma'>,</span> <span class='label'>client:</span> <span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='label'>remote_object:</span> <span class='id identifier rubyid_remote_object'>remote_object</span><span class='rparen'>)</span>
744
+ <span class='ivar'>@page</span> <span class='op'>=</span> <span class='id identifier rubyid_page'>page</span>
745
+ <span class='ivar'>@frame_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_frame_manager'>frame_manager</span>
746
+ <span class='ivar'>@disposed</span> <span class='op'>=</span> <span class='kw'>false</span>
747
+ <span class='kw'>end</span></pre>
748
+ </td>
749
+ </tr>
750
+ </table>
751
+ </div>
752
+
753
+ </div>
754
+
755
+
756
+ <div id="instance_method_details" class="method_details_list">
757
+ <h2>Instance Method Details</h2>
758
+
759
+
760
+ <div class="method_details first">
761
+ <h3 class="signature first" id="as_element-instance_method">
762
+
763
+ #<strong>as_element</strong> &#x21d2; <tt>Object</tt>
764
+
765
+
766
+
767
+
768
+
769
+ </h3><table class="source_code">
770
+ <tr>
771
+ <td>
772
+ <pre class="lines">
773
+
774
+
775
+ 19
776
+ 20
777
+ 21</pre>
778
+ </td>
779
+ <td>
780
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 19</span>
781
+
782
+ <span class='kw'>def</span> <span class='id identifier rubyid_as_element'>as_element</span>
783
+ <span class='kw'>self</span>
784
+ <span class='kw'>end</span></pre>
785
+ </td>
786
+ </tr>
787
+ </table>
788
+ </div>
789
+
790
+ <div class="method_details ">
791
+ <h3 class="signature " id="async_press-instance_method">
792
+
793
+ #<strong>async_press</strong> &#x21d2; <tt>Future</tt>
794
+
795
+
796
+
797
+
798
+
799
+ </h3><div class="docstring">
800
+ <div class="discussion">
801
+
802
+
803
+ </div>
804
+ </div>
805
+ <div class="tags">
806
+ <p class="tag_title">Parameters:</p>
807
+ <ul class="param">
808
+
809
+ <li>
810
+
811
+ <span class='name'>key</span>
812
+
813
+
814
+ <span class='type'>(<tt>String</tt>)</span>
815
+
816
+
817
+
818
+ </li>
819
+
820
+ <li>
821
+
822
+ <span class='name'>delay</span>
823
+
824
+
825
+ <span class='type'>(<tt>number|nil</tt>)</span>
826
+
827
+
828
+
829
+ </li>
830
+
831
+ </ul>
832
+
833
+ <p class="tag_title">Returns:</p>
834
+ <ul class="return">
835
+
836
+ <li>
837
+
838
+
839
+ <span class='type'>(<tt>Future</tt>)</span>
840
+
841
+
842
+
843
+ </li>
844
+
845
+ </ul>
846
+
847
+ </div><table class="source_code">
848
+ <tr>
849
+ <td>
850
+ <pre class="lines">
851
+
852
+
853
+ 264
854
+ 265
855
+ 266</pre>
856
+ </td>
857
+ <td>
858
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 264</span>
859
+
860
+ <span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_press'>async_press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
861
+ <span class='id identifier rubyid_press'>press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
862
+ <span class='kw'>end</span></pre>
863
+ </td>
864
+ </tr>
865
+ </table>
866
+ </div>
867
+
868
+ <div class="method_details ">
869
+ <h3 class="signature " id="async_Seval-instance_method">
870
+
871
+ #<strong>async_Seval</strong> &#x21d2; <tt>Object</tt>
872
+
873
+
874
+
875
+
876
+
877
+ </h3><div class="docstring">
878
+ <div class="discussion">
879
+
880
+ <p>`$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
881
+
882
+
883
+ </div>
884
+ </div>
885
+ <div class="tags">
886
+ <p class="tag_title">Parameters:</p>
887
+ <ul class="param">
888
+
889
+ <li>
890
+
891
+ <span class='name'>selector</span>
892
+
893
+
894
+ <span class='type'>(<tt>String</tt>)</span>
895
+
896
+
897
+
898
+ </li>
899
+
900
+ <li>
901
+
902
+ <span class='name'>page_function</span>
903
+
904
+
905
+ <span class='type'>(<tt>String</tt>)</span>
906
+
907
+
908
+
909
+ </li>
910
+
911
+ </ul>
912
+
913
+ <p class="tag_title">Returns:</p>
914
+ <ul class="return">
915
+
916
+ <li>
917
+
918
+
919
+ <span class='type'>(<tt>Object</tt>)</span>
920
+
921
+
922
+
923
+ </li>
924
+
925
+ </ul>
926
+
927
+ </div><table class="source_code">
928
+ <tr>
929
+ <td>
930
+ <pre class="lines">
931
+
932
+
933
+ 405
934
+ 406
935
+ 407</pre>
936
+ </td>
937
+ <td>
938
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 405</span>
939
+
940
+ <span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_Seval'>async_Seval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
941
+ <span class='const'><span class='object_link'><a href="#Seval-instance_method" title="Puppeteer::ElementHandle#Seval (method)">Seval</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
942
+ <span class='kw'>end</span></pre>
943
+ </td>
944
+ </tr>
945
+ </table>
946
+ </div>
947
+
948
+ <div class="method_details ">
949
+ <h3 class="signature " id="async_SSeval-instance_method">
950
+
951
+ #<strong>async_SSeval</strong> &#x21d2; <tt>Object</tt>
952
+
953
+
954
+
955
+
956
+
957
+ </h3><div class="docstring">
958
+ <div class="discussion">
959
+
960
+ <p>`$$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
961
+
962
+
963
+ </div>
964
+ </div>
965
+ <div class="tags">
966
+ <p class="tag_title">Parameters:</p>
967
+ <ul class="param">
968
+
969
+ <li>
970
+
971
+ <span class='name'>selector</span>
972
+
973
+
974
+ <span class='type'>(<tt>String</tt>)</span>
975
+
976
+
977
+
978
+ </li>
979
+
980
+ <li>
981
+
982
+ <span class='name'>page_function</span>
983
+
984
+
985
+ <span class='type'>(<tt>String</tt>)</span>
986
+
987
+
988
+
989
+ </li>
990
+
991
+ </ul>
992
+
993
+ <p class="tag_title">Returns:</p>
994
+ <ul class="return">
995
+
996
+ <li>
997
+
998
+
999
+ <span class='type'>(<tt>Object</tt>)</span>
1000
+
1001
+
1002
+
1003
+ </li>
1004
+
1005
+ </ul>
1006
+
1007
+ </div><table class="source_code">
1008
+ <tr>
1009
+ <td>
1010
+ <pre class="lines">
1011
+
1012
+
1013
+ 428
1014
+ 429
1015
+ 430</pre>
1016
+ </td>
1017
+ <td>
1018
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 428</span>
1019
+
1020
+ <span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_SSeval'>async_SSeval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1021
+ <span class='const'><span class='object_link'><a href="#SSeval-instance_method" title="Puppeteer::ElementHandle#SSeval (method)">SSeval</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1022
+ <span class='kw'>end</span></pre>
1023
+ </td>
1024
+ </tr>
1025
+ </table>
1026
+ </div>
1027
+
1028
+ <div class="method_details ">
1029
+ <h3 class="signature " id="async_type_text-instance_method">
1030
+
1031
+ #<strong>async_type_text</strong> &#x21d2; <tt>Future</tt>
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+ </h3><div class="docstring">
1038
+ <div class="discussion">
1039
+
1040
+
1041
+ </div>
1042
+ </div>
1043
+ <div class="tags">
1044
+ <p class="tag_title">Parameters:</p>
1045
+ <ul class="param">
1046
+
1047
+ <li>
1048
+
1049
+ <span class='name'>text</span>
1050
+
1051
+
1052
+ <span class='type'>(<tt>String</tt>)</span>
1053
+
1054
+
1055
+
1056
+ </li>
1057
+
1058
+ <li>
1059
+
1060
+ <span class='name'>delay</span>
1061
+
1062
+
1063
+ <span class='type'>(<tt>number|nil</tt>)</span>
1064
+
1065
+
1066
+
1067
+ </li>
1068
+
1069
+ </ul>
1070
+
1071
+ <p class="tag_title">Returns:</p>
1072
+ <ul class="return">
1073
+
1074
+ <li>
1075
+
1076
+
1077
+ <span class='type'>(<tt>Future</tt>)</span>
1078
+
1079
+
1080
+
1081
+ </li>
1082
+
1083
+ </ul>
1084
+
1085
+ </div><table class="source_code">
1086
+ <tr>
1087
+ <td>
1088
+ <pre class="lines">
1089
+
1090
+
1091
+ 250
1092
+ 251
1093
+ 252</pre>
1094
+ </td>
1095
+ <td>
1096
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 250</span>
1097
+
1098
+ <span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_type_text'>async_type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1099
+ <span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
1100
+ <span class='kw'>end</span></pre>
1101
+ </td>
1102
+ </tr>
1103
+ </table>
1104
+ </div>
1105
+
1106
+ <div class="method_details ">
1107
+ <h3 class="signature " id="click-instance_method">
1108
+
1109
+ #<strong>click</strong>(delay: nil, button: nil, click_count: nil) &#x21d2; <tt>Object</tt>
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+ </h3><div class="docstring">
1116
+ <div class="discussion">
1117
+
1118
+
1119
+ </div>
1120
+ </div>
1121
+ <div class="tags">
1122
+ <p class="tag_title">Parameters:</p>
1123
+ <ul class="param">
1124
+
1125
+ <li>
1126
+
1127
+ <span class='name'>delay</span>
1128
+
1129
+
1130
+ <span class='type'>(<tt>Number</tt>)</span>
1131
+
1132
+
1133
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1134
+
1135
+
1136
+ </li>
1137
+
1138
+ <li>
1139
+
1140
+ <span class='name'>button</span>
1141
+
1142
+
1143
+ <span class='type'>(<tt>String</tt>)</span>
1144
+
1145
+
1146
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1147
+
1148
+
1149
+ &mdash;
1150
+ <div class='inline'>
1151
+ <p>“left”|“right”|“middle”</p>
1152
+ </div>
1153
+
1154
+ </li>
1155
+
1156
+ <li>
1157
+
1158
+ <span class='name'>click_count</span>
1159
+
1160
+
1161
+ <span class='type'>(<tt>Number</tt>)</span>
1162
+
1163
+
1164
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1165
+
1166
+
1167
+ </li>
1168
+
1169
+ </ul>
1170
+
1171
+
1172
+ </div><table class="source_code">
1173
+ <tr>
1174
+ <td>
1175
+ <pre class="lines">
1176
+
1177
+
1178
+ 147
1179
+ 148
1180
+ 149
1181
+ 150
1182
+ 151</pre>
1183
+ </td>
1184
+ <td>
1185
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 147</span>
1186
+
1187
+ <span class='kw'>def</span> <span class='id identifier rubyid_click'>click</span><span class='lparen'>(</span><span class='label'>delay:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>button:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>click_count:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1188
+ <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
1189
+ <span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
1190
+ <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_mouse'>mouse</span><span class='period'>.</span><span class='id identifier rubyid_click'>click</span><span class='lparen'>(</span><span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='comma'>,</span> <span class='label'>button:</span> <span class='id identifier rubyid_button'>button</span><span class='comma'>,</span> <span class='label'>click_count:</span> <span class='id identifier rubyid_click_count'>click_count</span><span class='rparen'>)</span>
1191
+ <span class='kw'>end</span></pre>
1192
+ </td>
1193
+ </tr>
1194
+ </table>
1195
+ </div>
1196
+
1197
+ <div class="method_details ">
1198
+ <h3 class="signature " id="clickable_point-instance_method">
1199
+
1200
+ #<strong>clickable_point</strong> &#x21d2; <tt>Object</tt>
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+ </h3><table class="source_code">
1207
+ <tr>
1208
+ <td>
1209
+ <pre class="lines">
1210
+
1211
+
1212
+ 85
1213
+ 86
1214
+ 87
1215
+ 88
1216
+ 89
1217
+ 90
1218
+ 91
1219
+ 92
1220
+ 93
1221
+ 94
1222
+ 95
1223
+ 96
1224
+ 97
1225
+ 98
1226
+ 99
1227
+ 100
1228
+ 101
1229
+ 102
1230
+ 103
1231
+ 104
1232
+ 105
1233
+ 106</pre>
1234
+ </td>
1235
+ <td>
1236
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 85</span>
1237
+
1238
+ <span class='kw'>def</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
1239
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_content_quads'>content_quads</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span>
1240
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_result'>result</span> <span class='op'>||</span> <span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>quads</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1241
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotVisibleError#initialize (method)">new</a></span></span>
1242
+ <span class='kw'>end</span>
1243
+
1244
+ <span class='comment'># Filter out quads that have too small area to click into.
1245
+ </span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span> <span class='op'>=</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_send_message'>send_message</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Page.getLayoutMetrics</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1246
+ <span class='id identifier rubyid_client_width'>client_width</span> <span class='op'>=</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>clientWidth</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
1247
+ <span class='id identifier rubyid_client_height'>client_height</span> <span class='op'>=</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>clientHeight</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
1248
+
1249
+ <span class='id identifier rubyid_quads'>quads</span> <span class='op'>=</span> <span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>quads</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span>
1250
+ <span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_quad'>quad</span><span class='op'>|</span> <span class='id identifier rubyid_from_protocol_quad'>from_protocol_quad</span><span class='lparen'>(</span><span class='id identifier rubyid_quad'>quad</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span>
1251
+ <span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_quad'>quad</span><span class='op'>|</span> <span class='id identifier rubyid_intersect_quad_with_viewport'>intersect_quad_with_viewport</span><span class='lparen'>(</span><span class='id identifier rubyid_quad'>quad</span><span class='comma'>,</span> <span class='id identifier rubyid_client_width'>client_width</span><span class='comma'>,</span> <span class='id identifier rubyid_client_height'>client_height</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span>
1252
+ <span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_quad'>quad</span><span class='op'>|</span> <span class='id identifier rubyid_compute_quad_area'>compute_quad_area</span><span class='lparen'>(</span><span class='id identifier rubyid_quad'>quad</span><span class='rparen'>)</span> <span class='op'>&gt;</span> <span class='int'>1</span> <span class='rbrace'>}</span>
1253
+ <span class='kw'>if</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1254
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotVisibleError#initialize (method)">new</a></span></span>
1255
+ <span class='kw'>end</span>
1256
+
1257
+ <span class='comment'># Return the middle point of the first quad.
1258
+ </span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='symbol'>:+</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='int'>4</span>
1259
+ <span class='kw'>end</span></pre>
1260
+ </td>
1261
+ </tr>
1262
+ </table>
1263
+ </div>
1264
+
1265
+ <div class="method_details ">
1266
+ <h3 class="signature " id="content_frame-instance_method">
1267
+
1268
+ #<strong>content_frame</strong> &#x21d2; <tt>Object</tt>
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+ </h3><table class="source_code">
1275
+ <tr>
1276
+ <td>
1277
+ <pre class="lines">
1278
+
1279
+
1280
+ 23
1281
+ 24
1282
+ 25
1283
+ 26
1284
+ 27
1285
+ 28
1286
+ 29
1287
+ 30
1288
+ 31</pre>
1289
+ </td>
1290
+ <td>
1291
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 23</span>
1292
+
1293
+ <span class='kw'>def</span> <span class='id identifier rubyid_content_frame'>content_frame</span>
1294
+ <span class='id identifier rubyid_node_info'>node_info</span> <span class='op'>=</span> <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_node_info'>node_info</span>
1295
+ <span class='id identifier rubyid_frame_id'>frame_id</span> <span class='op'>=</span> <span class='id identifier rubyid_node_info'>node_info</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>node</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>frameId</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
1296
+ <span class='kw'>if</span> <span class='id identifier rubyid_frame_id'>frame_id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
1297
+ <span class='ivar'>@frame_manager</span><span class='period'>.</span><span class='id identifier rubyid_frame'>frame</span><span class='lparen'>(</span><span class='id identifier rubyid_frame_id'>frame_id</span><span class='rparen'>)</span>
1298
+ <span class='kw'>else</span>
1299
+ <span class='kw'>nil</span>
1300
+ <span class='kw'>end</span>
1301
+ <span class='kw'>end</span></pre>
1302
+ </td>
1303
+ </tr>
1304
+ </table>
1305
+ </div>
1306
+
1307
+ <div class="method_details ">
1308
+ <h3 class="signature " id="focus-instance_method">
1309
+
1310
+ #<strong>focus</strong> &#x21d2; <tt>Object</tt>
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+ </h3><table class="source_code">
1317
+ <tr>
1318
+ <td>
1319
+ <pre class="lines">
1320
+
1321
+
1322
+ 232
1323
+ 233
1324
+ 234</pre>
1325
+ </td>
1326
+ <td>
1327
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 232</span>
1328
+
1329
+ <span class='kw'>def</span> <span class='id identifier rubyid_focus'>focus</span>
1330
+ <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>element =&gt; element.focus()</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1331
+ <span class='kw'>end</span></pre>
1332
+ </td>
1333
+ </tr>
1334
+ </table>
1335
+ </div>
1336
+
1337
+ <div class="method_details ">
1338
+ <h3 class="signature " id="press-instance_method">
1339
+
1340
+ #<strong>press</strong>(key, delay: nil) &#x21d2; <tt>Object</tt>
1341
+
1342
+
1343
+
1344
+
1345
+
1346
+ </h3><div class="docstring">
1347
+ <div class="discussion">
1348
+
1349
+
1350
+ </div>
1351
+ </div>
1352
+ <div class="tags">
1353
+ <p class="tag_title">Parameters:</p>
1354
+ <ul class="param">
1355
+
1356
+ <li>
1357
+
1358
+ <span class='name'>key</span>
1359
+
1360
+
1361
+ <span class='type'>(<tt>String</tt>)</span>
1362
+
1363
+
1364
+
1365
+ </li>
1366
+
1367
+ <li>
1368
+
1369
+ <span class='name'>delay</span>
1370
+
1371
+
1372
+ <span class='type'>(<tt>number|nil</tt>)</span>
1373
+
1374
+
1375
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1376
+
1377
+
1378
+ </li>
1379
+
1380
+ </ul>
1381
+
1382
+
1383
+ </div><table class="source_code">
1384
+ <tr>
1385
+ <td>
1386
+ <pre class="lines">
1387
+
1388
+
1389
+ 256
1390
+ 257
1391
+ 258
1392
+ 259</pre>
1393
+ </td>
1394
+ <td>
1395
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 256</span>
1396
+
1397
+ <span class='kw'>def</span> <span class='id identifier rubyid_press'>press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1398
+ <span class='id identifier rubyid_focus'>focus</span>
1399
+ <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_keyboard'>keyboard</span><span class='period'>.</span><span class='id identifier rubyid_press'>press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
1400
+ <span class='kw'>end</span></pre>
1401
+ </td>
1402
+ </tr>
1403
+ </table>
1404
+ </div>
1405
+
1406
+ <div class="method_details ">
1407
+ <h3 class="signature " id="S-instance_method">
1408
+
1409
+ #<strong>S</strong>(selector) &#x21d2; <tt>Object</tt>
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+ </h3><div class="docstring">
1416
+ <div class="discussion">
1417
+
1418
+ <p>`$()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
1419
+
1420
+
1421
+ </div>
1422
+ </div>
1423
+ <div class="tags">
1424
+ <p class="tag_title">Parameters:</p>
1425
+ <ul class="param">
1426
+
1427
+ <li>
1428
+
1429
+ <span class='name'>selector</span>
1430
+
1431
+
1432
+ <span class='type'>(<tt>String</tt>)</span>
1433
+
1434
+
1435
+
1436
+ </li>
1437
+
1438
+ </ul>
1439
+
1440
+
1441
+ </div><table class="source_code">
1442
+ <tr>
1443
+ <td>
1444
+ <pre class="lines">
1445
+
1446
+
1447
+ 354
1448
+ 355
1449
+ 356
1450
+ 357
1451
+ 358
1452
+ 359
1453
+ 360
1454
+ 361
1455
+ 362
1456
+ 363
1457
+ 364
1458
+ 365
1459
+ 366</pre>
1460
+ </td>
1461
+ <td>
1462
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 354</span>
1463
+
1464
+ <span class='kw'>def</span> <span class='const'>S</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
1465
+ <span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
1466
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>(element, selector) =&gt; element.querySelector(selector)</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
1467
+ <span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span>
1468
+ <span class='rparen'>)</span>
1469
+ <span class='id identifier rubyid_element'>element</span> <span class='op'>=</span> <span class='id identifier rubyid_handle'>handle</span><span class='period'>.</span><span class='id identifier rubyid_as_element'>as_element</span>
1470
+
1471
+ <span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span>
1472
+ <span class='kw'>return</span> <span class='id identifier rubyid_element'>element</span>
1473
+ <span class='kw'>end</span>
1474
+ <span class='id identifier rubyid_handle'>handle</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
1475
+ <span class='kw'>nil</span>
1476
+ <span class='kw'>end</span></pre>
1477
+ </td>
1478
+ </tr>
1479
+ </table>
1480
+ </div>
1481
+
1482
+ <div class="method_details ">
1483
+ <h3 class="signature " id="scroll_into_view_if_needed-instance_method">
1484
+
1485
+ #<strong>scroll_into_view_if_needed</strong> &#x21d2; <tt>Object</tt>
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+ </h3><table class="source_code">
1492
+ <tr>
1493
+ <td>
1494
+ <pre class="lines">
1495
+
1496
+
1497
+ 35
1498
+ 36
1499
+ 37
1500
+ 38
1501
+ 39
1502
+ 40
1503
+ 41
1504
+ 42
1505
+ 43
1506
+ 44
1507
+ 45
1508
+ 46
1509
+ 47
1510
+ 48
1511
+ 49
1512
+ 50
1513
+ 51
1514
+ 52
1515
+ 53
1516
+ 54</pre>
1517
+ </td>
1518
+ <td>
1519
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 35</span>
1520
+
1521
+ <span class='kw'>def</span> <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
1522
+ <span class='id identifier rubyid_js'>js</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
1523
+ <span class='tstring_content'> async(element, pageJavascriptEnabled) =&gt; {
1524
+ </span><span class='tstring_content'> if (!element.isConnected)
1525
+ </span><span class='tstring_content'> return &#39;Node is detached from document&#39;;
1526
+ </span><span class='tstring_content'> if (element.nodeType !== Node.ELEMENT_NODE)
1527
+ </span><span class='tstring_content'> return &#39;Node is not of type HTMLElement&#39;;
1528
+ </span><span class='tstring_content'>
1529
+ </span><span class='tstring_content'> element.scrollIntoViewIfNeeded({block: &#39;center&#39;, inline: &#39;center&#39;, behavior: &#39;instant&#39;});
1530
+ </span><span class='tstring_content'> return false;
1531
+ </span><span class='tstring_content'> }
1532
+ </span><span class='heredoc_end'> JAVASCRIPT
1533
+ </span> <span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_js'>js</span><span class='comma'>,</span> <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_javascript_enabled'>javascript_enabled</span><span class='rparen'>)</span> <span class='comment'># returns String or false
1534
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_error'>error</span>
1535
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ScrollIntoViewError.html" title="Puppeteer::ElementHandle::ScrollIntoViewError (class)">ScrollIntoViewError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Puppeteer::ElementHandle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
1536
+ <span class='kw'>end</span>
1537
+ <span class='comment'># clickpoint is often calculated before scrolling is completed.
1538
+ </span> <span class='comment'># So, just sleep about 10 frames
1539
+ </span> <span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.16</span>
1540
+ <span class='kw'>end</span></pre>
1541
+ </td>
1542
+ </tr>
1543
+ </table>
1544
+ </div>
1545
+
1546
+ <div class="method_details ">
1547
+ <h3 class="signature " id="select-instance_method">
1548
+
1549
+ #<strong>select</strong>(*values) &#x21d2; <tt>Array&lt;String&gt;</tt>
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+ </h3><div class="docstring">
1556
+ <div class="discussion">
1557
+
1558
+
1559
+ </div>
1560
+ </div>
1561
+ <div class="tags">
1562
+
1563
+ <p class="tag_title">Returns:</p>
1564
+ <ul class="return">
1565
+
1566
+ <li>
1567
+
1568
+
1569
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
1570
+
1571
+
1572
+
1573
+ </li>
1574
+
1575
+ </ul>
1576
+
1577
+ </div><table class="source_code">
1578
+ <tr>
1579
+ <td>
1580
+ <pre class="lines">
1581
+
1582
+
1583
+ 161
1584
+ 162
1585
+ 163
1586
+ 164
1587
+ 165
1588
+ 166
1589
+ 167
1590
+ 168
1591
+ 169
1592
+ 170
1593
+ 171
1594
+ 172
1595
+ 173
1596
+ 174
1597
+ 175
1598
+ 176
1599
+ 177
1600
+ 178
1601
+ 179
1602
+ 180
1603
+ 181
1604
+ 182
1605
+ 183
1606
+ 184
1607
+ 185
1608
+ 186</pre>
1609
+ </td>
1610
+ <td>
1611
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 161</span>
1612
+
1613
+ <span class='kw'>def</span> <span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
1614
+ <span class='kw'>if</span> <span class='id identifier rubyid_nonstring'>nonstring</span> <span class='op'>=</span> <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='op'>!</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1615
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Values must be strings. Found value \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nonstring'>nonstring</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; of type \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nonstring'>nonstring</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1616
+ <span class='kw'>end</span>
1617
+
1618
+ <span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
1619
+ <span class='tstring_content'> (element, values) =&gt; {
1620
+ </span><span class='tstring_content'> if (element.nodeName.toLowerCase() !== &#39;select&#39;) {
1621
+ </span><span class='tstring_content'> throw new Error(&#39;Element is not a &lt;select&gt; element.&#39;);
1622
+ </span><span class='tstring_content'> }
1623
+ </span><span class='tstring_content'>
1624
+ </span><span class='tstring_content'> const options = Array.from(element.options);
1625
+ </span><span class='tstring_content'> element.value = undefined;
1626
+ </span><span class='tstring_content'> for (const option of options) {
1627
+ </span><span class='tstring_content'> option.selected = values.includes(option.value);
1628
+ </span><span class='tstring_content'> if (option.selected &amp;&amp; !element.multiple) {
1629
+ </span><span class='tstring_content'> break;
1630
+ </span><span class='tstring_content'> }
1631
+ </span><span class='tstring_content'> }
1632
+ </span><span class='tstring_content'> element.dispatchEvent(new Event(&#39;input&#39;, { bubbles: true }));
1633
+ </span><span class='tstring_content'> element.dispatchEvent(new Event(&#39;change&#39;, { bubbles: true }));
1634
+ </span><span class='tstring_content'> return options.filter(option =&gt; option.selected).map(option =&gt; option.value);
1635
+ </span><span class='tstring_content'> }
1636
+ </span><span class='heredoc_end'> JAVASCRIPT
1637
+ </span> <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_fn'>fn</span><span class='comma'>,</span> <span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
1638
+ <span class='kw'>end</span></pre>
1639
+ </td>
1640
+ </tr>
1641
+ </table>
1642
+ </div>
1643
+
1644
+ <div class="method_details ">
1645
+ <h3 class="signature " id="Seval-instance_method">
1646
+
1647
+ #<strong>Seval</strong>(selector, page_function, *args) &#x21d2; <tt>Object</tt>
1648
+
1649
+
1650
+
1651
+
1652
+
1653
+ </h3><div class="docstring">
1654
+ <div class="discussion">
1655
+
1656
+ <p>`$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
1657
+
1658
+
1659
+ </div>
1660
+ </div>
1661
+ <div class="tags">
1662
+ <p class="tag_title">Parameters:</p>
1663
+ <ul class="param">
1664
+
1665
+ <li>
1666
+
1667
+ <span class='name'>selector</span>
1668
+
1669
+
1670
+ <span class='type'>(<tt>String</tt>)</span>
1671
+
1672
+
1673
+
1674
+ </li>
1675
+
1676
+ <li>
1677
+
1678
+ <span class='name'>page_function</span>
1679
+
1680
+
1681
+ <span class='type'>(<tt>String</tt>)</span>
1682
+
1683
+
1684
+
1685
+ </li>
1686
+
1687
+ </ul>
1688
+
1689
+ <p class="tag_title">Returns:</p>
1690
+ <ul class="return">
1691
+
1692
+ <li>
1693
+
1694
+
1695
+ <span class='type'>(<tt>Object</tt>)</span>
1696
+
1697
+
1698
+
1699
+ </li>
1700
+
1701
+ </ul>
1702
+
1703
+ </div><table class="source_code">
1704
+ <tr>
1705
+ <td>
1706
+ <pre class="lines">
1707
+
1708
+
1709
+ 390
1710
+ 391
1711
+ 392
1712
+ 393
1713
+ 394
1714
+ 395
1715
+ 396
1716
+ 397
1717
+ 398
1718
+ 399</pre>
1719
+ </td>
1720
+ <td>
1721
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 390</span>
1722
+
1723
+ <span class='kw'>def</span> <span class='const'>Seval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1724
+ <span class='id identifier rubyid_element_handle'>element_handle</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#S-instance_method" title="Puppeteer::ElementHandle#S (method)">S</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
1725
+ <span class='kw'>unless</span> <span class='id identifier rubyid_element_handle'>element_handle</span>
1726
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotFoundError.html" title="Puppeteer::ElementHandle::ElementNotFoundError (class)">ElementNotFoundError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotFoundError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotFoundError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
1727
+ <span class='kw'>end</span>
1728
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_element_handle'>element_handle</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1729
+ <span class='id identifier rubyid_element_handle'>element_handle</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
1730
+
1731
+ <span class='id identifier rubyid_result'>result</span>
1732
+ <span class='kw'>end</span></pre>
1733
+ </td>
1734
+ </tr>
1735
+ </table>
1736
+ </div>
1737
+
1738
+ <div class="method_details ">
1739
+ <h3 class="signature " id="SS-instance_method">
1740
+
1741
+ #<strong>SS</strong>(selector) &#x21d2; <tt>Object</tt>
1742
+
1743
+
1744
+
1745
+
1746
+
1747
+ </h3><div class="docstring">
1748
+ <div class="discussion">
1749
+
1750
+ <p>`$$()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
1751
+
1752
+
1753
+ </div>
1754
+ </div>
1755
+ <div class="tags">
1756
+ <p class="tag_title">Parameters:</p>
1757
+ <ul class="param">
1758
+
1759
+ <li>
1760
+
1761
+ <span class='name'>selector</span>
1762
+
1763
+
1764
+ <span class='type'>(<tt>String</tt>)</span>
1765
+
1766
+
1767
+
1768
+ </li>
1769
+
1770
+ </ul>
1771
+
1772
+
1773
+ </div><table class="source_code">
1774
+ <tr>
1775
+ <td>
1776
+ <pre class="lines">
1777
+
1778
+
1779
+ 370
1780
+ 371
1781
+ 372
1782
+ 373
1783
+ 374
1784
+ 375
1785
+ 376
1786
+ 377
1787
+ 378</pre>
1788
+ </td>
1789
+ <td>
1790
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 370</span>
1791
+
1792
+ <span class='kw'>def</span> <span class='const'>SS</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
1793
+ <span class='id identifier rubyid_handles'>handles</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
1794
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>(element, selector) =&gt; element.querySelectorAll(selector)</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
1795
+ <span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span>
1796
+ <span class='rparen'>)</span>
1797
+ <span class='id identifier rubyid_properties'>properties</span> <span class='op'>=</span> <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span>
1798
+ <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
1799
+ <span class='id identifier rubyid_properties'>properties</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:as_element</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
1800
+ <span class='kw'>end</span></pre>
1801
+ </td>
1802
+ </tr>
1803
+ </table>
1804
+ </div>
1805
+
1806
+ <div class="method_details ">
1807
+ <h3 class="signature " id="SSeval-instance_method">
1808
+
1809
+ #<strong>SSeval</strong>(selector, page_function, *args) &#x21d2; <tt>Object</tt>
1810
+
1811
+
1812
+
1813
+
1814
+
1815
+ </h3><div class="docstring">
1816
+ <div class="discussion">
1817
+
1818
+ <p>`$$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
1819
+
1820
+
1821
+ </div>
1822
+ </div>
1823
+ <div class="tags">
1824
+ <p class="tag_title">Parameters:</p>
1825
+ <ul class="param">
1826
+
1827
+ <li>
1828
+
1829
+ <span class='name'>selector</span>
1830
+
1831
+
1832
+ <span class='type'>(<tt>String</tt>)</span>
1833
+
1834
+
1835
+
1836
+ </li>
1837
+
1838
+ <li>
1839
+
1840
+ <span class='name'>page_function</span>
1841
+
1842
+
1843
+ <span class='type'>(<tt>String</tt>)</span>
1844
+
1845
+
1846
+
1847
+ </li>
1848
+
1849
+ </ul>
1850
+
1851
+ <p class="tag_title">Returns:</p>
1852
+ <ul class="return">
1853
+
1854
+ <li>
1855
+
1856
+
1857
+ <span class='type'>(<tt>Object</tt>)</span>
1858
+
1859
+
1860
+
1861
+ </li>
1862
+
1863
+ </ul>
1864
+
1865
+ </div><table class="source_code">
1866
+ <tr>
1867
+ <td>
1868
+ <pre class="lines">
1869
+
1870
+
1871
+ 413
1872
+ 414
1873
+ 415
1874
+ 416
1875
+ 417
1876
+ 418
1877
+ 419
1878
+ 420
1879
+ 421
1880
+ 422</pre>
1881
+ </td>
1882
+ <td>
1883
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 413</span>
1884
+
1885
+ <span class='kw'>def</span> <span class='const'>SSeval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1886
+ <span class='id identifier rubyid_handles'>handles</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
1887
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>(element, selector) =&gt; Array.from(element.querySelectorAll(selector))</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
1888
+ <span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span>
1889
+ <span class='rparen'>)</span>
1890
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1891
+ <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
1892
+
1893
+ <span class='id identifier rubyid_result'>result</span>
1894
+ <span class='kw'>end</span></pre>
1895
+ </td>
1896
+ </tr>
1897
+ </table>
1898
+ </div>
1899
+
1900
+ <div class="method_details ">
1901
+ <h3 class="signature " id="Sx-instance_method">
1902
+
1903
+ #<strong>Sx</strong>(expression) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span>&gt;</tt>
1904
+
1905
+
1906
+
1907
+
1908
+
1909
+ </h3><div class="docstring">
1910
+ <div class="discussion">
1911
+
1912
+ <p>`$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
1913
+
1914
+
1915
+ </div>
1916
+ </div>
1917
+ <div class="tags">
1918
+ <p class="tag_title">Parameters:</p>
1919
+ <ul class="param">
1920
+
1921
+ <li>
1922
+
1923
+ <span class='name'>expression</span>
1924
+
1925
+
1926
+ <span class='type'>(<tt>String</tt>)</span>
1927
+
1928
+
1929
+
1930
+ </li>
1931
+
1932
+ </ul>
1933
+
1934
+ <p class="tag_title">Returns:</p>
1935
+ <ul class="return">
1936
+
1937
+ <li>
1938
+
1939
+
1940
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span>&gt;</tt>)</span>
1941
+
1942
+
1943
+
1944
+ </li>
1945
+
1946
+ </ul>
1947
+
1948
+ </div><table class="source_code">
1949
+ <tr>
1950
+ <td>
1951
+ <pre class="lines">
1952
+
1953
+
1954
+ 435
1955
+ 436
1956
+ 437
1957
+ 438
1958
+ 439
1959
+ 440
1960
+ 441
1961
+ 442
1962
+ 443
1963
+ 444
1964
+ 445
1965
+ 446
1966
+ 447
1967
+ 448
1968
+ 449
1969
+ 450
1970
+ 451</pre>
1971
+ </td>
1972
+ <td>
1973
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 435</span>
1974
+
1975
+ <span class='kw'>def</span> <span class='const'>Sx</span><span class='lparen'>(</span><span class='id identifier rubyid_expression'>expression</span><span class='rparen'>)</span>
1976
+ <span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
1977
+ <span class='tstring_content'> (element, expression) =&gt; {
1978
+ </span><span class='tstring_content'> const document = element.ownerDocument || element;
1979
+ </span><span class='tstring_content'> const iterator = document.evaluate(expression, element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
1980
+ </span><span class='tstring_content'> const array = [];
1981
+ </span><span class='tstring_content'> let item;
1982
+ </span><span class='tstring_content'> while ((item = iterator.iterateNext()))
1983
+ </span><span class='tstring_content'> array.push(item);
1984
+ </span><span class='tstring_content'> return array;
1985
+ </span><span class='tstring_content'> }
1986
+ </span><span class='heredoc_end'> JAVASCRIPT
1987
+ </span> <span class='id identifier rubyid_handles'>handles</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span><span class='id identifier rubyid_fn'>fn</span><span class='comma'>,</span> <span class='id identifier rubyid_expression'>expression</span><span class='rparen'>)</span>
1988
+ <span class='id identifier rubyid_properties'>properties</span> <span class='op'>=</span> <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span>
1989
+ <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
1990
+ <span class='id identifier rubyid_properties'>properties</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:as_element</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
1991
+ <span class='kw'>end</span></pre>
1992
+ </td>
1993
+ </tr>
1994
+ </table>
1995
+ </div>
1996
+
1997
+ <div class="method_details ">
1998
+ <h3 class="signature " id="tap-instance_method">
1999
+
2000
+ #<strong>tap</strong>(&amp;block) &#x21d2; <tt>Object</tt>
2001
+
2002
+
2003
+
2004
+
2005
+
2006
+ </h3><table class="source_code">
2007
+ <tr>
2008
+ <td>
2009
+ <pre class="lines">
2010
+
2011
+
2012
+ 220
2013
+ 221
2014
+ 222
2015
+ 223
2016
+ 224
2017
+ 225
2018
+ 226</pre>
2019
+ </td>
2020
+ <td>
2021
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 220</span>
2022
+
2023
+ <span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2024
+ <span class='kw'>return</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
2025
+
2026
+ <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
2027
+ <span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
2028
+ <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_touchscreen'>touchscreen</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='rparen'>)</span>
2029
+ <span class='kw'>end</span></pre>
2030
+ </td>
2031
+ </tr>
2032
+ </table>
2033
+ </div>
2034
+
2035
+ <div class="method_details ">
2036
+ <h3 class="signature " id="type_text-instance_method">
2037
+
2038
+ #<strong>type_text</strong>(text, delay: nil) &#x21d2; <tt>Object</tt>
2039
+
2040
+
2041
+
2042
+
2043
+
2044
+ </h3><div class="docstring">
2045
+ <div class="discussion">
2046
+
2047
+
2048
+ </div>
2049
+ </div>
2050
+ <div class="tags">
2051
+ <p class="tag_title">Parameters:</p>
2052
+ <ul class="param">
2053
+
2054
+ <li>
2055
+
2056
+ <span class='name'>text</span>
2057
+
2058
+
2059
+ <span class='type'>(<tt>String</tt>)</span>
2060
+
2061
+
2062
+
2063
+ </li>
2064
+
2065
+ <li>
2066
+
2067
+ <span class='name'>delay</span>
2068
+
2069
+
2070
+ <span class='type'>(<tt>number|nil</tt>)</span>
2071
+
2072
+
2073
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
2074
+
2075
+
2076
+ </li>
2077
+
2078
+ </ul>
2079
+
2080
+
2081
+ </div><table class="source_code">
2082
+ <tr>
2083
+ <td>
2084
+ <pre class="lines">
2085
+
2086
+
2087
+ 242
2088
+ 243
2089
+ 244
2090
+ 245</pre>
2091
+ </td>
2092
+ <td>
2093
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 242</span>
2094
+
2095
+ <span class='kw'>def</span> <span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
2096
+ <span class='id identifier rubyid_focus'>focus</span>
2097
+ <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_keyboard'>keyboard</span><span class='period'>.</span><span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
2098
+ <span class='kw'>end</span></pre>
2099
+ </td>
2100
+ </tr>
2101
+ </table>
2102
+ </div>
2103
+
2104
+ <div class="method_details ">
2105
+ <h3 class="signature " id="upload_file-instance_method">
2106
+
2107
+ #<strong>upload_file</strong>(*file_paths) &#x21d2; <tt>Object</tt>
2108
+
2109
+
2110
+
2111
+
2112
+
2113
+ </h3><div class="docstring">
2114
+ <div class="discussion">
2115
+
2116
+
2117
+ </div>
2118
+ </div>
2119
+ <div class="tags">
2120
+ <p class="tag_title">Parameters:</p>
2121
+ <ul class="param">
2122
+
2123
+ <li>
2124
+
2125
+ <span class='name'>file_paths</span>
2126
+
2127
+
2128
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
2129
+
2130
+
2131
+
2132
+ </li>
2133
+
2134
+ </ul>
2135
+
2136
+
2137
+ </div><table class="source_code">
2138
+ <tr>
2139
+ <td>
2140
+ <pre class="lines">
2141
+
2142
+
2143
+ 189
2144
+ 190
2145
+ 191
2146
+ 192
2147
+ 193
2148
+ 194
2149
+ 195
2150
+ 196
2151
+ 197
2152
+ 198
2153
+ 199
2154
+ 200
2155
+ 201
2156
+ 202
2157
+ 203
2158
+ 204
2159
+ 205
2160
+ 206
2161
+ 207
2162
+ 208
2163
+ 209
2164
+ 210
2165
+ 211
2166
+ 212
2167
+ 213
2168
+ 214
2169
+ 215
2170
+ 216
2171
+ 217
2172
+ 218</pre>
2173
+ </td>
2174
+ <td>
2175
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 189</span>
2176
+
2177
+ <span class='kw'>def</span> <span class='id identifier rubyid_upload_file'>upload_file</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_file_paths'>file_paths</span><span class='rparen'>)</span>
2178
+ <span class='id identifier rubyid_is_multiple'>is_multiple</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>el =&gt; el.multiple</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2179
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_is_multiple'>is_multiple</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;=</span> <span class='int'>2</span>
2180
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Multiple file uploads only work with &lt;input type=file multiple&gt;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
2181
+ <span class='kw'>end</span>
2182
+
2183
+ <span class='kw'>if</span> <span class='id identifier rubyid_error_path'>error_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_file_path'>file_path</span><span class='op'>|</span> <span class='op'>!</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
2184
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgmentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error_path'>error_path</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not exist or is not readable</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2185
+ <span class='kw'>end</span>
2186
+
2187
+ <span class='id identifier rubyid_backend_node_id'>backend_node_id</span> <span class='op'>=</span> <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_node_info'>node_info</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>node</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>backendNodeId</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
2188
+
2189
+ <span class='comment'># The zero-length array is a special case, it seems that DOM.setFileInputFiles does
2190
+ </span> <span class='comment'># not actually update the files in that case, so the solution is to eval the element
2191
+ </span> <span class='comment'># value to a new FileList directly.
2192
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
2193
+ <span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
2194
+ <span class='tstring_content'> (element) =&gt; {
2195
+ </span><span class='tstring_content'> element.files = new DataTransfer().files;
2196
+ </span><span class='tstring_content'>
2197
+ </span><span class='tstring_content'> // Dispatch events for this case because it should behave akin to a user action.
2198
+ </span><span class='tstring_content'> element.dispatchEvent(new Event(&#39;input&#39;, { bubbles: true }));
2199
+ </span><span class='tstring_content'> element.dispatchEvent(new Event(&#39;change&#39;, { bubbles: true }));
2200
+ </span><span class='tstring_content'> }
2201
+ </span><span class='heredoc_end'> JAVASCRIPT
2202
+ </span> <span class='id identifier rubyid_await'><span class='object_link'><a href="ConcurrentRubyUtils.html#await-instance_method" title="Puppeteer::ConcurrentRubyUtils#await (method)">await</a></span></span> <span class='id identifier rubyid_this'>this</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
2203
+ <span class='kw'>else</span>
2204
+ <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_set_file_input_files'>set_file_input_files</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='comma'>,</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='comma'>,</span> <span class='id identifier rubyid_backend_node_id'>backend_node_id</span><span class='rparen'>)</span>
2205
+ <span class='kw'>end</span>
2206
+ <span class='kw'>end</span></pre>
2207
+ </td>
2208
+ </tr>
2209
+ </table>
2210
+ </div>
2211
+
2212
+ </div>
2213
+
2214
+ </div>
2215
+
2216
+ <div id="footer">
2217
+ Generated on Tue Jun 9 00:13:41 2020 by
2218
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2219
+ 0.9.24 (ruby-2.6.3).
2220
+ </div>
2221
+
2222
+ </div>
2223
+ </body>
2224
+ </html>