puppeteer-ruby 0.0.6 → 0.0.8

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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/docs/Puppeteer.html +53 -43
  4. data/docs/Puppeteer/AsyncAwaitBehavior.html +1 -1
  5. data/docs/Puppeteer/Browser.html +1 -1
  6. data/docs/Puppeteer/BrowserContext.html +1 -1
  7. data/docs/Puppeteer/BrowserFetcher.html +1 -1
  8. data/docs/Puppeteer/BrowserRunner.html +1 -1
  9. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +1 -1
  10. data/docs/Puppeteer/CDPSession.html +1 -1
  11. data/docs/Puppeteer/CDPSession/Error.html +1 -1
  12. data/docs/Puppeteer/ConcurrentRubyUtils.html +1 -1
  13. data/docs/Puppeteer/Connection.html +1 -1
  14. data/docs/Puppeteer/Connection/MessageCallback.html +1 -1
  15. data/docs/Puppeteer/Connection/ProtocolError.html +1 -1
  16. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +1 -1
  17. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +1 -1
  18. data/docs/Puppeteer/ConsoleMessage.html +1 -1
  19. data/docs/Puppeteer/ConsoleMessage/Location.html +1 -1
  20. data/docs/Puppeteer/DOMWorld.html +116 -19
  21. data/docs/Puppeteer/DOMWorld/DetachedError.html +1 -1
  22. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +1 -1
  23. data/docs/Puppeteer/DebugPrint.html +1 -1
  24. data/docs/Puppeteer/Device.html +1 -1
  25. data/docs/Puppeteer/Devices.html +1 -1
  26. data/docs/Puppeteer/ElementHandle.html +565 -141
  27. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +5 -5
  28. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +5 -5
  29. data/docs/Puppeteer/ElementHandle/Point.html +21 -21
  30. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +1 -1
  31. data/docs/Puppeteer/EmulationManager.html +1 -1
  32. data/docs/Puppeteer/EventCallbackable.html +1 -1
  33. data/docs/Puppeteer/EventCallbackable/EventListeners.html +1 -1
  34. data/docs/Puppeteer/ExecutionContext.html +114 -11
  35. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +1 -1
  36. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +1 -1
  37. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +1 -1
  38. data/docs/Puppeteer/FileChooser.html +455 -0
  39. data/docs/Puppeteer/Frame.html +1 -1
  40. data/docs/Puppeteer/FrameManager.html +1 -1
  41. data/docs/Puppeteer/FrameManager/NavigationError.html +1 -1
  42. data/docs/Puppeteer/IfPresent.html +1 -1
  43. data/docs/Puppeteer/JSHandle.html +1 -1
  44. data/docs/Puppeteer/Keyboard.html +1 -1
  45. data/docs/Puppeteer/Keyboard/KeyDefinition.html +1 -1
  46. data/docs/Puppeteer/Keyboard/KeyDescription.html +1 -1
  47. data/docs/Puppeteer/Launcher.html +1 -1
  48. data/docs/Puppeteer/Launcher/Base.html +1 -1
  49. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +1 -1
  50. data/docs/Puppeteer/Launcher/BrowserOptions.html +1 -1
  51. data/docs/Puppeteer/Launcher/Chrome.html +64 -23
  52. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +1 -1
  53. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +1 -1
  54. data/docs/Puppeteer/Launcher/LaunchOptions.html +1 -1
  55. data/docs/Puppeteer/LifecycleWatcher.html +1 -1
  56. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +1 -1
  57. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +1 -1
  58. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +1 -1
  59. data/docs/Puppeteer/Mouse.html +1 -1
  60. data/docs/Puppeteer/Mouse/Button.html +1 -1
  61. data/docs/Puppeteer/NetworkManager.html +1 -1
  62. data/docs/Puppeteer/NetworkManager/Credentials.html +1 -1
  63. data/docs/Puppeteer/Page.html +841 -349
  64. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +206 -0
  65. data/docs/Puppeteer/Page/ScreenshotOptions.html +1 -1
  66. data/docs/Puppeteer/Page/ScriptTag.html +24 -24
  67. data/docs/Puppeteer/Page/StyleTag.html +19 -19
  68. data/docs/Puppeteer/Page/TargetCrashedError.html +1 -1
  69. data/docs/Puppeteer/RemoteObject.html +68 -3
  70. data/docs/Puppeteer/Target.html +1 -1
  71. data/docs/Puppeteer/Target/InitializeFailure.html +1 -1
  72. data/docs/Puppeteer/Target/TargetInfo.html +1 -1
  73. data/docs/Puppeteer/TimeoutError.html +1 -1
  74. data/docs/Puppeteer/TimeoutSettings.html +1 -1
  75. data/docs/Puppeteer/TouchScreen.html +1 -1
  76. data/docs/Puppeteer/Viewport.html +1 -1
  77. data/docs/Puppeteer/WaitTask.html +1 -1
  78. data/docs/Puppeteer/WaitTask/TerminatedError.html +1 -1
  79. data/docs/Puppeteer/WaitTask/TimeoutError.html +1 -1
  80. data/docs/Puppeteer/WebSocket.html +1 -1
  81. data/docs/Puppeteer/WebSocket/DriverImpl.html +1 -1
  82. data/docs/Puppeteer/WebSocketTransport.html +1 -1
  83. data/docs/Puppeteer/WebSocktTransportError.html +1 -1
  84. data/docs/_index.html +19 -5
  85. data/docs/class_list.html +1 -1
  86. data/docs/file.README.html +5 -3
  87. data/docs/index.html +5 -3
  88. data/docs/method_list.html +644 -508
  89. data/docs/top-level-namespace.html +1 -1
  90. data/lib/puppeteer.rb +7 -1
  91. data/lib/puppeteer/browser_runner.rb +1 -1
  92. data/lib/puppeteer/dom_world.rb +9 -12
  93. data/lib/puppeteer/element_handle.rb +82 -61
  94. data/lib/puppeteer/execution_context.rb +13 -0
  95. data/lib/puppeteer/file_chooser.rb +29 -0
  96. data/lib/puppeteer/frame_manager.rb +0 -2
  97. data/lib/puppeteer/launcher/chrome.rb +48 -2
  98. data/lib/puppeteer/page.rb +85 -52
  99. data/lib/puppeteer/remote_object.rb +6 -1
  100. data/lib/puppeteer/version.rb +1 -1
  101. metadata +5 -2
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Mon May 25 23:22:49 2020 by
117
+ Generated on Thu Jun 4 23:54:42 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 Mon May 25 23:22:49 2020 by
117
+ Generated on Thu Jun 4 23:54:42 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>
@@ -223,7 +223,7 @@
223
223
  </div>
