puppeteer-ruby 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/docs/Puppeteer.html +2 -2
  3. data/docs/Puppeteer/AsyncAwaitBehavior.html +1 -1
  4. data/docs/Puppeteer/Browser.html +1 -1
  5. data/docs/Puppeteer/BrowserContext.html +1 -1
  6. data/docs/Puppeteer/BrowserFetcher.html +1 -1
  7. data/docs/Puppeteer/BrowserRunner.html +1 -1
  8. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +1 -1
  9. data/docs/Puppeteer/CDPSession.html +86 -57
  10. data/docs/Puppeteer/CDPSession/Error.html +1 -1
  11. data/docs/Puppeteer/ConcurrentRubyUtils.html +1 -1
  12. data/docs/Puppeteer/Connection.html +1 -1
  13. data/docs/Puppeteer/Connection/MessageCallback.html +1 -1
  14. data/docs/Puppeteer/Connection/ProtocolError.html +1 -1
  15. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +1 -1
  16. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +1 -1
  17. data/docs/Puppeteer/ConsoleMessage.html +1 -1
  18. data/docs/Puppeteer/ConsoleMessage/Location.html +1 -1
  19. data/docs/Puppeteer/DOMWorld.html +610 -68
  20. data/docs/Puppeteer/DOMWorld/DetachedError.html +1 -1
  21. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +1 -1
  22. data/docs/Puppeteer/DebugPrint.html +2 -2
  23. data/docs/Puppeteer/Device.html +1 -1
  24. data/docs/Puppeteer/Devices.html +1 -1
  25. data/docs/Puppeteer/ElementHandle.html +306 -109
  26. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +5 -5
  27. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +5 -5
  28. data/docs/Puppeteer/ElementHandle/Point.html +28 -28
  29. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +1 -1
  30. data/docs/Puppeteer/EmulationManager.html +1 -1
  31. data/docs/Puppeteer/EventCallbackable.html +1 -1
  32. data/docs/Puppeteer/EventCallbackable/EventListeners.html +1 -1
  33. data/docs/Puppeteer/ExecutionContext.html +124 -1
  34. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +1 -1
  35. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +1 -1
  36. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +2 -2
  37. data/docs/Puppeteer/Frame.html +117 -65
  38. data/docs/Puppeteer/FrameManager.html +1 -1
  39. data/docs/Puppeteer/FrameManager/NavigationError.html +1 -1
  40. data/docs/Puppeteer/IfPresent.html +1 -1
  41. data/docs/Puppeteer/JSHandle.html +1 -1
  42. data/docs/Puppeteer/Keyboard.html +1 -1
  43. data/docs/Puppeteer/Keyboard/KeyDefinition.html +1 -1
  44. data/docs/Puppeteer/Keyboard/KeyDescription.html +1 -1
  45. data/docs/Puppeteer/Launcher.html +1 -1
  46. data/docs/Puppeteer/Launcher/Base.html +1 -1
  47. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +1 -1
  48. data/docs/Puppeteer/Launcher/BrowserOptions.html +1 -1
  49. data/docs/Puppeteer/Launcher/Chrome.html +1 -1
  50. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +1 -1
  51. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +1 -1
  52. data/docs/Puppeteer/Launcher/LaunchOptions.html +1 -1
  53. data/docs/Puppeteer/LifecycleWatcher.html +1 -1
  54. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +1 -1
  55. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +1 -1
  56. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +1 -1
  57. data/docs/Puppeteer/Mouse.html +1 -1
  58. data/docs/Puppeteer/Mouse/Button.html +1 -1
  59. data/docs/Puppeteer/NetworkManager.html +1 -1
  60. data/docs/Puppeteer/NetworkManager/Credentials.html +1 -1
  61. data/docs/Puppeteer/Page.html +95 -43
  62. data/docs/Puppeteer/Page/ScreenshotOptions.html +1 -1
  63. data/docs/Puppeteer/Page/ScriptTag.html +1 -1
  64. data/docs/Puppeteer/Page/StyleTag.html +1 -1
  65. data/docs/Puppeteer/Page/TargetCrashedError.html +1 -1
  66. data/docs/Puppeteer/RemoteObject.html +1 -1
  67. data/docs/Puppeteer/Target.html +1 -1
  68. data/docs/Puppeteer/Target/InitializeFailure.html +1 -1
  69. data/docs/Puppeteer/Target/TargetInfo.html +1 -1
  70. data/docs/Puppeteer/TimeoutError.html +1 -1
  71. data/docs/Puppeteer/TimeoutSettings.html +1 -1
  72. data/docs/Puppeteer/TouchScreen.html +1 -1
  73. data/docs/Puppeteer/Viewport.html +1 -1
  74. data/docs/Puppeteer/WaitTask.html +434 -8
  75. data/docs/Puppeteer/WaitTask/TerminatedError.html +1 -1
  76. data/docs/Puppeteer/WaitTask/TimeoutError.html +206 -0
  77. data/docs/Puppeteer/WebSocket.html +1 -1
  78. data/docs/Puppeteer/WebSocket/DriverImpl.html +1 -1
  79. data/docs/Puppeteer/WebSocketTransport.html +1 -1
  80. data/docs/Puppeteer/WebSocktTransportError.html +1 -1
  81. data/docs/_index.html +8 -1
  82. data/docs/class_list.html +1 -1
  83. data/docs/file.README.html +1 -1
  84. data/docs/index.html +1 -1
  85. data/docs/method_list.html +615 -519
  86. data/docs/top-level-namespace.html +1 -1
  87. data/lib/puppeteer/cdp_session.rb +33 -11
  88. data/lib/puppeteer/dom_world.rb +97 -90
  89. data/lib/puppeteer/element_handle.rb +36 -54
  90. data/lib/puppeteer/execution_context.rb +23 -17
  91. data/lib/puppeteer/frame.rb +13 -11
  92. data/lib/puppeteer/page.rb +29 -11
  93. data/lib/puppeteer/version.rb +1 -1
  94. data/lib/puppeteer/wait_task.rb +183 -1
  95. metadata +3 -2
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sun Apr 26 15:52:57 2020 by
117
+ Generated on Mon May 25 23:22:49 2020 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.24 (ruby-2.6.3).
120
120
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sun Apr 26 15:52:57 2020 by
117
+ Generated on Mon May 25 23:22:49 2020 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.24 (ruby-2.6.3).
120
120
  </div>
