puppeteer-ruby 0.0.6 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/docs/Puppeteer.html +432 -104
- data/docs/Puppeteer/AsyncAwaitBehavior.html +1 -1
- data/docs/Puppeteer/Browser.html +261 -153
- data/docs/Puppeteer/BrowserContext.html +2 -2
- data/docs/Puppeteer/BrowserFetcher.html +1 -1
- data/docs/Puppeteer/BrowserRunner.html +1 -1
- data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +1 -1
- data/docs/Puppeteer/CDPSession.html +2 -2
- data/docs/Puppeteer/CDPSession/Error.html +1 -1
- data/docs/Puppeteer/ConcurrentRubyUtils.html +14 -6
- data/docs/Puppeteer/Connection.html +66 -62
- data/docs/Puppeteer/Connection/MessageCallback.html +1 -1
- data/docs/Puppeteer/Connection/ProtocolError.html +1 -1
- data/docs/Puppeteer/Connection/RequestDebugPrinter.html +5 -5
- data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +12 -12
- data/docs/Puppeteer/ConsoleMessage.html +1 -1
- data/docs/Puppeteer/ConsoleMessage/Location.html +1 -1
- data/docs/Puppeteer/DOMWorld.html +130 -33
- data/docs/Puppeteer/DOMWorld/DetachedError.html +1 -1
- data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +1 -1
- data/docs/Puppeteer/DebugPrint.html +1 -1
- data/docs/Puppeteer/Device.html +1 -1
- data/docs/Puppeteer/Devices.html +1 -1
- data/docs/Puppeteer/ElementHandle.html +960 -218
- data/docs/Puppeteer/ElementHandle/BoundingBox.html +507 -0
- data/docs/Puppeteer/ElementHandle/BoxModel.html +404 -0
- data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +5 -5
- data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +5 -5
- data/docs/Puppeteer/ElementHandle/Point.html +40 -29
- data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +1 -1
- data/docs/Puppeteer/EmulationManager.html +1 -1
- data/docs/Puppeteer/EventCallbackable.html +83 -17
- data/docs/Puppeteer/EventCallbackable/EventListeners.html +1 -1
- data/docs/Puppeteer/ExecutionContext.html +114 -11
- data/docs/Puppeteer/ExecutionContext/EvaluationError.html +1 -1
- data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +1 -1
- data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +1 -1
- data/docs/Puppeteer/FileChooser.html +455 -0
- data/docs/Puppeteer/Frame.html +425 -289
- data/docs/Puppeteer/FrameManager.html +23 -27
- data/docs/Puppeteer/FrameManager/NavigationError.html +1 -1
- data/docs/Puppeteer/IfPresent.html +1 -1
- data/docs/Puppeteer/JSHandle.html +1 -1
- data/docs/Puppeteer/Keyboard.html +1 -1
- data/docs/Puppeteer/Keyboard/KeyDefinition.html +1 -1
- data/docs/Puppeteer/Keyboard/KeyDescription.html +1 -1
- data/docs/Puppeteer/Launcher.html +1 -1
- data/docs/Puppeteer/Launcher/Base.html +1 -1
- data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +1 -1
- data/docs/Puppeteer/Launcher/BrowserOptions.html +1 -1
- data/docs/Puppeteer/Launcher/Chrome.html +64 -23
- data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +1 -1
- data/docs/Puppeteer/Launcher/ChromeArgOptions.html +1 -1
- data/docs/Puppeteer/Launcher/LaunchOptions.html +1 -1
- data/docs/Puppeteer/LifecycleWatcher.html +1 -1
- data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +1 -1
- data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +1 -1
- data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +1 -1
- data/docs/Puppeteer/Mouse.html +31 -41
- data/docs/Puppeteer/Mouse/Button.html +1 -1
- data/docs/Puppeteer/NetworkManager.html +2 -2
- data/docs/Puppeteer/NetworkManager/Credentials.html +1 -1
- data/docs/Puppeteer/Page.html +1049 -354
- data/docs/Puppeteer/Page/FileChooserTimeoutError.html +206 -0
- data/docs/Puppeteer/Page/ScreenshotOptions.html +1 -1
- data/docs/Puppeteer/Page/ScriptTag.html +24 -24
- data/docs/Puppeteer/Page/StyleTag.html +19 -19
- data/docs/Puppeteer/Page/TargetCrashedError.html +1 -1
- data/docs/Puppeteer/RemoteObject.html +173 -37
- data/docs/Puppeteer/Target.html +150 -198
- data/docs/Puppeteer/Target/InitializeFailure.html +1 -1
- data/docs/Puppeteer/Target/TargetInfo.html +1 -1
- data/docs/Puppeteer/TimeoutError.html +2 -2
- data/docs/Puppeteer/TimeoutSettings.html +1 -1
- data/docs/Puppeteer/TouchScreen.html +1 -1
- data/docs/Puppeteer/Viewport.html +81 -1
- data/docs/Puppeteer/WaitTask.html +1 -1
- data/docs/Puppeteer/WaitTask/TerminatedError.html +1 -1
- data/docs/Puppeteer/WaitTask/TimeoutError.html +1 -1
- data/docs/Puppeteer/WebSocket.html +26 -26
- data/docs/Puppeteer/WebSocket/DriverImpl.html +1 -1
- data/docs/Puppeteer/WebSocket/TransportError.html +124 -0
- data/docs/Puppeteer/WebSocketTransport.html +9 -9
- data/docs/Puppeteer/WebSocktTransportError.html +1 -1
- data/docs/_index.html +40 -19
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +7 -3
- data/docs/index.html +7 -3
- data/docs/method_list.html +785 -513
- data/docs/top-level-namespace.html +1 -1
- data/lib/puppeteer.rb +43 -13
- data/lib/puppeteer/browser.rb +26 -6
- data/lib/puppeteer/browser_runner.rb +1 -1
- data/lib/puppeteer/concurrent_ruby_utils.rb +6 -2
- data/lib/puppeteer/connection.rb +13 -1
- data/lib/puppeteer/dom_world.rb +16 -18
- data/lib/puppeteer/element_handle.rb +147 -168
- data/lib/puppeteer/element_handle/bounding_box.rb +12 -0
- data/lib/puppeteer/element_handle/box_model.rb +19 -0
- data/lib/puppeteer/element_handle/point.rb +26 -0
- data/lib/puppeteer/errors.rb +1 -3
- data/lib/puppeteer/event_callbackable.rb +11 -0
- data/lib/puppeteer/execution_context.rb +13 -0
- data/lib/puppeteer/file_chooser.rb +29 -0
- data/lib/puppeteer/frame.rb +19 -1
- data/lib/puppeteer/frame_manager.rb +0 -2
- data/lib/puppeteer/launcher.rb +6 -6
- data/lib/puppeteer/launcher/chrome.rb +49 -3
- data/lib/puppeteer/mouse.rb +3 -8
- data/lib/puppeteer/page.rb +126 -54
- data/lib/puppeteer/remote_object.rb +15 -1
- data/lib/puppeteer/target.rb +25 -25
- data/lib/puppeteer/version.rb +1 -1
- data/lib/puppeteer/viewport.rb +18 -0
- data/lib/puppeteer/web_socket.rb +3 -1
- data/lib/puppeteer/web_socket_transport.rb +8 -8
- data/puppeteer-ruby.png +0 -0
- metadata +12 -4
- data/Dockerfile +0 -6
- data/docker-compose.yml +0 -15
@@ -555,7 +555,7 @@
|
|
555
555
|
</div>
|
556
556
|
|
557
557
|
<div id="footer">
|
558
|
-
Generated on
|
558
|
+
Generated on Tue Jun 23 10:25:00 2020 by
|
559
559
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
560
560
|
0.9.24 (ruby-2.6.3).
|
561
561
|
</div>
|
@@ -423,7 +423,7 @@
|
|
423
423
|
</div>
|
424
424
|
|
425
425
|
<div id="footer">
|
426
|
-
Generated on
|
426
|
+
Generated on Tue Jun 23 10:25:00 2020 by
|
427
427
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
428
428
|
0.9.24 (ruby-2.6.3).
|
429
429
|
</div>
|
@@ -116,7 +116,7 @@
|
|
116
116
|
|
117
117
|
|
118
118
|
|
119
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="DOMWorld/DetachedError.html" title="Puppeteer::DOMWorld::DetachedError (class)">DetachedError</a></span
|
119
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="DOMWorld/DetachedError.html" title="Puppeteer::DOMWorld::DetachedError (class)">DetachedError</a></span>
|
120
120
|
|
121
121
|
|
122
122
|
</p>
|
@@ -461,6 +461,28 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
461
461
|
<p>`$()` in JavaScript.</p>
|
462
462
|
</div></span>
|
463
463
|
|
464
|
+
</li>
|
465
|
+
|
466
|
+
|
467
|
+
<li class="public ">
|
468
|
+
<span class="summary_signature">
|
469
|
+
|
470
|
+
<a href="#select-instance_method" title="#select (instance method)">#<strong>select</strong>(selector, *values) ⇒ Array<String> </a>
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
</span>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
485
|
+
|
464
486
|
</li>
|
465
487
|
|
466
488
|
|
@@ -923,14 +945,14 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
923
945
|
<pre class="lines">
|
924
946
|
|
925
947
|
|
926
|
-
332
|
927
948
|
333
|
928
949
|
334
|
929
950
|
335
|
930
|
-
336
|
951
|
+
336
|
952
|
+
337</pre>
|
931
953
|
</td>
|
932
954
|
<td>
|
933
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
955
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 333</span>
|
934
956
|
|
935
957
|
<span class='kw'>def</span> <span class='id identifier rubyid_click'>click</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</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>
|
936
958
|
<span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#S-instance_method" title="Puppeteer::DOMWorld#S (method)">S</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
@@ -1439,6 +1461,81 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1439
1461
|
</td>
|
1440
1462
|
</tr>
|
1441
1463
|
</table>
|
1464
|
+
</div>
|
1465
|
+
|
1466
|
+
<div class="method_details ">
|
1467
|
+
<h3 class="signature " id="select-instance_method">
|
1468
|
+
|
1469
|
+
#<strong>select</strong>(selector, *values) ⇒ <tt>Array<String></tt>
|
1470
|
+
|
1471
|
+
|
1472
|
+
|
1473
|
+
|
1474
|
+
|
1475
|
+
</h3><div class="docstring">
|
1476
|
+
<div class="discussion">
|
1477
|
+
|
1478
|
+
|
1479
|
+
</div>
|
1480
|
+
</div>
|
1481
|
+
<div class="tags">
|
1482
|
+
<p class="tag_title">Parameters:</p>
|
1483
|
+
<ul class="param">
|
1484
|
+
|
1485
|
+
<li>
|
1486
|
+
|
1487
|
+
<span class='name'>selector</span>
|
1488
|
+
|
1489
|
+
|
1490
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1491
|
+
|
1492
|
+
|
1493
|
+
|
1494
|
+
</li>
|
1495
|
+
|
1496
|
+
</ul>
|
1497
|
+
|
1498
|
+
<p class="tag_title">Returns:</p>
|
1499
|
+
<ul class="return">
|
1500
|
+
|
1501
|
+
<li>
|
1502
|
+
|
1503
|
+
|
1504
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
1505
|
+
|
1506
|
+
|
1507
|
+
|
1508
|
+
</li>
|
1509
|
+
|
1510
|
+
</ul>
|
1511
|
+
|
1512
|
+
</div><table class="source_code">
|
1513
|
+
<tr>
|
1514
|
+
<td>
|
1515
|
+
<pre class="lines">
|
1516
|
+
|
1517
|
+
|
1518
|
+
361
|
1519
|
+
362
|
1520
|
+
363
|
1521
|
+
364
|
1522
|
+
365
|
1523
|
+
366
|
1524
|
+
367</pre>
|
1525
|
+
</td>
|
1526
|
+
<td>
|
1527
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 361</span>
|
1528
|
+
|
1529
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
|
1530
|
+
<span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#S-instance_method" title="Puppeteer::DOMWorld#S (method)">S</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
1531
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_handle'>handle</span><span class='period'>.</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>
|
1532
|
+
<span class='id identifier rubyid_handle'>handle</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
1533
|
+
|
1534
|
+
<span class='id identifier rubyid_result'>result</span>
|
1535
|
+
<span class='kw'>end</span></pre>
|
1536
|
+
</td>
|
1537
|
+
</tr>
|
1538
|
+
</table>
|
1442
1539
|
</div>
|
1443
1540
|
|
1444
1541
|
<div class="method_details ">
|
@@ -1517,12 +1614,12 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1517
1614
|
<pre class="lines">
|
1518
1615
|
|
1519
1616
|
|
1520
|
-
129
|
1521
1617
|
130
|
1522
|
-
131
|
1618
|
+
131
|
1619
|
+
132</pre>
|
1523
1620
|
</td>
|
1524
1621
|
<td>
|
1525
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
1622
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 130</span>
|
1526
1623
|
|
1527
1624
|
<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>
|
1528
1625
|
<span class='id identifier rubyid_document'>document</span><span class='period'>.</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>
|
@@ -1586,12 +1683,12 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1586
1683
|
<pre class="lines">
|
1587
1684
|
|
1588
1685
|
|
1589
|
-
145
|
1590
1686
|
146
|
1591
|
-
147
|
1687
|
+
147
|
1688
|
+
148</pre>
|
1592
1689
|
</td>
|
1593
1690
|
<td>
|
1594
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
1691
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 146</span>
|
1595
1692
|
|
1596
1693
|
<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>
|
1597
1694
|
<span class='id identifier rubyid_document'>document</span><span class='period'>.</span><span class='const'>SS</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
@@ -1677,12 +1774,12 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1677
1774
|
<pre class="lines">
|
1678
1775
|
|
1679
1776
|
|
1680
|
-
138
|
1681
1777
|
139
|
1682
|
-
140
|
1778
|
+
140
|
1779
|
+
141</pre>
|
1683
1780
|
</td>
|
1684
1781
|
<td>
|
1685
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
1782
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 139</span>
|
1686
1783
|
|
1687
1784
|
<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>
|
1688
1785
|
<span class='id identifier rubyid_document'>document</span><span class='period'>.</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>
|
@@ -1746,12 +1843,12 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1746
1843
|
<pre class="lines">
|
1747
1844
|
|
1748
1845
|
|
1749
|
-
120
|
1750
1846
|
121
|
1751
|
-
122
|
1847
|
+
122
|
1848
|
+
123</pre>
|
1752
1849
|
</td>
|
1753
1850
|
<td>
|
1754
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
1851
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 121</span>
|
1755
1852
|
|
1756
1853
|
<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>
|
1757
1854
|
<span class='id identifier rubyid_document'>document</span><span class='period'>.</span><span class='const'>Sx</span><span class='lparen'>(</span><span class='id identifier rubyid_expression'>expression</span><span class='rparen'>)</span>
|
@@ -1800,14 +1897,14 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1800
1897
|
<pre class="lines">
|
1801
1898
|
|
1802
1899
|
|
1900
|
+
370
|
1901
|
+
371
|
1803
1902
|
372
|
1804
1903
|
373
|
1805
|
-
374
|
1806
|
-
375
|
1807
|
-
376</pre>
|
1904
|
+
374</pre>
|
1808
1905
|
</td>
|
1809
1906
|
<td>
|
1810
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
1907
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 370</span>
|
1811
1908
|
|
1812
1909
|
<span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
1813
1910
|
<span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#S-instance_method" title="Puppeteer::DOMWorld#S (method)">S</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
@@ -1882,14 +1979,14 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1882
1979
|
<pre class="lines">
|
1883
1980
|
|
1884
1981
|
|
1982
|
+
379
|
1983
|
+
380
|
1885
1984
|
381
|
1886
1985
|
382
|
1887
|
-
383
|
1888
|
-
384
|
1889
|
-
385</pre>
|
1986
|
+
383</pre>
|
1890
1987
|
</td>
|
1891
1988
|
<td>
|
1892
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
1989
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 379</span>
|
1893
1990
|
|
1894
1991
|
<span class='kw'>def</span> <span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</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>
|
1895
1992
|
<span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#S-instance_method" title="Puppeteer::DOMWorld#S (method)">S</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
@@ -1989,12 +2086,12 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
1989
2086
|
<pre class="lines">
|
1990
2087
|
|
1991
2088
|
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
2089
|
+
389
|
2090
|
+
390
|
2091
|
+
391</pre>
|
1995
2092
|
</td>
|
1996
2093
|
<td>
|
1997
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
2094
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 389</span>
|
1998
2095
|
|
1999
2096
|
<span class='kw'>def</span> <span class='id identifier rubyid_wait_for_selector'>wait_for_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='label'>visible:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>hidden:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>timeout:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2000
2097
|
<span class='id identifier rubyid_wait_for_selector_or_xpath'>wait_for_selector_or_xpath</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>visible:</span> <span class='id identifier rubyid_visible'>visible</span><span class='comma'>,</span> <span class='label'>hidden:</span> <span class='id identifier rubyid_hidden'>hidden</span><span class='comma'>,</span> <span class='label'>timeout:</span> <span class='id identifier rubyid_timeout'>timeout</span><span class='rparen'>)</span>
|
@@ -2092,12 +2189,12 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
2092
2189
|
<pre class="lines">
|
2093
2190
|
|
2094
2191
|
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2192
|
+
397
|
2193
|
+
398
|
2194
|
+
399</pre>
|
2098
2195
|
</td>
|
2099
2196
|
<td>
|
2100
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line
|
2197
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/dom_world.rb', line 397</span>
|
2101
2198
|
|
2102
2199
|
<span class='kw'>def</span> <span class='id identifier rubyid_wait_for_xpath'>wait_for_xpath</span><span class='lparen'>(</span><span class='id identifier rubyid_xpath'>xpath</span><span class='comma'>,</span> <span class='label'>visible:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>hidden:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>timeout:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2103
2200
|
<span class='id identifier rubyid_wait_for_selector_or_xpath'>wait_for_selector_or_xpath</span><span class='lparen'>(</span><span class='id identifier rubyid_xpath'>xpath</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>visible:</span> <span class='id identifier rubyid_visible'>visible</span><span class='comma'>,</span> <span class='label'>hidden:</span> <span class='id identifier rubyid_hidden'>hidden</span><span class='comma'>,</span> <span class='label'>timeout:</span> <span class='id identifier rubyid_timeout'>timeout</span><span class='rparen'>)</span>
|
@@ -2112,7 +2209,7 @@ function _(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
|
|
2112
2209
|
</div>
|
2113
2210
|
|
2114
2211
|
<div id="footer">
|
2115
|
-
Generated on
|
2212
|
+
Generated on Tue Jun 23 10:24:59 2020 by
|
2116
2213
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2117
2214
|
0.9.24 (ruby-2.6.3).
|
2118
2215
|
</div>
|
@@ -114,7 +114,7 @@
|
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div id="footer">
|
117
|
-
Generated on
|
117
|
+
Generated on Tue Jun 23 10:24:59 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
|
117
|
+
Generated on Fri Jun 12 12:38:34 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
|
226
|
+
Generated on Tue Jun 23 10:24:58 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>
|
data/docs/Puppeteer/Device.html
CHANGED
@@ -460,7 +460,7 @@
|
|
460
460
|
</div>
|
461
461
|
|
462
462
|
<div id="footer">
|
463
|
-
Generated on
|
463
|
+
Generated on Tue Jun 23 10:24:59 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>
|
data/docs/Puppeteer/Devices.html
CHANGED
@@ -129,7 +129,7 @@
|
|
129
129
|
</div>
|
130
130
|
|
131
131
|
<div id="footer">
|
132
|
-
Generated on
|
132
|
+
Generated on Tue Jun 23 10:24:59 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>
|
@@ -101,7 +101,9 @@
|
|
101
101
|
|
102
102
|
<dl>
|
103
103
|
<dt>Defined in:</dt>
|
104
|
-
<dd>lib/puppeteer/element_handle.rb
|
104
|
+
<dd>lib/puppeteer/element_handle.rb<span class="defines">,<br />
|
105
|
+
lib/puppeteer/element_handle/point.rb,<br /> lib/puppeteer/element_handle/box_model.rb,<br /> lib/puppeteer/element_handle/bounding_box.rb</span>
|
106
|
+
</dd>
|
105
107
|
</dl>
|
106
108
|
|
107
109
|
</div>
|
@@ -112,7 +114,7 @@
|
|
112
114
|
|
113
115
|
|
114
116
|
|
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>
|
117
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span>, <span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span>, <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
118
|
|
117
119
|
|
118
120
|
</p>
|
@@ -177,6 +179,54 @@
|
|
177
179
|
|
178
180
|
<span class="summary_desc"><div class='inline'></div></span>
|
179
181
|
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#async_Seval-instance_method" title="#async_Seval (instance method)">#<strong>async_Seval</strong> ⇒ Object </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'>
|
203
|
+
<p>`$eval()` in JavaScript.</p>
|
204
|
+
</div></span>
|
205
|
+
|
206
|
+
</li>
|
207
|
+
|
208
|
+
|
209
|
+
<li class="public ">
|
210
|
+
<span class="summary_signature">
|
211
|
+
|
212
|
+
<a href="#async_SSeval-instance_method" title="#async_SSeval (instance method)">#<strong>async_SSeval</strong> ⇒ Object </a>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
</span>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<span class="summary_desc"><div class='inline'>
|
227
|
+
<p>`$$eval()` in JavaScript.</p>
|
228
|
+
</div></span>
|
229
|
+
|
180
230
|
</li>
|
181
231
|
|
182
232
|
|
@@ -197,6 +247,50 @@
|
|
197
247
|
|
198
248
|
|
199
249
|
|
250
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
251
|
+
|
252
|
+
</li>
|
253
|
+
|
254
|
+
|
255
|
+
<li class="public ">
|
256
|
+
<span class="summary_signature">
|
257
|
+
|
258
|
+
<a href="#bounding_box-instance_method" title="#bounding_box (instance method)">#<strong>bounding_box</strong> ⇒ BoundingBox|nil </a>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
</span>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
<li class="public ">
|
278
|
+
<span class="summary_signature">
|
279
|
+
|
280
|
+
<a href="#box_model-instance_method" title="#box_model (instance method)">#<strong>box_model</strong> ⇒ BoxModel|nil </a>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
</span>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
200
294
|
<span class="summary_desc"><div class='inline'></div></span>
|
201
295
|
|
202
296
|
</li>
|
@@ -359,6 +453,28 @@
|
|
359
453
|
<p>`$()` in JavaScript.</p>
|
360
454
|
</div></span>
|
361
455
|
|
456
|
+
</li>
|
457
|
+
|
458
|
+
|
459
|
+
<li class="public ">
|
460
|
+
<span class="summary_signature">
|
461
|
+
|
462
|
+
<a href="#screenshot-instance_method" title="#screenshot (instance method)">#<strong>screenshot</strong>(options = {}) ⇒ Object </a>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
</span>
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
477
|
+
|
362
478
|
</li>
|
363
479
|
|
364
480
|
|
@@ -379,6 +495,28 @@
|
|
379
495
|
|
380
496
|
|
381
497
|
|
498
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
499
|
+
|
500
|
+
</li>
|
501
|
+
|
502
|
+
|
503
|
+
<li class="public ">
|
504
|
+
<span class="summary_signature">
|
505
|
+
|
506
|
+
<a href="#select-instance_method" title="#select (instance method)">#<strong>select</strong>(*values) ⇒ Array<String> </a>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</span>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
382
520
|
<span class="summary_desc"><div class='inline'></div></span>
|
383
521
|
|
384
522
|
</li>
|
@@ -483,7 +621,7 @@
|
|
483
621
|
<li class="public ">
|
484
622
|
<span class="summary_signature">
|
485
623
|
|
486
|
-
<a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong> ⇒ Object </a>
|
624
|
+
<a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong>(&block) ⇒ Object </a>
|
487
625
|
|
488
626
|
|
489
627
|
|
@@ -497,9 +635,7 @@
|
|
497
635
|
|
498
636
|
|
499
637
|
|
500
|
-
<span class="summary_desc"><div class='inline'>
|
501
|
-
<p>const promises = filePaths.map(filePath => readFileAsync(filePath)); const files = []; for (let i = 0; i < 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('base64'), mimeType: mime.lookup(filePath), }; files.push(file); } await this.evaluateHandle(async(element, files) => { 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('input', { bubbles: true })); element.dispatchEvent(new Event('change', { bubbles: true })); }, files); }.</p>
|
502
|
-
</div></span>
|
638
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
503
639
|
|
504
640
|
</li>
|
505
641
|
|
@@ -521,6 +657,28 @@
|
|
521
657
|
|
522
658
|
|
523
659
|
|
660
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
661
|
+
|
662
|
+
</li>
|
663
|
+
|
664
|
+
|
665
|
+
<li class="public ">
|
666
|
+
<span class="summary_signature">
|
667
|
+
|
668
|
+
<a href="#upload_file-instance_method" title="#upload_file (instance method)">#<strong>upload_file</strong>(*file_paths) ⇒ Object </a>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
</span>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
|
524
682
|
<span class="summary_desc"><div class='inline'></div></span>
|
525
683
|
|
526
684
|
</li>
|
@@ -639,15 +797,15 @@
|
|
639
797
|
<pre class="lines">
|
640
798
|
|
641
799
|
|
642
|
-
10
|
643
|
-
11
|
644
|
-
12
|
645
|
-
13
|
646
800
|
14
|
647
|
-
15
|
801
|
+
15
|
802
|
+
16
|
803
|
+
17
|
804
|
+
18
|
805
|
+
19</pre>
|
648
806
|
</td>
|
649
807
|
<td>
|
650
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
808
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 14</span>
|
651
809
|
|
652
810
|
<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
811
|
<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 +840,12 @@
|
|
682
840
|
<pre class="lines">
|
683
841
|
|
684
842
|
|
685
|
-
|
686
|
-
|
687
|
-
|
843
|
+
21
|
844
|
+
22
|
845
|
+
23</pre>
|
688
846
|
</td>
|
689
847
|
<td>
|
690
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
848
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 21</span>
|
691
849
|
|
692
850
|
<span class='kw'>def</span> <span class='id identifier rubyid_as_element'>as_element</span>
|
693
851
|
<span class='kw'>self</span>
|
@@ -760,12 +918,12 @@
|
|
760
918
|
<pre class="lines">
|
761
919
|
|
762
920
|
|
763
|
-
|
764
|
-
|
765
|
-
|
921
|
+
234
|
922
|
+
235
|
923
|
+
236</pre>
|
766
924
|
</td>
|
767
925
|
<td>
|
768
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
926
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 234</span>
|
769
927
|
|
770
928
|
<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
929
|
<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>
|
@@ -776,9 +934,321 @@
|
|
776
934
|
</div>
|
777
935
|
|
778
936
|
<div class="method_details ">
|
779
|
-
<h3 class="signature " id="
|
937
|
+
<h3 class="signature " id="async_Seval-instance_method">
|
938
|
+
|
939
|
+
#<strong>async_Seval</strong> ⇒ <tt>Object</tt>
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
</h3><div class="docstring">
|
946
|
+
<div class="discussion">
|
947
|
+
|
948
|
+
<p>`$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
949
|
+
|
950
|
+
|
951
|
+
</div>
|
952
|
+
</div>
|
953
|
+
<div class="tags">
|
954
|
+
<p class="tag_title">Parameters:</p>
|
955
|
+
<ul class="param">
|
956
|
+
|
957
|
+
<li>
|
958
|
+
|
959
|
+
<span class='name'>selector</span>
|
960
|
+
|
961
|
+
|
962
|
+
<span class='type'>(<tt>String</tt>)</span>
|
963
|
+
|
964
|
+
|
965
|
+
|
966
|
+
</li>
|
967
|
+
|
968
|
+
<li>
|
969
|
+
|
970
|
+
<span class='name'>page_function</span>
|
971
|
+
|
972
|
+
|
973
|
+
<span class='type'>(<tt>String</tt>)</span>
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
</li>
|
978
|
+
|
979
|
+
</ul>
|
980
|
+
|
981
|
+
<p class="tag_title">Returns:</p>
|
982
|
+
<ul class="return">
|
983
|
+
|
984
|
+
<li>
|
985
|
+
|
986
|
+
|
987
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
988
|
+
|
989
|
+
|
990
|
+
|
991
|
+
</li>
|
992
|
+
|
993
|
+
</ul>
|
994
|
+
|
995
|
+
</div><table class="source_code">
|
996
|
+
<tr>
|
997
|
+
<td>
|
998
|
+
<pre class="lines">
|
999
|
+
|
1000
|
+
|
1001
|
+
363
|
1002
|
+
364
|
1003
|
+
365</pre>
|
1004
|
+
</td>
|
1005
|
+
<td>
|
1006
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 363</span>
|
1007
|
+
|
1008
|
+
<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>
|
1009
|
+
<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>
|
1010
|
+
<span class='kw'>end</span></pre>
|
1011
|
+
</td>
|
1012
|
+
</tr>
|
1013
|
+
</table>
|
1014
|
+
</div>
|
1015
|
+
|
1016
|
+
<div class="method_details ">
|
1017
|
+
<h3 class="signature " id="async_SSeval-instance_method">
|
1018
|
+
|
1019
|
+
#<strong>async_SSeval</strong> ⇒ <tt>Object</tt>
|
1020
|
+
|
1021
|
+
|
1022
|
+
|
1023
|
+
|
1024
|
+
|
1025
|
+
</h3><div class="docstring">
|
1026
|
+
<div class="discussion">
|
1027
|
+
|
1028
|
+
<p>`$$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
1029
|
+
|
1030
|
+
|
1031
|
+
</div>
|
1032
|
+
</div>
|
1033
|
+
<div class="tags">
|
1034
|
+
<p class="tag_title">Parameters:</p>
|
1035
|
+
<ul class="param">
|
1036
|
+
|
1037
|
+
<li>
|
1038
|
+
|
1039
|
+
<span class='name'>selector</span>
|
1040
|
+
|
1041
|
+
|
1042
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
</li>
|
1047
|
+
|
1048
|
+
<li>
|
1049
|
+
|
1050
|
+
<span class='name'>page_function</span>
|
1051
|
+
|
1052
|
+
|
1053
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1054
|
+
|
1055
|
+
|
1056
|
+
|
1057
|
+
</li>
|
1058
|
+
|
1059
|
+
</ul>
|
1060
|
+
|
1061
|
+
<p class="tag_title">Returns:</p>
|
1062
|
+
<ul class="return">
|
1063
|
+
|
1064
|
+
<li>
|
1065
|
+
|
1066
|
+
|
1067
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1068
|
+
|
1069
|
+
|
1070
|
+
|
1071
|
+
</li>
|
1072
|
+
|
1073
|
+
</ul>
|
1074
|
+
|
1075
|
+
</div><table class="source_code">
|
1076
|
+
<tr>
|
1077
|
+
<td>
|
1078
|
+
<pre class="lines">
|
1079
|
+
|
1080
|
+
|
1081
|
+
386
|
1082
|
+
387
|
1083
|
+
388</pre>
|
1084
|
+
</td>
|
1085
|
+
<td>
|
1086
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 386</span>
|
1087
|
+
|
1088
|
+
<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>
|
1089
|
+
<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>
|
1090
|
+
<span class='kw'>end</span></pre>
|
1091
|
+
</td>
|
1092
|
+
</tr>
|
1093
|
+
</table>
|
1094
|
+
</div>
|
1095
|
+
|
1096
|
+
<div class="method_details ">
|
1097
|
+
<h3 class="signature " id="async_type_text-instance_method">
|
1098
|
+
|
1099
|
+
#<strong>async_type_text</strong> ⇒ <tt>Future</tt>
|
1100
|
+
|
1101
|
+
|
1102
|
+
|
1103
|
+
|
1104
|
+
|
1105
|
+
</h3><div class="docstring">
|
1106
|
+
<div class="discussion">
|
1107
|
+
|
1108
|
+
|
1109
|
+
</div>
|
1110
|
+
</div>
|
1111
|
+
<div class="tags">
|
1112
|
+
<p class="tag_title">Parameters:</p>
|
1113
|
+
<ul class="param">
|
1114
|
+
|
1115
|
+
<li>
|
1116
|
+
|
1117
|
+
<span class='name'>text</span>
|
1118
|
+
|
1119
|
+
|
1120
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1121
|
+
|
1122
|
+
|
1123
|
+
|
1124
|
+
</li>
|
1125
|
+
|
1126
|
+
<li>
|
1127
|
+
|
1128
|
+
<span class='name'>delay</span>
|
1129
|
+
|
1130
|
+
|
1131
|
+
<span class='type'>(<tt>number|nil</tt>)</span>
|
1132
|
+
|
1133
|
+
|
1134
|
+
|
1135
|
+
</li>
|
1136
|
+
|
1137
|
+
</ul>
|
1138
|
+
|
1139
|
+
<p class="tag_title">Returns:</p>
|
1140
|
+
<ul class="return">
|
1141
|
+
|
1142
|
+
<li>
|
1143
|
+
|
1144
|
+
|
1145
|
+
<span class='type'>(<tt>Future</tt>)</span>
|
1146
|
+
|
1147
|
+
|
1148
|
+
|
1149
|
+
</li>
|
1150
|
+
|
1151
|
+
</ul>
|
1152
|
+
|
1153
|
+
</div><table class="source_code">
|
1154
|
+
<tr>
|
1155
|
+
<td>
|
1156
|
+
<pre class="lines">
|
1157
|
+
|
1158
|
+
|
1159
|
+
220
|
1160
|
+
221
|
1161
|
+
222</pre>
|
1162
|
+
</td>
|
1163
|
+
<td>
|
1164
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 220</span>
|
1165
|
+
|
1166
|
+
<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>
|
1167
|
+
<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>
|
1168
|
+
<span class='kw'>end</span></pre>
|
1169
|
+
</td>
|
1170
|
+
</tr>
|
1171
|
+
</table>
|
1172
|
+
</div>
|
1173
|
+
|
1174
|
+
<div class="method_details ">
|
1175
|
+
<h3 class="signature " id="bounding_box-instance_method">
|
1176
|
+
|
1177
|
+
#<strong>bounding_box</strong> ⇒ <tt><span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span>|nil</tt>
|
1178
|
+
|
1179
|
+
|
1180
|
+
|
1181
|
+
|
1182
|
+
|
1183
|
+
</h3><div class="docstring">
|
1184
|
+
<div class="discussion">
|
1185
|
+
|
1186
|
+
|
1187
|
+
</div>
|
1188
|
+
</div>
|
1189
|
+
<div class="tags">
|
1190
|
+
|
1191
|
+
<p class="tag_title">Returns:</p>
|
1192
|
+
<ul class="return">
|
1193
|
+
|
1194
|
+
<li>
|
1195
|
+
|
1196
|
+
|
1197
|
+
<span class='type'>(<tt><span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span>|nil</tt>)</span>
|
1198
|
+
|
1199
|
+
|
1200
|
+
|
1201
|
+
</li>
|
1202
|
+
|
1203
|
+
</ul>
|
1204
|
+
|
1205
|
+
</div><table class="source_code">
|
1206
|
+
<tr>
|
1207
|
+
<td>
|
1208
|
+
<pre class="lines">
|
1209
|
+
|
1210
|
+
|
1211
|
+
239
|
1212
|
+
240
|
1213
|
+
241
|
1214
|
+
242
|
1215
|
+
243
|
1216
|
+
244
|
1217
|
+
245
|
1218
|
+
246
|
1219
|
+
247
|
1220
|
+
248
|
1221
|
+
249
|
1222
|
+
250
|
1223
|
+
251
|
1224
|
+
252</pre>
|
1225
|
+
</td>
|
1226
|
+
<td>
|
1227
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 239</span>
|
1228
|
+
|
1229
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_bounding_box'>bounding_box</span>
|
1230
|
+
<span class='id identifier rubyid_if_present'>if_present</span><span class='lparen'>(</span><span class='id identifier rubyid_box_model'>box_model</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_result_model'>result_model</span><span class='op'>|</span>
|
1231
|
+
<span class='id identifier rubyid_quads'>quads</span> <span class='op'>=</span> <span class='id identifier rubyid_result_model'>result_model</span><span class='period'>.</span><span class='id identifier rubyid_border'>border</span>
|
1232
|
+
|
1233
|
+
<span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:x</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
|
1234
|
+
<span class='id identifier rubyid_y'>y</span> <span class='op'>=</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:y</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
|
1235
|
+
<span class='const'><span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/BoundingBox.html#initialize-instance_method" title="Puppeteer::ElementHandle::BoundingBox#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
1236
|
+
<span class='label'>x:</span> <span class='id identifier rubyid_x'>x</span><span class='comma'>,</span>
|
1237
|
+
<span class='label'>y:</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span>
|
1238
|
+
<span class='label'>width:</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:x</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>-</span> <span class='id identifier rubyid_x'>x</span><span class='comma'>,</span>
|
1239
|
+
<span class='label'>height:</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:y</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>-</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span>
|
1240
|
+
<span class='rparen'>)</span>
|
1241
|
+
<span class='kw'>end</span>
|
1242
|
+
<span class='kw'>end</span></pre>
|
1243
|
+
</td>
|
1244
|
+
</tr>
|
1245
|
+
</table>
|
1246
|
+
</div>
|
1247
|
+
|
1248
|
+
<div class="method_details ">
|
1249
|
+
<h3 class="signature " id="box_model-instance_method">
|
780
1250
|
|
781
|
-
#<strong>
|
1251
|
+
#<strong>box_model</strong> ⇒ <tt><span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span>|nil</tt>
|
782
1252
|
|
783
1253
|
|
784
1254
|
|
@@ -791,40 +1261,14 @@
|
|
791
1261
|
</div>
|
792
1262
|
</div>
|
793
1263
|
<div class="tags">
|
794
|
-
<p class="tag_title">Parameters:</p>
|
795
|
-
<ul class="param">
|
796
|
-
|
797
|
-
<li>
|
798
|
-
|
799
|
-
<span class='name'>text</span>
|
800
|
-
|
801
|
-
|
802
|
-
<span class='type'>(<tt>String</tt>)</span>
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
</li>
|
807
|
-
|
808
|
-
<li>
|
809
|
-
|
810
|
-
<span class='name'>delay</span>
|
811
|
-
|
812
|
-
|
813
|
-
<span class='type'>(<tt>number|nil</tt>)</span>
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
</li>
|
818
1264
|
|
819
|
-
</ul>
|
820
|
-
|
821
1265
|
<p class="tag_title">Returns:</p>
|
822
1266
|
<ul class="return">
|
823
1267
|
|
824
1268
|
<li>
|
825
1269
|
|
826
1270
|
|
827
|
-
<span class='type'>(<tt>
|
1271
|
+
<span class='type'>(<tt><span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span>|nil</tt>)</span>
|
828
1272
|
|
829
1273
|
|
830
1274
|
|
@@ -838,15 +1282,19 @@
|
|
838
1282
|
<pre class="lines">
|
839
1283
|
|
840
1284
|
|
841
|
-
|
842
|
-
|
843
|
-
|
1285
|
+
255
|
1286
|
+
256
|
1287
|
+
257
|
1288
|
+
258
|
1289
|
+
259</pre>
|
844
1290
|
</td>
|
845
1291
|
<td>
|
846
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1292
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 255</span>
|
847
1293
|
|
848
|
-
<span class='
|
849
|
-
<span class='id identifier
|
1294
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_box_model'>box_model</span>
|
1295
|
+
<span class='id identifier rubyid_if_present'>if_present</span><span class='lparen'>(</span><span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_box_model'>box_model</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_result'>result</span><span class='op'>|</span>
|
1296
|
+
<span class='const'><span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/BoxModel.html#initialize-instance_method" title="Puppeteer::ElementHandle::BoxModel#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>model</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1297
|
+
<span class='kw'>end</span>
|
850
1298
|
<span class='kw'>end</span></pre>
|
851
1299
|
</td>
|
852
1300
|
</tr>
|
@@ -925,14 +1373,14 @@
|
|
925
1373
|
<pre class="lines">
|
926
1374
|
|
927
1375
|
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
1376
|
+
117
|
1377
|
+
118
|
1378
|
+
119
|
1379
|
+
120
|
1380
|
+
121</pre>
|
933
1381
|
</td>
|
934
1382
|
<td>
|
935
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1383
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 117</span>
|
936
1384
|
|
937
1385
|
<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
1386
|
<span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
@@ -959,31 +1407,31 @@
|
|
959
1407
|
<pre class="lines">
|
960
1408
|
|
961
1409
|
|
1410
|
+
64
|
1411
|
+
65
|
1412
|
+
66
|
1413
|
+
67
|
1414
|
+
68
|
1415
|
+
69
|
1416
|
+
70
|
1417
|
+
71
|
1418
|
+
72
|
1419
|
+
73
|
1420
|
+
74
|
1421
|
+
75
|
1422
|
+
76
|
1423
|
+
77
|
1424
|
+
78
|
1425
|
+
79
|
1426
|
+
80
|
1427
|
+
81
|
1428
|
+
82
|
962
1429
|
83
|
963
1430
|
84
|
964
|
-
85
|
965
|
-
86
|
966
|
-
87
|
967
|
-
88
|
968
|
-
89
|
969
|
-
90
|
970
|
-
91
|
971
|
-
92
|
972
|
-
93
|
973
|
-
94
|
974
|
-
95
|
975
|
-
96
|
976
|
-
97
|
977
|
-
98
|
978
|
-
99
|
979
|
-
100
|
980
|
-
101
|
981
|
-
102
|
982
|
-
103
|
983
|
-
104</pre>
|
1431
|
+
85</pre>
|
984
1432
|
</td>
|
985
1433
|
<td>
|
986
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1434
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 64</span>
|
987
1435
|
|
988
1436
|
<span class='kw'>def</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
|
989
1437
|
<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 +1475,18 @@
|
|
1027
1475
|
<pre class="lines">
|
1028
1476
|
|
1029
1477
|
|
1030
|
-
21
|
1031
|
-
22
|
1032
|
-
23
|
1033
|
-
24
|
1034
1478
|
25
|
1035
1479
|
26
|
1036
1480
|
27
|
1037
1481
|
28
|
1038
|
-
29
|
1482
|
+
29
|
1483
|
+
30
|
1484
|
+
31
|
1485
|
+
32
|
1486
|
+
33</pre>
|
1039
1487
|
</td>
|
1040
1488
|
<td>
|
1041
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1489
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 25</span>
|
1042
1490
|
|
1043
1491
|
<span class='kw'>def</span> <span class='id identifier rubyid_content_frame'>content_frame</span>
|
1044
1492
|
<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 +1517,12 @@
|
|
1069
1517
|
<pre class="lines">
|
1070
1518
|
|
1071
1519
|
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1520
|
+
202
|
1521
|
+
203
|
1522
|
+
204</pre>
|
1075
1523
|
</td>
|
1076
1524
|
<td>
|
1077
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1525
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 202</span>
|
1078
1526
|
|
1079
1527
|
<span class='kw'>def</span> <span class='id identifier rubyid_focus'>focus</span>
|
1080
1528
|
<span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>element => element.focus()</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
@@ -1136,13 +1584,13 @@
|
|
1136
1584
|
<pre class="lines">
|
1137
1585
|
|
1138
1586
|
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1587
|
+
226
|
1588
|
+
227
|
1589
|
+
228
|
1590
|
+
229</pre>
|
1143
1591
|
</td>
|
1144
1592
|
<td>
|
1145
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1593
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 226</span>
|
1146
1594
|
|
1147
1595
|
<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
1596
|
<span class='id identifier rubyid_focus'>focus</span>
|
@@ -1194,22 +1642,22 @@
|
|
1194
1642
|
<pre class="lines">
|
1195
1643
|
|
1196
1644
|
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1645
|
+
312
|
1646
|
+
313
|
1647
|
+
314
|
1648
|
+
315
|
1649
|
+
316
|
1650
|
+
317
|
1651
|
+
318
|
1652
|
+
319
|
1653
|
+
320
|
1654
|
+
321
|
1655
|
+
322
|
1656
|
+
323
|
1657
|
+
324</pre>
|
1210
1658
|
</td>
|
1211
1659
|
<td>
|
1212
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1660
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 312</span>
|
1213
1661
|
|
1214
1662
|
<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
1663
|
<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>
|
@@ -1227,6 +1675,126 @@
|
|
1227
1675
|
</td>
|
1228
1676
|
</tr>
|
1229
1677
|
</table>
|
1678
|
+
</div>
|
1679
|
+
|
1680
|
+
<div class="method_details ">
|
1681
|
+
<h3 class="signature " id="screenshot-instance_method">
|
1682
|
+
|
1683
|
+
#<strong>screenshot</strong>(options = {}) ⇒ <tt>Object</tt>
|
1684
|
+
|
1685
|
+
|
1686
|
+
|
1687
|
+
|
1688
|
+
|
1689
|
+
</h3><table class="source_code">
|
1690
|
+
<tr>
|
1691
|
+
<td>
|
1692
|
+
<pre class="lines">
|
1693
|
+
|
1694
|
+
|
1695
|
+
261
|
1696
|
+
262
|
1697
|
+
263
|
1698
|
+
264
|
1699
|
+
265
|
1700
|
+
266
|
1701
|
+
267
|
1702
|
+
268
|
1703
|
+
269
|
1704
|
+
270
|
1705
|
+
271
|
1706
|
+
272
|
1707
|
+
273
|
1708
|
+
274
|
1709
|
+
275
|
1710
|
+
276
|
1711
|
+
277
|
1712
|
+
278
|
1713
|
+
279
|
1714
|
+
280
|
1715
|
+
281
|
1716
|
+
282
|
1717
|
+
283
|
1718
|
+
284
|
1719
|
+
285
|
1720
|
+
286
|
1721
|
+
287
|
1722
|
+
288
|
1723
|
+
289
|
1724
|
+
290
|
1725
|
+
291
|
1726
|
+
292
|
1727
|
+
293
|
1728
|
+
294
|
1729
|
+
295
|
1730
|
+
296
|
1731
|
+
297
|
1732
|
+
298
|
1733
|
+
299
|
1734
|
+
300
|
1735
|
+
301
|
1736
|
+
302
|
1737
|
+
303
|
1738
|
+
304
|
1739
|
+
305
|
1740
|
+
306
|
1741
|
+
307
|
1742
|
+
308</pre>
|
1743
|
+
</td>
|
1744
|
+
<td>
|
1745
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 261</span>
|
1746
|
+
|
1747
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_screenshot'>screenshot</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1748
|
+
<span class='id identifier rubyid_needs_viewport_reset'>needs_viewport_reset</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1749
|
+
|
1750
|
+
<span class='id identifier rubyid_box'>box</span> <span class='op'>=</span> <span class='id identifier rubyid_bounding_box'>bounding_box</span>
|
1751
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_box'>box</span>
|
1752
|
+
<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>
|
1753
|
+
<span class='kw'>end</span>
|
1754
|
+
|
1755
|
+
<span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>=</span> <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_viewport'>viewport</span>
|
1756
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span> <span class='op'>></span> <span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span> <span class='op'>||</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span> <span class='op'>></span> <span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='rparen'>)</span>
|
1757
|
+
<span class='id identifier rubyid_new_viewport'>new_viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span>
|
1758
|
+
<span class='label'>width:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span>
|
1759
|
+
<span class='label'>height:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='comma'>,</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span>
|
1760
|
+
<span class='rparen'>)</span>
|
1761
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_new_viewport'>new_viewport</span>
|
1762
|
+
|
1763
|
+
<span class='id identifier rubyid_needs_viewport_reset'>needs_viewport_reset</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1764
|
+
<span class='kw'>end</span>
|
1765
|
+
<span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
1766
|
+
|
1767
|
+
<span class='id identifier rubyid_box'>box</span> <span class='op'>=</span> <span class='id identifier rubyid_bounding_box'>bounding_box</span>
|
1768
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_box'>box</span>
|
1769
|
+
<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>
|
1770
|
+
<span class='kw'>end</span>
|
1771
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span> <span class='op'>==</span> <span class='int'>0</span>
|
1772
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Node has 0 width.</span><span class='tstring_end'>'</span></span>
|
1773
|
+
<span class='kw'>end</span>
|
1774
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span> <span class='op'>==</span> <span class='int'>0</span>
|
1775
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Node has 0 height.</span><span class='tstring_end'>'</span></span>
|
1776
|
+
<span class='kw'>end</span>
|
1777
|
+
|
1778
|
+
<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'>'</span><span class='tstring_content'>Page.getLayoutMetrics</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1779
|
+
<span class='id identifier rubyid_page_x'>page_x</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'>"</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pageX</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1780
|
+
<span class='id identifier rubyid_page_y'>page_y</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'>"</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pageY</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1781
|
+
|
1782
|
+
<span class='id identifier rubyid_clip'>clip</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1783
|
+
<span class='label'>x:</span> <span class='id identifier rubyid_page_x'>page_x</span> <span class='op'>+</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span>
|
1784
|
+
<span class='label'>y:</span> <span class='id identifier rubyid_page_y'>page_y</span> <span class='op'>+</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='comma'>,</span>
|
1785
|
+
<span class='label'>width:</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span>
|
1786
|
+
<span class='label'>height:</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='comma'>,</span>
|
1787
|
+
<span class='rbrace'>}</span>
|
1788
|
+
|
1789
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_screenshot'>screenshot</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='label'>clip:</span> <span class='id identifier rubyid_clip'>clip</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1790
|
+
<span class='kw'>ensure</span>
|
1791
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_needs_viewport_reset'>needs_viewport_reset</span>
|
1792
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_viewport'>viewport</span>
|
1793
|
+
<span class='kw'>end</span>
|
1794
|
+
<span class='kw'>end</span></pre>
|
1795
|
+
</td>
|
1796
|
+
</tr>
|
1797
|
+
</table>
|
1230
1798
|
</div>
|
1231
1799
|
|
1232
1800
|
<div class="method_details ">
|
@@ -1244,10 +1812,6 @@
|
|
1244
1812
|
<pre class="lines">
|
1245
1813
|
|
1246
1814
|
|
1247
|
-
33
|
1248
|
-
34
|
1249
|
-
35
|
1250
|
-
36
|
1251
1815
|
37
|
1252
1816
|
38
|
1253
1817
|
39
|
@@ -1263,10 +1827,14 @@
|
|
1263
1827
|
49
|
1264
1828
|
50
|
1265
1829
|
51
|
1266
|
-
52
|
1830
|
+
52
|
1831
|
+
53
|
1832
|
+
54
|
1833
|
+
55
|
1834
|
+
56</pre>
|
1267
1835
|
</td>
|
1268
1836
|
<td>
|
1269
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
1837
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 37</span>
|
1270
1838
|
|
1271
1839
|
<span class='kw'>def</span> <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
1272
1840
|
<span class='id identifier rubyid_js'>js</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
@@ -1291,6 +1859,104 @@
|
|
1291
1859
|
</td>
|
1292
1860
|
</tr>
|
1293
1861
|
</table>
|
1862
|
+
</div>
|
1863
|
+
|
1864
|
+
<div class="method_details ">
|
1865
|
+
<h3 class="signature " id="select-instance_method">
|
1866
|
+
|
1867
|
+
#<strong>select</strong>(*values) ⇒ <tt>Array<String></tt>
|
1868
|
+
|
1869
|
+
|
1870
|
+
|
1871
|
+
|
1872
|
+
|
1873
|
+
</h3><div class="docstring">
|
1874
|
+
<div class="discussion">
|
1875
|
+
|
1876
|
+
|
1877
|
+
</div>
|
1878
|
+
</div>
|
1879
|
+
<div class="tags">
|
1880
|
+
|
1881
|
+
<p class="tag_title">Returns:</p>
|
1882
|
+
<ul class="return">
|
1883
|
+
|
1884
|
+
<li>
|
1885
|
+
|
1886
|
+
|
1887
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
1888
|
+
|
1889
|
+
|
1890
|
+
|
1891
|
+
</li>
|
1892
|
+
|
1893
|
+
</ul>
|
1894
|
+
|
1895
|
+
</div><table class="source_code">
|
1896
|
+
<tr>
|
1897
|
+
<td>
|
1898
|
+
<pre class="lines">
|
1899
|
+
|
1900
|
+
|
1901
|
+
131
|
1902
|
+
132
|
1903
|
+
133
|
1904
|
+
134
|
1905
|
+
135
|
1906
|
+
136
|
1907
|
+
137
|
1908
|
+
138
|
1909
|
+
139
|
1910
|
+
140
|
1911
|
+
141
|
1912
|
+
142
|
1913
|
+
143
|
1914
|
+
144
|
1915
|
+
145
|
1916
|
+
146
|
1917
|
+
147
|
1918
|
+
148
|
1919
|
+
149
|
1920
|
+
150
|
1921
|
+
151
|
1922
|
+
152
|
1923
|
+
153
|
1924
|
+
154
|
1925
|
+
155
|
1926
|
+
156</pre>
|
1927
|
+
</td>
|
1928
|
+
<td>
|
1929
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 131</span>
|
1930
|
+
|
1931
|
+
<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>
|
1932
|
+
<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>
|
1933
|
+
<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'>"</span><span class='tstring_content'>Values must be strings. Found value \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nonstring'>nonstring</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" of type \"</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'>\"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1934
|
+
<span class='kw'>end</span>
|
1935
|
+
|
1936
|
+
<span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
1937
|
+
<span class='tstring_content'> (element, values) => {
|
1938
|
+
</span><span class='tstring_content'> if (element.nodeName.toLowerCase() !== 'select') {
|
1939
|
+
</span><span class='tstring_content'> throw new Error('Element is not a <select> element.');
|
1940
|
+
</span><span class='tstring_content'> }
|
1941
|
+
</span><span class='tstring_content'>
|
1942
|
+
</span><span class='tstring_content'> const options = Array.from(element.options);
|
1943
|
+
</span><span class='tstring_content'> element.value = undefined;
|
1944
|
+
</span><span class='tstring_content'> for (const option of options) {
|
1945
|
+
</span><span class='tstring_content'> option.selected = values.includes(option.value);
|
1946
|
+
</span><span class='tstring_content'> if (option.selected && !element.multiple) {
|
1947
|
+
</span><span class='tstring_content'> break;
|
1948
|
+
</span><span class='tstring_content'> }
|
1949
|
+
</span><span class='tstring_content'> }
|
1950
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('input', { bubbles: true }));
|
1951
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('change', { bubbles: true }));
|
1952
|
+
</span><span class='tstring_content'> return options.filter(option => option.selected).map(option => option.value);
|
1953
|
+
</span><span class='tstring_content'> }
|
1954
|
+
</span><span class='heredoc_end'> JAVASCRIPT
|
1955
|
+
</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>
|
1956
|
+
<span class='kw'>end</span></pre>
|
1957
|
+
</td>
|
1958
|
+
</tr>
|
1959
|
+
</table>
|
1294
1960
|
</div>
|
1295
1961
|
|
1296
1962
|
<div class="method_details ">
|
@@ -1358,19 +2024,19 @@
|
|
1358
2024
|
<pre class="lines">
|
1359
2025
|
|
1360
2026
|
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
2027
|
+
348
|
2028
|
+
349
|
2029
|
+
350
|
2030
|
+
351
|
2031
|
+
352
|
2032
|
+
353
|
2033
|
+
354
|
2034
|
+
355
|
2035
|
+
356
|
2036
|
+
357</pre>
|
1371
2037
|
</td>
|
1372
2038
|
<td>
|
1373
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
2039
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 348</span>
|
1374
2040
|
|
1375
2041
|
<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
2042
|
<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 +2094,18 @@
|
|
1428
2094
|
<pre class="lines">
|
1429
2095
|
|
1430
2096
|
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
2097
|
+
328
|
2098
|
+
329
|
2099
|
+
330
|
2100
|
+
331
|
2101
|
+
332
|
2102
|
+
333
|
2103
|
+
334
|
2104
|
+
335
|
2105
|
+
336</pre>
|
1440
2106
|
</td>
|
1441
2107
|
<td>
|
1442
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
2108
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 328</span>
|
1443
2109
|
|
1444
2110
|
<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
2111
|
<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 +2186,19 @@
|
|
1520
2186
|
<pre class="lines">
|
1521
2187
|
|
1522
2188
|
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
2189
|
+
371
|
2190
|
+
372
|
2191
|
+
373
|
2192
|
+
374
|
2193
|
+
375
|
2194
|
+
376
|
2195
|
+
377
|
2196
|
+
378
|
2197
|
+
379
|
2198
|
+
380</pre>
|
1533
2199
|
</td>
|
1534
2200
|
<td>
|
1535
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
2201
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 371</span>
|
1536
2202
|
|
1537
2203
|
<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
2204
|
<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 +2269,26 @@
|
|
1603
2269
|
<pre class="lines">
|
1604
2270
|
|
1605
2271
|
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
2272
|
+
393
|
2273
|
+
394
|
2274
|
+
395
|
2275
|
+
396
|
2276
|
+
397
|
2277
|
+
398
|
2278
|
+
399
|
2279
|
+
400
|
2280
|
+
401
|
2281
|
+
402
|
2282
|
+
403
|
2283
|
+
404
|
2284
|
+
405
|
2285
|
+
406
|
2286
|
+
407
|
2287
|
+
408
|
2288
|
+
409</pre>
|
1623
2289
|
</td>
|
1624
2290
|
<td>
|
1625
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
2291
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 393</span>
|
1626
2292
|
|
1627
2293
|
<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
2294
|
<span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
@@ -1649,64 +2315,32 @@
|
|
1649
2315
|
<div class="method_details ">
|
1650
2316
|
<h3 class="signature " id="tap-instance_method">
|
1651
2317
|
|
1652
|
-
#<strong>tap</strong> ⇒ <tt>Object</tt>
|
1653
|
-
|
1654
|
-
|
2318
|
+
#<strong>tap</strong>(&block) ⇒ <tt>Object</tt>
|
1655
2319
|
|
1656
2320
|
|
1657
2321
|
|
1658
|
-
</h3><div class="docstring">
|
1659
|
-
<div class="discussion">
|
1660
|
-
|
1661
|
-
<p>const promises = filePaths.map(filePath => readFileAsync(filePath));</p>
|
1662
|
-
|
1663
|
-
<pre class="code ruby"><code class="ruby"> const files = [];
|
1664
|
-
for (let i = 0; i < 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('base64'),
|
1670
|
-
mimeType: mime.lookup(filePath),
|
1671
|
-
};
|
1672
|
-
files.push(file);
|
1673
|
-
}
|
1674
|
-
await this.evaluateHandle(async(element, files) => {
|
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('input', { bubbles: true }));
|
1683
|
-
element.dispatchEvent(new Event('change', { bubbles: true }));
|
1684
|
-
}, files);
|
1685
|
-
}
|
1686
|
-
</code></pre>
|
1687
|
-
|
1688
2322
|
|
1689
|
-
</div>
|
1690
|
-
</div>
|
1691
|
-
<div class="tags">
|
1692
2323
|
|
1693
|
-
|
1694
|
-
</div><table class="source_code">
|
2324
|
+
</h3><table class="source_code">
|
1695
2325
|
<tr>
|
1696
2326
|
<td>
|
1697
2327
|
<pre class="lines">
|
1698
2328
|
|
1699
2329
|
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
2330
|
+
190
|
2331
|
+
191
|
2332
|
+
192
|
2333
|
+
193
|
2334
|
+
194
|
2335
|
+
195
|
2336
|
+
196</pre>
|
1705
2337
|
</td>
|
1706
2338
|
<td>
|
1707
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
2339
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 190</span>
|
2340
|
+
|
2341
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2342
|
+
<span class='kw'>return</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='op'>&</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>
|
1708
2343
|
|
1709
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span>
|
1710
2344
|
<span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
1711
2345
|
<span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
|
1712
2346
|
<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 +2402,13 @@
|
|
1768
2402
|
<pre class="lines">
|
1769
2403
|
|
1770
2404
|
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
2405
|
+
212
|
2406
|
+
213
|
2407
|
+
214
|
2408
|
+
215</pre>
|
1775
2409
|
</td>
|
1776
2410
|
<td>
|
1777
|
-
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line
|
2411
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 212</span>
|
1778
2412
|
|
1779
2413
|
<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
2414
|
<span class='id identifier rubyid_focus'>focus</span>
|
@@ -1783,6 +2417,114 @@
|
|
1783
2417
|
</td>
|
1784
2418
|
</tr>
|
1785
2419
|
</table>
|
2420
|
+
</div>
|
2421
|
+
|
2422
|
+
<div class="method_details ">
|
2423
|
+
<h3 class="signature " id="upload_file-instance_method">
|
2424
|
+
|
2425
|
+
#<strong>upload_file</strong>(*file_paths) ⇒ <tt>Object</tt>
|
2426
|
+
|
2427
|
+
|
2428
|
+
|
2429
|
+
|
2430
|
+
|
2431
|
+
</h3><div class="docstring">
|
2432
|
+
<div class="discussion">
|
2433
|
+
|
2434
|
+
|
2435
|
+
</div>
|
2436
|
+
</div>
|
2437
|
+
<div class="tags">
|
2438
|
+
<p class="tag_title">Parameters:</p>
|
2439
|
+
<ul class="param">
|
2440
|
+
|
2441
|
+
<li>
|
2442
|
+
|
2443
|
+
<span class='name'>file_paths</span>
|
2444
|
+
|
2445
|
+
|
2446
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
2447
|
+
|
2448
|
+
|
2449
|
+
|
2450
|
+
</li>
|
2451
|
+
|
2452
|
+
</ul>
|
2453
|
+
|
2454
|
+
|
2455
|
+
</div><table class="source_code">
|
2456
|
+
<tr>
|
2457
|
+
<td>
|
2458
|
+
<pre class="lines">
|
2459
|
+
|
2460
|
+
|
2461
|
+
159
|
2462
|
+
160
|
2463
|
+
161
|
2464
|
+
162
|
2465
|
+
163
|
2466
|
+
164
|
2467
|
+
165
|
2468
|
+
166
|
2469
|
+
167
|
2470
|
+
168
|
2471
|
+
169
|
2472
|
+
170
|
2473
|
+
171
|
2474
|
+
172
|
2475
|
+
173
|
2476
|
+
174
|
2477
|
+
175
|
2478
|
+
176
|
2479
|
+
177
|
2480
|
+
178
|
2481
|
+
179
|
2482
|
+
180
|
2483
|
+
181
|
2484
|
+
182
|
2485
|
+
183
|
2486
|
+
184
|
2487
|
+
185
|
2488
|
+
186
|
2489
|
+
187
|
2490
|
+
188</pre>
|
2491
|
+
</td>
|
2492
|
+
<td>
|
2493
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 159</span>
|
2494
|
+
|
2495
|
+
<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>
|
2496
|
+
<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'>"</span><span class='tstring_content'>el => el.multiple</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2497
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_is_multiple'>is_multiple</span> <span class='op'>&&</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'>>=</span> <span class='int'>2</span>
|
2498
|
+
<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'>'</span><span class='tstring_content'>Multiple file uploads only work with <input type=file multiple></span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2499
|
+
<span class='kw'>end</span>
|
2500
|
+
|
2501
|
+
<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>
|
2502
|
+
<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'>"</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'>"</span></span><span class='rparen'>)</span>
|
2503
|
+
<span class='kw'>end</span>
|
2504
|
+
|
2505
|
+
<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'>"</span><span class='tstring_content'>node</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>backendNodeId</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
2506
|
+
|
2507
|
+
<span class='comment'># The zero-length array is a special case, it seems that DOM.setFileInputFiles does
|
2508
|
+
</span> <span class='comment'># not actually update the files in that case, so the solution is to eval the element
|
2509
|
+
</span> <span class='comment'># value to a new FileList directly.
|
2510
|
+
</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>
|
2511
|
+
<span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
2512
|
+
<span class='tstring_content'> (element) => {
|
2513
|
+
</span><span class='tstring_content'> element.files = new DataTransfer().files;
|
2514
|
+
</span><span class='tstring_content'>
|
2515
|
+
</span><span class='tstring_content'> // Dispatch events for this case because it should behave akin to a user action.
|
2516
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('input', { bubbles: true }));
|
2517
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('change', { bubbles: true }));
|
2518
|
+
</span><span class='tstring_content'> }
|
2519
|
+
</span><span class='heredoc_end'> JAVASCRIPT
|
2520
|
+
</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>
|
2521
|
+
<span class='kw'>else</span>
|
2522
|
+
<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>
|
2523
|
+
<span class='kw'>end</span>
|
2524
|
+
<span class='kw'>end</span></pre>
|
2525
|
+
</td>
|
2526
|
+
</tr>
|
2527
|
+
</table>
|
1786
2528
|
</div>
|
1787
2529
|
|
1788
2530
|
</div>
|
@@ -1790,7 +2532,7 @@
|
|
1790
2532
|
</div>
|
1791
2533
|
|
1792
2534
|
<div id="footer">
|
1793
|
-
Generated on
|
2535
|
+
Generated on Tue Jun 23 10:25:00 2020 by
|
1794
2536
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1795
2537
|
0.9.24 (ruby-2.6.3).
|
1796
2538
|
</div>
|