224
224
 
225
225
  <div id="footer">
226
- Generated on Mon May 25 23:22:48 2020 by
226
+ Generated on Thu Jun 4 23:54:41 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 Mon May 25 23:22:49 2020 by
463
+ Generated on Thu Jun 4 23:54:41 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 Mon May 25 23:22:49 2020 by
132
+ Generated on Thu Jun 4 23:54:42 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>
@@ -177,6 +177,54 @@
177
177
 
178
178
  <span class="summary_desc"><div class='inline'></div></span>
179
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
+
180
228
  </li>
181
229
 
182
230
 
@@ -379,6 +427,28 @@
379
427
 
380
428
 
381
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
+
382
452
  <span class="summary_desc"><div class='inline'></div></span>
383
453
 
384
454
  </li>
@@ -483,7 +553,7 @@
483
553
  <li class="public ">
484
554
  <span class="summary_signature">
485
555
 
486
- <a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong> &#x21d2; Object </a>
556
+ <a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong>(&amp;block) &#x21d2; Object </a>
487
557
 
488
558
 
489
559
 
@@ -497,9 +567,7 @@
497
567
 
498
568
 
499
569
 
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>
570
+ <span class="summary_desc"><div class='inline'></div></span>
503
571
 
504
572
  </li>
505
573
 
@@ -521,6 +589,28 @@
521
589
 
522
590
 
523
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
+
524
614
  <span class="summary_desc"><div class='inline'></div></span>
525
615
 
526
616
  </li>
@@ -639,15 +729,15 @@
639
729
  <pre class="lines">
640
730
 
641
731
 
642
- 10
643
- 11
644
732
  12
645
733
  13
646
734
  14
647
- 15</pre>
735
+ 15
736
+ 16
737
+ 17</pre>
648
738
  </td>
649
739
  <td>
650
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 10</span>
740
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 12</span>
651
741
 
652
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>
653
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>
@@ -682,12 +772,12 @@
682
772
  <pre class="lines">
683
773
 
684
774
 
685
- 17
686
- 18
687
- 19</pre>
775
+ 19
776
+ 20
777
+ 21</pre>
688
778
  </td>
689
779
  <td>
690
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 17</span>
780
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 19</span>
691
781
 
692
782
  <span class='kw'>def</span> <span class='id identifier rubyid_as_element'>as_element</span>
693
783
  <span class='kw'>self</span>
@@ -760,12 +850,12 @@
760
850
  <pre class="lines">
761
851
 
762
852
 
763
- 259
764
- 260
765
- 261</pre>
853
+ 264
854
+ 265
855
+ 266</pre>
766
856
  </td>
767
857
  <td>