@@ -76,7 +76,7 @@
76
76
 
77
77
  <dl>
78
78
  <dt>Included in:</dt>
79
- <dd><span class='object_link'><a href="Browser.html" title="Puppeteer::Browser (class)">Browser</a></span>, <span class='object_link'><a href="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span>, <span class='object_link'><a href="Connection/RequestDebugPrinter.html" title="Puppeteer::Connection::RequestDebugPrinter (class)">Connection::RequestDebugPrinter</a></span>, <span class='object_link'><a href="Connection/ResponseDebugPrinter.html" title="Puppeteer::Connection::ResponseDebugPrinter (class)">Connection::ResponseDebugPrinter</a></span>, <span class='object_link'><a href="FrameManager.html" title="Puppeteer::FrameManager (class)">FrameManager</a></span>, <span class='object_link'><a href="RemoteObject.html" title="Puppeteer::RemoteObject (class)">RemoteObject</a></span></dd>
79
+ <dd><span class='object_link'><a href="Browser.html" title="Puppeteer::Browser (class)">Browser</a></span>, <span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span>, <span class='object_link'><a href="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span>, <span class='object_link'><a href="Connection/RequestDebugPrinter.html" title="Puppeteer::Connection::RequestDebugPrinter (class)">Connection::RequestDebugPrinter</a></span>, <span class='object_link'><a href="Connection/ResponseDebugPrinter.html" title="Puppeteer::Connection::ResponseDebugPrinter (class)">Connection::ResponseDebugPrinter</a></span>, <span class='object_link'><a href="FrameManager.html" title="Puppeteer::FrameManager (class)">FrameManager</a></span>, <span class='object_link'><a href="RemoteObject.html" title="Puppeteer::RemoteObject (class)">RemoteObject</a></span></dd>
80
80
  </dl>
81
81
 
82
82
 
@@ -223,7 +223,7 @@
223
223
  </div>
224
224
 
225
225
  <div id="footer">
226
- Generated on Sun Apr 26 15:52:55 2020 by
226
+ Generated on Mon May 25 23:22:48 2020 by
227
227
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
228
228
  0.9.24 (ruby-2.6.3).
229
229
  </div>
@@ -460,7 +460,7 @@
460
460
  </div>
461
461
 
462
462
  <div id="footer">