768
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 259</span>
858
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 264</span>
769
859
 
770
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>
771
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>
@@ -773,6 +863,166 @@
773
863
  </td>
774
864
  </tr>
775
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>
776
1026
  </div>
777
1027
 
778
1028
  <div class="method_details ">
@@ -838,12 +1088,12 @@
838
1088
  <pre class="lines">
839
1089
 
840
1090
 
841
- 245
842
- 246
843
- 247</pre>
1091
+ 250
1092
+ 251
1093
+ 252</pre>
844
1094
  </td>
845
1095
  <td>
846
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 245</span>
1096
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 250</span>
847
1097
 
848
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>
849
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>
@@ -925,14 +1175,14 @@
925
1175
  <pre class="lines">
926
1176
 
927
1177
 
928
- 145
929
- 146
930
1178
  147
931
1179
  148
932
- 149</pre>
1180
+ 149
1181
+ 150
1182
+ 151</pre>
933
1183
  </td>
934
1184
  <td>
935
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 145</span>
1185
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 147</span>
936
1186
 
937
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>
938
1188
  <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
@@ -959,8 +1209,6 @@
959
1209
  <pre class="lines">
960
1210
 
961
1211
 
962
- 83
963
- 84
964
1212
  85
965
1213
  86
966
1214
  87
@@ -980,10 +1228,12 @@
980
1228
  101
981
1229
  102
982
1230
  103
983
- 104</pre>
1231
+ 104
1232
+ 105
1233
+ 106</pre>
984
1234
  </td>
985
1235
  <td>
986
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 83</span>
1236
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 85</span>
987
1237
 
988
1238
  <span class='kw'>def</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
989
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>
@@ -1027,18 +1277,18 @@
1027
1277
  <pre class="lines">
1028
1278
 
1029
1279
 
1030
- 21
1031
- 22
1032
1280
  23
1033
1281
  24
1034
1282
  25
1035
1283
  26
1036
1284
  27
1037
1285
  28
1038
- 29</pre>
1286
+ 29
1287
+ 30
1288
+ 31</pre>
1039
1289
  </td>
1040
1290
  <td>
1041
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 21</span>
1291
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 23</span>
1042
1292
 
1043
1293
  <span class='kw'>def</span> <span class='id identifier rubyid_content_frame'>content_frame</span>
1044
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>
@@ -1069,12 +1319,12 @@
1069
1319
  <pre class="lines">
1070
1320
 
1071
1321
 
1072
- 227
1073
- 228
1074
- 229</pre>
1322
+ 232
1323
+ 233
1324
+ 234</pre>
1075
1325
  </td>
1076
1326
  <td>
1077
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 227</span>
1327
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 232</span>
1078
1328
 
1079
1329
  <span class='kw'>def</span> <span class='id identifier rubyid_focus'>focus</span>
1080
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>
@@ -1136,13 +1386,13 @@
1136
1386
  <pre class="lines">
1137
1387
 
1138
1388
 
1139
- 251
1140
- 252
1141
- 253
1142
- 254</pre>
1389
+ 256
1390
+ 257
1391
+ 258
1392
+ 259</pre>
1143
1393
  </td>
1144
1394
  <td>
1145
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 251</span>
1395
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 256</span>
1146
1396
 
1147
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>
1148
1398
  <span class='id identifier rubyid_focus'>focus</span>
@@ -1194,11 +1444,6 @@
1194
1444
  <pre class="lines">
1195
1445
 
1196
1446
 
1197
- 349
1198
- 350
1199
- 351
1200
- 352
1201
- 353
1202
1447
  354
1203
1448
  355
1204
1449
  356
@@ -1206,10 +1451,15 @@
1206
1451
  358
1207
1452
  359
1208
1453
  360
1209
- 361</pre>
1454
+ 361
1455
+ 362
1456
+ 363
1457
+ 364
1458
+ 365
1459
+ 366</pre>
1210
1460
  </td>
1211
1461
  <td>
1212
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 349</span>
1462
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 354</span>
1213
1463
 
1214
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>
1215
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>
@@ -1244,8 +1494,6 @@
1244
1494
  <pre class="lines">
1245
1495
 
1246
1496
 
1247
- 33
1248
- 34
1249
1497
  35
1250
1498
  36
1251
1499
  37
@@ -1263,10 +1511,12 @@
1263
1511
  49
1264
1512
  50
1265
1513
  51
1266
- 52</pre>
1514
+ 52
1515
+ 53
1516
+ 54</pre>
1267
1517
  </td>
1268
1518
  <td>
1269
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 33</span>
1519
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 35</span>
1270
1520
 
1271
1521
  <span class='kw'>def</span> <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
1272
1522
  <span class='id identifier rubyid_js'>js</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
@@ -1291,6 +1541,104 @@
1291
1541
  </td>
1292
1542
  </tr>
1293
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>
1294
1642
  </div>
1295
1643
 
1296
1644
  <div class="method_details ">
@@ -1358,19 +1706,19 @@
1358
1706
  <pre class="lines">
1359
1707
 
1360
1708
 
1361
- 385
1362
- 386
1363
- 387
1364
- 388
1365
- 389
1366
1709
  390
1367
1710
  391
1368
1711
  392
1369
1712
  393
1370
- 394</pre>
1713
+ 394
1714
+ 395
1715
+ 396
1716
+ 397
1717
+ 398
1718
+ 399</pre>
1371
1719
  </td>
1372
1720
  <td>
1373
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 385</span>
1721
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 390</span>
1374
1722
 
1375
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>
1376
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>
@@ -1428,18 +1776,18 @@
1428
1776
  <pre class="lines">
1429
1777
 
1430
1778
 
1431
- 365
1432
- 366
1433
- 367
1434
- 368
1435
- 369
1436
1779
  370
1437
1780
  371
1438
1781
  372
1439
- 373</pre>
1782
+ 373
1783
+ 374
1784
+ 375
1785
+ 376
1786
+ 377
1787
+ 378</pre>
1440
1788
  </td>
1441
1789
  <td>
1442
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 365</span>
1790
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 370</span>
1443
1791
 
1444
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>
1445
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>
@@ -1520,19 +1868,19 @@
1520
1868
  <pre class="lines">
1521
1869
 
1522
1870
 
1523
- 400
1524
- 401
1525
- 402
1526
- 403
1527
- 404
1528
- 405
1529
- 406
1530
- 407
1531
- 408
1532
- 409</pre>
1871
+ 413
1872
+ 414
1873
+ 415
1874
+ 416
1875
+ 417
1876
+ 418
1877
+ 419
1878
+ 420
1879
+ 421
1880
+ 422</pre>
1533
1881
  </td>
1534
1882
  <td>
1535
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 400</span>
1883
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 413</span>
1536
1884
 
1537
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>
1538
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>
@@ -1603,26 +1951,26 @@
1603
1951
  <pre class="lines">
1604
1952
 
1605
1953
 
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>
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>
1623
1971
  </td>
1624
1972
  <td>
1625
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 414</span>
1973
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 435</span>
1626
1974
 
1627
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>
1628
1976
  <span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
@@ -1649,49 +1997,13 @@
1649
1997
  <div class="method_details ">
1650
1998
  <h3 class="signature " id="tap-instance_method">
1651
1999
 
1652
- #<strong>tap</strong> &#x21d2; <tt>Object</tt>
1653
-
1654
-
2000
+ #<strong>tap</strong>(&amp;block) &#x21d2; <tt>Object</tt>
1655
2001
 
1656
2002
 
1657
2003
 
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
2004
 
1689
- </div>
1690
- </div>
1691
- <div class="tags">
1692
2005
 
1693
-
1694
- </div><table class="source_code">
2006
+ </h3><table class="source_code">
1695
2007
  <tr>
1696
2008
  <td>
1697
2009
  <pre class="lines">
@@ -1701,12 +2013,16 @@
1701
2013
  221
1702
2014
  222
1703
2015
  223
1704
- 224</pre>
2016
+ 224
2017
+ 225
2018
+ 226</pre>
1705
2019
  </td>
1706
2020
  <td>
1707
2021
  <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 220</span>
1708
2022
 
1709
- <span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span>
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
+
1710
2026
  <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
1711
2027
  <span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
1712
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>
@@ -1768,13 +2084,13 @@
1768
2084
  <pre class="lines">
1769
2085
 
1770
2086
 
1771
- 237
1772
- 238
1773
- 239
1774
- 240</pre>
2087
+ 242
2088
+ 243
2089
+ 244
2090
+ 245</pre>
1775
2091
  </td>
1776
2092
  <td>
1777
- <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 237</span>
2093
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 242</span>
1778
2094
 
1779
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>
1780
2096
  <span class='id identifier rubyid_focus'>focus</span>
@@ -1783,6 +2099,114 @@
1783
2099
  </td>
1784
2100
  </tr>
1785
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>
1786
2210
  </div>
1787
2211
 
1788
2212
  </div>
@@ -1790,7 +2214,7 @@
1790
2214
  </div>
1791
2215
 
1792
2216
  <div id="footer">
1793
- Generated on Mon May 25 23:22:50 2020 by
2217
+ Generated on Thu Jun 4 23:54:43 2020 by
1794
2218
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1795
2219
  0.9.24 (ruby-2.6.3).
1796
2220
  </div>