463
- Generated on Sun Apr 26 15:52:56 2020 by
463
+ Generated on Mon May 25 23:22:49 2020 by
464
464
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
465
465
  0.9.24 (ruby-2.6.3).
466
466
  </div>
@@ -129,7 +129,7 @@
129
129
  </div>
130
130
 
131
131
  <div id="footer">
132
- Generated on Sun Apr 26 15:52:56 2020 by
132
+ Generated on Mon May 25 23:22:49 2020 by
133
133
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
134
  0.9.24 (ruby-2.6.3).
135
135
  </div>
@@ -453,6 +453,54 @@
453
453
  <p>`$$eval()` in JavaScript.</p>
454
454
  </div></span>
455
455
 
456
+ </li>
457
+
458
+
459
+ <li class="public ">
460
+ <span class="summary_signature">
461
+
462
+ <a href="#Sx-instance_method" title="#Sx (instance method)">#<strong>Sx</strong>(expression) &#x21d2; Array&lt;ElementHandle&gt; </a>
463
+
464
+
465
+
466
+ </span>
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+ <span class="summary_desc"><div class='inline'>
477
+ <p>`$x()` in JavaScript.</p>
478
+ </div></span>
479
+
480
+ </li>
481
+
482
+
483
+ <li class="public ">
484
+ <span class="summary_signature">
485
+
486
+ <a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong> &#x21d2; Object </a>
487
+
488
+
489
+
490
+ </span>
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+ <span class="summary_desc"><div class='inline'>
501
+ <p>const promises = filePaths.map(filePath =&gt; readFileAsync(filePath)); const files = []; for (let i = 0; i &lt; filePaths.length; i++) { const buffer = await <a href="i">promises</a>; const filePath = <a href="i">path.basename(filePaths</a>); const file = { name: filePath, content: buffer.toString(&#39;base64&#39;), mimeType: mime.lookup(filePath), }; files.push(file); } await this.evaluateHandle(async(element, files) =&gt; { const dt = new DataTransfer(); for (const item of files) { const response = await fetch(`data:$itemitem.mimeType;base64,$itemitem.content`); const file = new File([await response.blob()], item.name); dt.items.add(file); } element.files = dt.files; element.dispatchEvent(new Event(&#39;input&#39;, { bubbles: true })); element.dispatchEvent(new Event(&#39;change&#39;, { bubbles: true })); }, files); }.</p>
502
+ </div></span>
503
+
456
504
  </li>
457
505
 
458
506
 
@@ -712,12 +760,12 @@
712
760
  <pre class="lines">
713
761
 
714
762
 
715
- 270
716
- 271
717
- 272</pre>
763
+ 259
764
+ 260
765
+ 261</pre>
718
766
  </td>
719
767
  <td>
720
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 270</span>
768
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 259</span>
721
769
 
722
770
  <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>
723
771
  <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>
@@ -790,12 +838,12 @@
790
838
  <pre class="lines">
791
839
 
792
840
 
793
- 256
794
- 257
795
- 258</pre>
841
+ 245
842
+ 246
843
+ 247</pre>
796
844
  </td>
797
845
  <td>
798
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 256</span>
846
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 245</span>
799
847
 
800
848
  <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>
801
849
  <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>
@@ -877,14 +925,14 @@
877
925
  <pre class="lines">
878
926
 
879
927
 
880
- 154
881
- 155
882
- 156
883
- 157
884
- 158</pre>
928
+ 145
929
+ 146
930
+ 147
931
+ 148
932
+ 149</pre>
885
933
  </td>
886
934
  <td>
887
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 154</span>
935
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 145</span>
888
936
 
889
937
  <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>
890
938
  <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
@@ -911,6 +959,15 @@
911
959
  <pre class="lines">
912
960
 
913
961
 
962
+ 83
963
+ 84
964
+ 85
965
+ 86
966
+ 87
967
+ 88
968
+ 89
969
+ 90
970
+ 91
914
971
  92
915
972
  93
916
973
  94
@@ -923,19 +980,10 @@
923
980
  101
924
981
  102
925
982
  103
926
- 104
927
- 105
928
- 106
929
- 107
930
- 108
931
- 109
932
- 110
933
- 111
934
- 112
935
- 113</pre>
983
+ 104</pre>
936
984
  </td>
937
985
  <td>
938
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 92</span>
986
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 83</span>
939
987
 
940
988
  <span class='kw'>def</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
941
989
  <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>
@@ -1021,12 +1069,12 @@
1021
1069
  <pre class="lines">
1022
1070
 
1023
1071
 
1024
- 238
1025
- 239
1026
- 240</pre>
1072
+ 227
1073
+ 228
1074
+ 229</pre>
1027
1075
  </td>
1028
1076
  <td>
1029
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 238</span>
1077
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 227</span>
1030
1078
 
1031
1079
  <span class='kw'>def</span> <span class='id identifier rubyid_focus'>focus</span>
1032
1080
  <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>
@@ -1088,13 +1136,13 @@
1088
1136
  <pre class="lines">
1089
1137
 
1090
1138
 
1091
- 262
1092
- 263
1093
- 264
1094
- 265</pre>
1139
+ 251
1140
+ 252
1141
+ 253
1142
+ 254</pre>
1095
1143
  </td>
1096
1144
  <td>
1097
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 262</span>
1145
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 251</span>
1098
1146
 
1099
1147
  <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>
1100
1148
  <span class='id identifier rubyid_focus'>focus</span>
@@ -1146,22 +1194,22 @@
1146
1194
  <pre class="lines">
1147
1195
 
1148
1196
 
1197
+ 349
1198
+ 350
1199
+ 351
1200
+ 352
1201
+ 353
1202
+ 354
1203
+ 355
1204
+ 356
1205
+ 357
1206
+ 358
1207
+ 359
1149
1208
  360
1150
- 361
1151
- 362
1152
- 363
1153
- 364
1154
- 365
1155
- 366
1156
- 367
1157
- 368
1158
- 369
1159
- 370
1160
- 371
1161
- 372</pre>
1209
+ 361</pre>
1162
1210
  </td>
1163
1211
  <td>
1164
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 360</span>
1212
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 349</span>
1165
1213
 
1166
1214
  <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>
1167
1215
  <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>
@@ -1215,16 +1263,7 @@
1215
1263
  49
1216
1264
  50
1217
1265
  51
1218
- 52
1219
- 53
1220
- 54
1221
- 55
1222
- 56
1223
- 57
1224
- 58
1225
- 59
1226
- 60
1227
- 61</pre>
1266
+ 52</pre>
1228
1267
  </td>
1229
1268
  <td>
1230
1269
  <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 33</span>
@@ -1236,20 +1275,8 @@
1236
1275
  </span><span class='tstring_content'> return &#39;Node is detached from document&#39;;
1237
1276
  </span><span class='tstring_content'> if (element.nodeType !== Node.ELEMENT_NODE)
1238
1277
  </span><span class='tstring_content'> return &#39;Node is not of type HTMLElement&#39;;
1239
- </span><span class='tstring_content'> // force-scroll if page&#39;s javascript is disabled.
1240
- </span><span class='tstring_content'> if (!pageJavascriptEnabled) {
1241
- </span><span class='tstring_content'> element.scrollIntoView({block: &#39;center&#39;, inline: &#39;center&#39;, behavior: &#39;instant&#39;});
1242
- </span><span class='tstring_content'> return false;
1243
- </span><span class='tstring_content'> }
1244
- </span><span class='tstring_content'> const visibleRatio = await new Promise(resolve =&gt; {
1245
- </span><span class='tstring_content'> const observer = new IntersectionObserver(entries =&gt; {
1246
- </span><span class='tstring_content'> resolve(entries[0].intersectionRatio);
1247
- </span><span class='tstring_content'> observer.disconnect();
1248
- </span><span class='tstring_content'> });
1249
- </span><span class='tstring_content'> observer.observe(element);
1250
- </span><span class='tstring_content'> });
1251
- </span><span class='tstring_content'> if (visibleRatio !== 1.0)
1252
- </span><span class='tstring_content'> element.scrollIntoView({block: &#39;center&#39;, inline: &#39;center&#39;, behavior: &#39;instant&#39;});
1278
+ </span><span class='tstring_content'>
1279
+ </span><span class='tstring_content'> element.scrollIntoViewIfNeeded({block: &#39;center&#39;, inline: &#39;center&#39;, behavior: &#39;instant&#39;});
1253
1280
  </span><span class='tstring_content'> return false;
1254
1281
  </span><span class='tstring_content'> }
1255
1282
  </span><span class='heredoc_end'> JAVASCRIPT
@@ -1257,6 +1284,9 @@
1257
1284
  </span> <span class='kw'>if</span> <span class='id identifier rubyid_error'>error</span>
1258
1285
  <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>
1259
1286
  <span class='kw'>end</span>
1287
+ <span class='comment'># clickpoint is often calculated before scrolling is completed.
1288
+ </span> <span class='comment'># So, just sleep about 10 frames
1289
+ </span> <span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.16</span>
1260
1290
  <span class='kw'>end</span></pre>
1261
1291
  </td>
1262
1292
  </tr>
@@ -1328,19 +1358,19 @@
1328
1358
  <pre class="lines">
1329
1359
 
1330
1360
 
1331
- 396
1332
- 397
1333
- 398
1334
- 399
1335
- 400
1336
- 401
1337
- 402
1338
- 403
1339
- 404
1340
- 405</pre>
1361
+ 385
1362
+ 386
1363
+ 387
1364
+ 388
1365
+ 389
1366
+ 390
1367
+ 391
1368
+ 392
1369
+ 393
1370
+ 394</pre>
1341
1371
  </td>
1342
1372
  <td>
1343
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 396</span>
1373
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 385</span>
1344
1374
 
1345
1375
  <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>
1346
1376
  <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>
@@ -1398,18 +1428,18 @@
1398
1428
  <pre class="lines">
1399
1429
 
1400
1430
 
1401
- 376
1402
- 377
1403
- 378
1404
- 379
1405
- 380
1406
- 381
1407
- 382
1408
- 383
1409
- 384</pre>
1431
+ 365
1432
+ 366
1433
+ 367
1434
+ 368
1435
+ 369
1436
+ 370
1437
+ 371
1438
+ 372
1439
+ 373</pre>
1410
1440
  </td>
1411
1441
  <td>
1412
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 376</span>
1442
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 365</span>
1413
1443
 
1414
1444
  <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>
1415
1445
  <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>
@@ -1490,19 +1520,19 @@
1490
1520
  <pre class="lines">
1491
1521
 
1492
1522
 
1493
- 411
1494
- 412
1495
- 413
1496
- 414
1497
- 415
1498
- 416
1499
- 417
1500
- 418
1501
- 419
1502
- 420</pre>
1523
+ 400
1524
+ 401
1525
+ 402
1526
+ 403
1527
+ 404
1528
+ 405
1529
+ 406
1530
+ 407
1531
+ 408
1532
+ 409</pre>
1503
1533
  </td>
1504
1534
  <td>
1505
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 411</span>
1535
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 400</span>
1506
1536
 
1507
1537
  <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>
1508
1538
  <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>
@@ -1517,6 +1547,173 @@
1517
1547
  </td>
1518
1548
  </tr>
1519
1549
  </table>
1550
+ </div>
1551
+
1552
+ <div class="method_details ">
1553
+ <h3 class="signature " id="Sx-instance_method">
1554
+
1555
+ #<strong>Sx</strong>(expression) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span>&gt;</tt>
1556
+
1557
+
1558
+
1559
+
1560
+
1561
+ </h3><div class="docstring">
1562
+ <div class="discussion">
1563
+
1564
+ <p>`$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
1565
+
1566
+
1567
+ </div>
1568
+ </div>
1569
+ <div class="tags">
1570
+ <p class="tag_title">Parameters:</p>
1571
+ <ul class="param">
1572
+
1573
+ <li>
1574
+
1575
+ <span class='name'>expression</span>
1576
+
1577
+
1578
+ <span class='type'>(<tt>String</tt>)</span>
1579
+
1580
+
1581
+
1582
+ </li>
1583
+
1584
+ </ul>
1585
+
1586
+ <p class="tag_title">Returns:</p>
1587
+ <ul class="return">
1588
+
1589
+ <li>
1590
+
1591
+
1592
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span>&gt;</tt>)</span>
1593
+
1594
+
1595
+
1596
+ </li>
1597
+
1598
+ </ul>
1599
+
1600
+ </div><table class="source_code">
1601
+ <tr>
1602
+ <td>
1603
+ <pre class="lines">
1604
+
1605
+
1606
+ 414
1607
+ 415
1608
+ 416
1609
+ 417
1610
+ 418
1611
+ 419
1612
+ 420
1613
+ 421
1614
+ 422
1615
+ 423
1616
+ 424
1617
+ 425
1618
+ 426
1619
+ 427
1620
+ 428
1621
+ 429
1622
+ 430</pre>
1623
+ </td>
1624
+ <td>
1625
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 414</span>
1626
+
1627
+ <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>
1628
+ <span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
1629
+ <span class='tstring_content'> (element, expression) =&gt; {
1630
+ </span><span class='tstring_content'> const document = element.ownerDocument || element;
1631
+ </span><span class='tstring_content'> const iterator = document.evaluate(expression, element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
1632
+ </span><span class='tstring_content'> const array = [];
1633
+ </span><span class='tstring_content'> let item;
1634
+ </span><span class='tstring_content'> while ((item = iterator.iterateNext()))
1635
+ </span><span class='tstring_content'> array.push(item);
1636
+ </span><span class='tstring_content'> return array;
1637
+ </span><span class='tstring_content'> }
1638
+ </span><span class='heredoc_end'> JAVASCRIPT
1639
+ </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>
1640
+ <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>
1641
+ <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
1642
+ <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>
1643
+ <span class='kw'>end</span></pre>
1644
+ </td>
1645
+ </tr>
1646
+ </table>
1647
+ </div>
1648
+
1649
+ <div class="method_details ">
1650
+ <h3 class="signature " id="tap-instance_method">
1651
+
1652
+ #<strong>tap</strong> &#x21d2; <tt>Object</tt>
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+ </h3><div class="docstring">
1659
+ <div class="discussion">
1660
+
1661
+ <p>const promises = filePaths.map(filePath =&gt; readFileAsync(filePath));</p>
1662
+
1663
+ <pre class="code ruby"><code class="ruby"> const files = [];
1664
+ for (let i = 0; i &lt; filePaths.length; i++) {
1665
+ const buffer = await promises[i];
1666
+ const filePath = path.basename(filePaths[i]);
1667
+ const file = {
1668
+ name: filePath,
1669
+ content: buffer.toString(&#39;base64&#39;),
1670
+ mimeType: mime.lookup(filePath),
1671
+ };
1672
+ files.push(file);
1673
+ }
1674
+ await this.evaluateHandle(async(element, files) =&gt; {
1675
+ const dt = new DataTransfer();
1676
+ for (const item of files) {
1677
+ const response = await fetch(`data:${item.mimeType};base64,${item.content}`);
1678
+ const file = new File([await response.blob()], item.name);
1679
+ dt.items.add(file);
1680
+ }
1681
+ element.files = dt.files;
1682
+ element.dispatchEvent(new Event(&#39;input&#39;, { bubbles: true }));
1683
+ element.dispatchEvent(new Event(&#39;change&#39;, { bubbles: true }));
1684
+ }, files);
1685
+ }
1686
+ </code></pre>
1687
+
1688
+
1689
+ </div>
1690
+ </div>
1691
+ <div class="tags">
1692
+
1693
+
1694
+ </div><table class="source_code">
1695
+ <tr>
1696
+ <td>
1697
+ <pre class="lines">
1698
+
1699
+
1700
+ 220
1701
+ 221
1702
+ 222
1703
+ 223
1704
+ 224</pre>
1705
+ </td>
1706
+ <td>
1707
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 220</span>
1708
+
1709
+ <span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span>
1710
+ <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
1711
+ <span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
1712
+ <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>
1713
+ <span class='kw'>end</span></pre>
1714
+ </td>
1715
+ </tr>
1716
+ </table>
1520
1717
  </div>
1521
1718
 
1522
1719
  <div class="method_details ">
@@ -1571,13 +1768,13 @@
1571
1768
  <pre class="lines">
1572
1769
 
1573
1770
 
1574
- 248
1575
- 249
1576
- 250
1577
- 251</pre>
1771
+ 237
1772
+ 238
1773
+ 239
1774
+ 240</pre>
1578
1775
  </td>
1579
1776
  <td>
1580
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 248</span>
1777
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 237</span>
1581
1778
 
1582
1779
  <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>
1583
1780
  <span class='id identifier rubyid_focus'>focus</span>
@@ -1593,7 +1790,7 @@
1593
1790
  </div>
1594
1791
 
1595
1792
  <div id="footer">
1596
- Generated on Sun Apr 26 15:52:57 2020 by
1793
+ Generated on Mon May 25 23:22:50 2020 by
1597
1794
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1598
1795
  0.9.24 (ruby-2.6.3).
1599
1796
  </div>