puppeteer-ruby 0.0.5 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/docs/Puppeteer.html +53 -43
  4. data/docs/Puppeteer/AsyncAwaitBehavior.html +1 -1
  5. data/docs/Puppeteer/Browser.html +255 -147
  6. data/docs/Puppeteer/BrowserContext.html +1 -1
  7. data/docs/Puppeteer/BrowserFetcher.html +1 -1
  8. data/docs/Puppeteer/BrowserRunner.html +1 -1
  9. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +1 -1
  10. data/docs/Puppeteer/CDPSession.html +86 -57
  11. data/docs/Puppeteer/CDPSession/Error.html +1 -1
  12. data/docs/Puppeteer/ConcurrentRubyUtils.html +1 -1
  13. data/docs/Puppeteer/Connection.html +65 -61
  14. data/docs/Puppeteer/Connection/MessageCallback.html +1 -1
  15. data/docs/Puppeteer/Connection/ProtocolError.html +1 -1
  16. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +5 -5
  17. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +12 -12
  18. data/docs/Puppeteer/ConsoleMessage.html +1 -1
  19. data/docs/Puppeteer/ConsoleMessage/Location.html +1 -1
  20. data/docs/Puppeteer/DOMWorld.html +708 -69
  21. data/docs/Puppeteer/DOMWorld/DetachedError.html +1 -1
  22. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +1 -1
  23. data/docs/Puppeteer/DebugPrint.html +2 -2
  24. data/docs/Puppeteer/Device.html +1 -1
  25. data/docs/Puppeteer/Devices.html +1 -1
  26. data/docs/Puppeteer/ElementHandle.html +1120 -181
  27. data/docs/Puppeteer/ElementHandle/BoundingBox.html +507 -0
  28. data/docs/Puppeteer/ElementHandle/BoxModel.html +404 -0
  29. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +5 -5
  30. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +5 -5
  31. data/docs/Puppeteer/ElementHandle/Point.html +40 -29
  32. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +1 -1
  33. data/docs/Puppeteer/EmulationManager.html +1 -1
  34. data/docs/Puppeteer/EventCallbackable.html +1 -1
  35. data/docs/Puppeteer/EventCallbackable/EventListeners.html +1 -1
  36. data/docs/Puppeteer/ExecutionContext.html +227 -1
  37. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +1 -1
  38. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +1 -1
  39. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +2 -2
  40. data/docs/Puppeteer/FileChooser.html +455 -0
  41. data/docs/Puppeteer/Frame.html +492 -304
  42. data/docs/Puppeteer/FrameManager.html +22 -26
  43. data/docs/Puppeteer/FrameManager/NavigationError.html +1 -1
  44. data/docs/Puppeteer/IfPresent.html +1 -1
  45. data/docs/Puppeteer/JSHandle.html +1 -1
  46. data/docs/Puppeteer/Keyboard.html +1 -1
  47. data/docs/Puppeteer/Keyboard/KeyDefinition.html +1 -1
  48. data/docs/Puppeteer/Keyboard/KeyDescription.html +1 -1
  49. data/docs/Puppeteer/Launcher.html +1 -1
  50. data/docs/Puppeteer/Launcher/Base.html +1 -1
  51. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +1 -1
  52. data/docs/Puppeteer/Launcher/BrowserOptions.html +1 -1
  53. data/docs/Puppeteer/Launcher/Chrome.html +64 -23
  54. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +1 -1
  55. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +1 -1
  56. data/docs/Puppeteer/Launcher/LaunchOptions.html +1 -1
  57. data/docs/Puppeteer/LifecycleWatcher.html +1 -1
  58. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +1 -1
  59. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +1 -1
  60. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +1 -1
  61. data/docs/Puppeteer/Mouse.html +31 -41
  62. data/docs/Puppeteer/Mouse/Button.html +1 -1
  63. data/docs/Puppeteer/NetworkManager.html +1 -1
  64. data/docs/Puppeteer/NetworkManager/Credentials.html +1 -1
  65. data/docs/Puppeteer/Page.html +980 -436
  66. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +206 -0
  67. data/docs/Puppeteer/Page/ScreenshotOptions.html +1 -1
  68. data/docs/Puppeteer/Page/ScriptTag.html +24 -24
  69. data/docs/Puppeteer/Page/StyleTag.html +19 -19
  70. data/docs/Puppeteer/Page/TargetCrashedError.html +1 -1
  71. data/docs/Puppeteer/RemoteObject.html +173 -37
  72. data/docs/Puppeteer/Target.html +149 -197
  73. data/docs/Puppeteer/Target/InitializeFailure.html +1 -1
  74. data/docs/Puppeteer/Target/TargetInfo.html +1 -1
  75. data/docs/Puppeteer/TimeoutError.html +2 -2
  76. data/docs/Puppeteer/TimeoutSettings.html +1 -1
  77. data/docs/Puppeteer/TouchScreen.html +1 -1
  78. data/docs/Puppeteer/Viewport.html +81 -1
  79. data/docs/Puppeteer/WaitTask.html +434 -8
  80. data/docs/Puppeteer/WaitTask/TerminatedError.html +1 -1
  81. data/docs/Puppeteer/WaitTask/TimeoutError.html +206 -0
  82. data/docs/Puppeteer/WebSocket.html +26 -26
  83. data/docs/Puppeteer/WebSocket/DriverImpl.html +1 -1
  84. data/docs/Puppeteer/WebSocket/TransportError.html +124 -0
  85. data/docs/Puppeteer/WebSocketTransport.html +2 -2
  86. data/docs/Puppeteer/WebSocktTransportError.html +1 -1
  87. data/docs/_index.html +47 -19
  88. data/docs/class_list.html +1 -1
  89. data/docs/file.README.html +5 -3
  90. data/docs/index.html +5 -3
  91. data/docs/method_list.html +788 -444
  92. data/docs/top-level-namespace.html +1 -1
  93. data/lib/puppeteer.rb +7 -1
  94. data/lib/puppeteer/browser.rb +21 -6
  95. data/lib/puppeteer/browser_runner.rb +1 -1
  96. data/lib/puppeteer/cdp_session.rb +33 -11
  97. data/lib/puppeteer/connection.rb +13 -1
  98. data/lib/puppeteer/dom_world.rb +113 -108
  99. data/lib/puppeteer/element_handle.rb +183 -222
  100. data/lib/puppeteer/element_handle/bounding_box.rb +12 -0
  101. data/lib/puppeteer/element_handle/box_model.rb +19 -0
  102. data/lib/puppeteer/element_handle/point.rb +26 -0
  103. data/lib/puppeteer/errors.rb +1 -3
  104. data/lib/puppeteer/execution_context.rb +36 -17
  105. data/lib/puppeteer/file_chooser.rb +29 -0
  106. data/lib/puppeteer/frame.rb +32 -12
  107. data/lib/puppeteer/frame_manager.rb +0 -2
  108. data/lib/puppeteer/launcher/chrome.rb +48 -2
  109. data/lib/puppeteer/mouse.rb +3 -8
  110. data/lib/puppeteer/page.rb +116 -65
  111. data/lib/puppeteer/remote_object.rb +15 -1
  112. data/lib/puppeteer/target.rb +24 -24
  113. data/lib/puppeteer/version.rb +1 -1
  114. data/lib/puppeteer/viewport.rb +18 -0
  115. data/lib/puppeteer/wait_task.rb +183 -1
  116. data/lib/puppeteer/web_socket.rb +3 -1
  117. data/lib/puppeteer/web_socket_transport.rb +1 -1
  118. metadata +12 -2
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sun Apr 26 15:52:56 2020 by
117
+ Generated on Sat Jun 20 17:15:06 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>
@@ -719,7 +719,7 @@
719
719
  </div>
720
720
 
721
721
  <div id="footer">
722
- Generated on Sun Apr 26 15:52:56 2020 by
722
+ Generated on Sat Jun 20 17:15:06 2020 by
723
723
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
724
724
  0.9.24 (ruby-2.6.3).
725
725
  </div>
@@ -104,7 +104,7 @@
104
104
  <h2>Overview</h2><div class="docstring">
105
105
  <div class="discussion">
106
106
 
107
- <p>ref: <a href="https://github.com/puppeteer/puppeteer/blob/master/lib/Errors.js">github.com/puppeteer/puppeteer/blob/master/lib/Errors.js</a></p>
107
+ <p>ref: <a href="https://github.com/puppeteer/puppeteer/blob/master/src/Errors.ts">github.com/puppeteer/puppeteer/blob/master/src/Errors.ts</a></p>
108
108
 
109
109
 
110
110
  </div>
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Sun Apr 26 15:52:56 2020 by
128
+ Generated on Sat Jun 20 17:15:06 2020 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.24 (ruby-2.6.3).
131
131
  </div>
@@ -486,7 +486,7 @@
486
486
  </div>
487
487
 
488
488
  <div id="footer">
489
- Generated on Sun Apr 26 15:52:57 2020 by
489
+ Generated on Sat Jun 20 17:15:08 2020 by
490
490
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
491
491
  0.9.24 (ruby-2.6.3).
492
492
  </div>
@@ -454,7 +454,7 @@
454
454
  </div>
455
455
 
456
456
  <div id="footer">
457
- Generated on Sun Apr 26 15:52:57 2020 by
457
+ Generated on Sat Jun 20 17:15:07 2020 by
458
458
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
459
459
  0.9.24 (ruby-2.6.3).
460
460
  </div>
@@ -271,6 +271,28 @@
271
271
 
272
272
 
273
273
 
274
+ <span class="summary_desc"><div class='inline'></div></span>
275
+
276
+ </li>
277
+
278
+
279
+ <li class="public ">
280
+ <span class="summary_signature">
281
+
282
+ <a href="#merge-instance_method" title="#merge (instance method)">#<strong>merge</strong>(width: nil, height: nil, device_scale_factor: nil, is_mobile: nil, has_touch: nil, is_landscape: nil) &#x21d2; Object </a>
283
+
284
+
285
+
286
+ </span>
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
274
296
  <span class="summary_desc"><div class='inline'></div></span>
275
297
 
276
298
  </li>
@@ -688,6 +710,64 @@
688
710
  </td>
689
711
  </tr>
690
712
  </table>
713
+ </div>
714
+
715
+ <div class="method_details ">
716
+ <h3 class="signature " id="merge-instance_method">
717
+
718
+ #<strong>merge</strong>(width: nil, height: nil, device_scale_factor: nil, is_mobile: nil, has_touch: nil, is_landscape: nil) &#x21d2; <tt>Object</tt>
719
+
720
+
721
+
722
+
723
+
724
+ </h3><table class="source_code">
725
+ <tr>
726
+ <td>
727
+ <pre class="lines">
728
+
729
+
730
+ 37
731
+ 38
732
+ 39
733
+ 40
734
+ 41
735
+ 42
736
+ 43
737
+ 44
738
+ 45
739
+ 46
740
+ 47
741
+ 48
742
+ 49
743
+ 50
744
+ 51
745
+ 52
746
+ 53</pre>
747
+ </td>
748
+ <td>
749
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/viewport.rb', line 37</span>
750
+
751
+ <span class='kw'>def</span> <span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span>
752
+ <span class='label'>width:</span> <span class='kw'>nil</span><span class='comma'>,</span>
753
+ <span class='label'>height:</span> <span class='kw'>nil</span><span class='comma'>,</span>
754
+ <span class='label'>device_scale_factor:</span> <span class='kw'>nil</span><span class='comma'>,</span>
755
+ <span class='label'>is_mobile:</span> <span class='kw'>nil</span><span class='comma'>,</span>
756
+ <span class='label'>has_touch:</span> <span class='kw'>nil</span><span class='comma'>,</span>
757
+ <span class='label'>is_landscape:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
758
+
759
+ <span class='const'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Puppeteer::Viewport (class)">Viewport</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Puppeteer::Viewport#initialize (method)">new</a></span></span><span class='lparen'>(</span>
760
+ <span class='label'>width:</span> <span class='id identifier rubyid_width'>width</span> <span class='op'>||</span> <span class='ivar'>@width</span><span class='comma'>,</span>
761
+ <span class='label'>height:</span> <span class='id identifier rubyid_height'>height</span> <span class='op'>||</span> <span class='ivar'>@height</span><span class='comma'>,</span>
762
+ <span class='label'>device_scale_factor:</span> <span class='id identifier rubyid_device_scale_factor'>device_scale_factor</span> <span class='op'>||</span> <span class='ivar'>@device_scale_factor</span><span class='comma'>,</span>
763
+ <span class='label'>is_mobile:</span> <span class='id identifier rubyid_is_mobile'>is_mobile</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='ivar'>@is_mobile</span> <span class='op'>:</span> <span class='id identifier rubyid_is_mobile'>is_mobile</span><span class='comma'>,</span>
764
+ <span class='label'>has_touch:</span> <span class='id identifier rubyid_has_touch'>has_touch</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='ivar'>@has_touch</span> <span class='op'>:</span> <span class='id identifier rubyid_has_touch'>has_touch</span><span class='comma'>,</span>
765
+ <span class='label'>is_landscape:</span> <span class='id identifier rubyid_is_landscape'>is_landscape</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='ivar'>@is_landscape</span> <span class='op'>:</span> <span class='id identifier rubyid_is_landscape'>is_landscape</span><span class='comma'>,</span>
766
+ <span class='rparen'>)</span>
767
+ <span class='kw'>end</span></pre>
768
+ </td>
769
+ </tr>
770
+ </table>
691
771
  </div>
692
772
 
693
773
  <div class="method_details ">
@@ -747,7 +827,7 @@
747
827
  </div>
748
828
 
749
829
  <div id="footer">
750
- Generated on Sun Apr 26 15:52:57 2020 by
830
+ Generated on Sat Jun 20 17:15:07 2020 by
751
831
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
752
832
  0.9.24 (ruby-2.6.3).
753
833
  </div>
@@ -105,11 +105,101 @@
105
105
 
106
106
 
107
107
 
108
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="WaitTask/TerminatedError.html" title="Puppeteer::WaitTask::TerminatedError (class)">TerminatedError</a></span>
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="WaitTask/TerminatedError.html" title="Puppeteer::WaitTask::TerminatedError (class)">TerminatedError</a></span>, <span class='object_link'><a href="WaitTask/TimeoutError.html" title="Puppeteer::WaitTask::TimeoutError (class)">TimeoutError</a></span>
109
109
 
110
110
 
111
111
  </p>
112
112
 
113
+
114
+ <h2>
115
+ Constant Summary
116
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
117
+ </h2>
118
+
119
+ <dl class="constants">
120
+
121
+ <dt id="WAIT_FOR_PREDICATE_PAGE_FUNCTION-constant" class="">WAIT_FOR_PREDICATE_PAGE_FUNCTION =
122
+
123
+ </dt>
124
+ <dd><pre class="code"><span class='heredoc_beg'>&lt;&lt;~JAVASCRIPT</span>
125
+ <span class='tstring_content'>async function _(predicateBody, polling, timeout, ...args) {
126
+ const predicate = new Function(&#39;...args&#39;, predicateBody);
127
+ let timedOut = false;
128
+ if (timeout)
129
+ setTimeout(() =&gt; (timedOut = true), timeout);
130
+ if (polling === &#39;raf&#39;)
131
+ return await pollRaf();
132
+ if (polling === &#39;mutation&#39;)
133
+ return await pollMutation();
134
+ if (typeof polling === &#39;number&#39;)
135
+ return await pollInterval(polling);
136
+ /**
137
+ * @return {!Promise&lt;*&gt;}
138
+ */
139
+ function pollMutation() {
140
+ const success = predicate(...args);
141
+ if (success)
142
+ return Promise.resolve(success);
143
+ let fulfill;
144
+ const result = new Promise((x) =&gt; (fulfill = x));
145
+ const observer = new MutationObserver(() =&gt; {
146
+ if (timedOut) {
147
+ observer.disconnect();
148
+ fulfill();
149
+ }
150
+ const success = predicate(...args);
151
+ if (success) {
152
+ observer.disconnect();
153
+ fulfill(success);
154
+ }
155
+ });
156
+ observer.observe(document, {
157
+ childList: true,
158
+ subtree: true,
159
+ attributes: true,
160
+ });
161
+ return result;
162
+ }
163
+ function pollRaf() {
164
+ let fulfill;
165
+ const result = new Promise((x) =&gt; (fulfill = x));
166
+ onRaf();
167
+ return result;
168
+ function onRaf() {
169
+ if (timedOut) {
170
+ fulfill();
171
+ return;
172
+ }
173
+ const success = predicate(...args);
174
+ if (success)
175
+ fulfill(success);
176
+ else
177
+ requestAnimationFrame(onRaf);
178
+ }
179
+ }
180
+ function pollInterval(pollInterval) {
181
+ let fulfill;
182
+ const result = new Promise((x) =&gt; (fulfill = x));
183
+ onTimeout();
184
+ return result;
185
+ function onTimeout() {
186
+ if (timedOut) {
187
+ fulfill();
188
+ return;
189
+ }
190
+ const success = predicate(...args);
191
+ if (success)
192
+ fulfill(success);
193
+ else
194
+ setTimeout(onTimeout, pollInterval);
195
+ }
196
+ }
197
+ }
198
+ </span><span class='heredoc_end'>JAVASCRIPT</span></pre></dd>
199
+
200
+ </dl>
201
+
202
+
113
203
 
114
204
 
115
205
 
@@ -127,7 +217,29 @@
127
217
  <li class="public ">
128
218
  <span class="summary_signature">
129
219
 
130
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; WaitTask </a>
220
+ <a href="#await_promise-instance_method" title="#await_promise (instance method)">#<strong>await_promise</strong> &#x21d2; Puppeteer::JSHandle </a>
221
+
222
+
223
+
224
+ </span>
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'></div></span>
235
+
236
+ </li>
237
+
238
+
239
+ <li class="public ">
240
+ <span class="summary_signature">
241
+
242
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(dom_world:, predicate_body:, title:, polling:, timeout:, args: []) &#x21d2; WaitTask </a>
131
243
 
132
244
 
133
245
 
@@ -147,6 +259,50 @@
147
259
  <p>A new instance of WaitTask.</p>
148
260
  </div></span>
149
261
 
262
+ </li>
263
+
264
+
265
+ <li class="public ">
266
+ <span class="summary_signature">
267
+
268
+ <a href="#rerun-instance_method" title="#rerun (instance method)">#<strong>rerun</strong> &#x21d2; Object </a>
269
+
270
+
271
+
272
+ </span>
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+ <span class="summary_desc"><div class='inline'></div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#terminate-instance_method" title="#terminate (instance method)">#<strong>terminate</strong>(error) &#x21d2; Object </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+ <span class="summary_desc"><div class='inline'></div></span>
305
+
150
306
  </li>
151
307
 
152
308
 
@@ -159,7 +315,7 @@
159
315
  <div class="method_details first">
160
316
  <h3 class="signature first" id="initialize-instance_method">
161
317
 
162
- #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Puppeteer::WaitTask (class)">WaitTask</a></span></tt>
318
+ #<strong>initialize</strong>(dom_world:, predicate_body:, title:, polling:, timeout:, args: []) &#x21d2; <tt><span class='object_link'><a href="" title="Puppeteer::WaitTask (class)">WaitTask</a></span></tt>
163
319
 
164
320
 
165
321
 
@@ -182,26 +338,296 @@
182
338
  <pre class="lines">
183
339
 
184
340
 
185
- 4
186
- 5</pre>
341
+ 12
342
+ 13
343
+ 14
344
+ 15
345
+ 16
346
+ 17
347
+ 18
348
+ 19
349
+ 20
350
+ 21
351
+ 22
352
+ 23
353
+ 24
354
+ 25
355
+ 26
356
+ 27
357
+ 28
358
+ 29
359
+ 30
360
+ 31
361
+ 32
362
+ 33
363
+ 34
364
+ 35
365
+ 36
366
+ 37
367
+ 38
368
+ 39
369
+ 40
370
+ 41</pre>
371
+ </td>
372
+ <td>
373
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/wait_task.rb', line 12</span>
374
+
375
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>dom_world:</span><span class='comma'>,</span> <span class='label'>predicate_body:</span><span class='comma'>,</span> <span class='label'>title:</span><span class='comma'>,</span> <span class='label'>polling:</span><span class='comma'>,</span> <span class='label'>timeout:</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
376
+ <span class='kw'>if</span> <span class='id identifier rubyid_polling'>polling</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>
377
+ <span class='kw'>if</span> <span class='id identifier rubyid_polling'>polling</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>raf</span><span class='tstring_end'>&#39;</span></span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_polling'>polling</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>mutation</span><span class='tstring_end'>&#39;</span></span>
378
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unknown polling option: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_polling'>polling</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
379
+ <span class='kw'>end</span>
380
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_polling'>polling</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Numeric</span><span class='rparen'>)</span>
381
+ <span class='kw'>unless</span> <span class='id identifier rubyid_polling'>polling</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
382
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot poll with non-positive interval: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_polling'>polling</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
383
+ <span class='kw'>end</span>
384
+ <span class='kw'>else</span>
385
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unknown polling options: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_polling'>polling</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
386
+ <span class='kw'>end</span>
387
+
388
+ <span class='ivar'>@dom_world</span> <span class='op'>=</span> <span class='id identifier rubyid_dom_world'>dom_world</span>
389
+ <span class='ivar'>@polling</span> <span class='op'>=</span> <span class='id identifier rubyid_polling'>polling</span>
390
+ <span class='ivar'>@timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_timeout'>timeout</span>
391
+ <span class='ivar'>@predicate_body</span> <span class='op'>=</span> <span class='id identifier rubyid_predicate_body'>predicate_body</span>
392
+ <span class='ivar'>@args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span>
393
+ <span class='ivar'>@run_count</span> <span class='op'>=</span> <span class='int'>0</span>
394
+ <span class='ivar'>@dom_world</span><span class='period'>.</span><span class='id identifier rubyid__wait_tasks'>_wait_tasks</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
395
+ <span class='ivar'>@promise</span> <span class='op'>=</span> <span class='id identifier rubyid_resolvable_future'><span class='object_link'><a href="ConcurrentRubyUtils.html#resolvable_future-instance_method" title="Puppeteer::ConcurrentRubyUtils#resolvable_future (method)">resolvable_future</a></span></span>
396
+
397
+ <span class='comment'># Since page navigation requires us to re-install the pageScript, we should track
398
+ </span> <span class='comment'># timeout on our end.
399
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_timeout'>timeout</span>
400
+ <span class='id identifier rubyid_timeout_error'>timeout_error</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="WaitTask/TimeoutError.html" title="Puppeteer::WaitTask::TimeoutError (class)">TimeoutError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="WaitTask/TimeoutError.html#initialize-instance_method" title="Puppeteer::WaitTask::TimeoutError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>title:</span> <span class='id identifier rubyid_title'>title</span><span class='comma'>,</span> <span class='label'>timeout:</span> <span class='id identifier rubyid_timeout'>timeout</span><span class='rparen'>)</span>
401
+ <span class='const'>Concurrent</span><span class='op'>::</span><span class='const'>Promises</span><span class='period'>.</span><span class='id identifier rubyid_schedule'>schedule</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout'>timeout</span> <span class='op'>/</span> <span class='float'>1000.0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_terminate'>terminate</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_error'>timeout_error</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@timeout_cleared</span> <span class='rbrace'>}</span>
402
+ <span class='kw'>end</span>
403
+ <span class='id identifier rubyid_async_rerun'>async_rerun</span>
404
+ <span class='kw'>end</span></pre>
405
+ </td>
406
+ </tr>
407
+ </table>
408
+ </div>
409
+
410
+ </div>
411
+
412
+
413
+ <div id="instance_method_details" class="method_details_list">
414
+ <h2>Instance Method Details</h2>
415
+
416
+
417
+ <div class="method_details first">
418
+ <h3 class="signature first" id="await_promise-instance_method">
419
+
420
+ #<strong>await_promise</strong> &#x21d2; <tt><span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">Puppeteer::JSHandle</a></span></tt>
421
+
422
+
423
+
424
+
425
+
426
+ </h3><div class="docstring">
427
+ <div class="discussion">
428
+
429
+
430
+ </div>
431
+ </div>
432
+ <div class="tags">
433
+
434
+ <p class="tag_title">Returns:</p>
435
+ <ul class="return">
436
+
437
+ <li>
438
+
439
+
440
+ <span class='type'>(<tt><span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">Puppeteer::JSHandle</a></span></tt>)</span>
441
+
442
+
443
+
444
+ </li>
445
+
446
+ </ul>
447
+
448
+ </div><table class="source_code">
449
+ <tr>
450
+ <td>
451
+ <pre class="lines">
452
+
453
+
454
+ 44
455
+ 45
456
+ 46</pre>
187
457
  </td>
188
458
  <td>
189
- <pre class="code"><span class="info file"># File 'lib/puppeteer/wait_task.rb', line 4</span>
459
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/wait_task.rb', line 44</span>
190
460
 
191
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
461
+ <span class='kw'>def</span> <span class='id identifier rubyid_await_promise'>await_promise</span>
462
+ <span class='ivar'>@promise</span><span class='period'>.</span><span class='id identifier rubyid_value!'>value!</span>
192
463
  <span class='kw'>end</span></pre>
193
464
  </td>
194
465
  </tr>
195
466
  </table>
196
467
  </div>
468
+
469
+ <div class="method_details ">
470
+ <h3 class="signature " id="rerun-instance_method">
197
471
 
472
+ #<strong>rerun</strong> &#x21d2; <tt>Object</tt>
473
+
474
+
475
+
476
+
477
+
478
+ </h3><table class="source_code">
479
+ <tr>
480
+ <td>
481
+ <pre class="lines">
482
+
483
+
484
+ 54
485
+ 55
486
+ 56
487
+ 57
488
+ 58
489
+ 59
490
+ 60
491
+ 61
492
+ 62
493
+ 63
494
+ 64
495
+ 65
496
+ 66
497
+ 67
498
+ 68
499
+ 69
500
+ 70
501
+ 71
502
+ 72
503
+ 73
504
+ 74
505
+ 75
506
+ 76
507
+ 77
508
+ 78
509
+ 79
510
+ 80
511
+ 81
512
+ 82
513
+ 83
514
+ 84
515
+ 85
516
+ 86
517
+ 87
518
+ 88
519
+ 89
520
+ 90
521
+ 91
522
+ 92
523
+ 93
524
+ 94
525
+ 95
526
+ 96
527
+ 97
528
+ 98
529
+ 99
530
+ 100
531
+ 101
532
+ 102</pre>
533
+ </td>
534
+ <td>
535
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/wait_task.rb', line 54</span>
536
+
537
+ <span class='kw'>def</span> <span class='id identifier rubyid_rerun'>rerun</span>
538
+ <span class='id identifier rubyid_run_count'>run_count</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@run_count</span> <span class='op'>+=</span> <span class='int'>1</span><span class='rparen'>)</span>
539
+ <span class='kw'>begin</span>
540
+ <span class='id identifier rubyid_success'>success</span> <span class='op'>=</span> <span class='ivar'>@dom_world</span><span class='period'>.</span><span class='id identifier rubyid_execution_context'>execution_context</span><span class='period'>.</span><span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
541
+ <span class='const'><span class='object_link'><a href="#WAIT_FOR_PREDICATE_PAGE_FUNCTION-constant" title="Puppeteer::WaitTask::WAIT_FOR_PREDICATE_PAGE_FUNCTION (constant)">WAIT_FOR_PREDICATE_PAGE_FUNCTION</a></span></span><span class='comma'>,</span>
542
+ <span class='ivar'>@predicate_body</span><span class='comma'>,</span>
543
+ <span class='ivar'>@polling</span><span class='comma'>,</span>
544
+ <span class='ivar'>@timeout</span><span class='comma'>,</span>
545
+ <span class='op'>*</span><span class='ivar'>@args</span><span class='comma'>,</span>
546
+ <span class='rparen'>)</span>
547
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_err'>err</span>
548
+ <span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='id identifier rubyid_err'>err</span>
549
+ <span class='kw'>end</span>
550
+
551
+ <span class='kw'>if</span> <span class='ivar'>@terminated</span> <span class='op'>||</span> <span class='id identifier rubyid_run_count'>run_count</span> <span class='op'>!=</span> <span class='ivar'>@run_count</span>
552
+ <span class='kw'>if</span> <span class='id identifier rubyid_success'>success</span>
553
+ <span class='id identifier rubyid_success'>success</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
554
+ <span class='kw'>end</span>
555
+ <span class='kw'>return</span>
556
+ <span class='kw'>end</span>
557
+
558
+ <span class='comment'># Ignore timeouts in pageScript - we track timeouts ourselves.
559
+ </span> <span class='comment'># If the frame&#39;s execution context has already changed, `frame.evaluate` will
560
+ </span> <span class='comment'># throw an error - ignore this predicate run altogether.
561
+ </span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_error'>error</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><span class='ivar'>@dom_world</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>s =&gt; !s</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_success'>success</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>true</span><span class='rparen'>)</span>
562
+ <span class='id identifier rubyid_success'>success</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
563
+ <span class='kw'>return</span>
564
+ <span class='kw'>end</span>
565
+
566
+ <span class='comment'># When the page is navigated, the promise is rejected.
567
+ </span> <span class='comment'># We will try again in the new execution context.
568
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_error'>error</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Execution context was destroyed</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
569
+ <span class='kw'>return</span>
570
+ <span class='kw'>end</span>
571
+
572
+ <span class='comment'># We could have tried to evaluate in a context which was already
573
+ </span> <span class='comment'># destroyed.
574
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_error'>error</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Cannot find context with specified id</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
575
+ <span class='kw'>return</span>
576
+ <span class='kw'>end</span>
577
+
578
+ <span class='kw'>if</span> <span class='id identifier rubyid_error'>error</span>
579
+ <span class='ivar'>@promise</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
580
+ <span class='kw'>else</span>
581
+ <span class='ivar'>@promise</span><span class='period'>.</span><span class='id identifier rubyid_fulfill'>fulfill</span><span class='lparen'>(</span><span class='id identifier rubyid_success'>success</span><span class='rparen'>)</span>
582
+ <span class='kw'>end</span>
583
+
584
+ <span class='id identifier rubyid_cleanup'>cleanup</span>
585
+ <span class='kw'>end</span></pre>
586
+ </td>
587
+ </tr>
588
+ </table>
198
589
  </div>
590
+
591
+ <div class="method_details ">
592
+ <h3 class="signature " id="terminate-instance_method">
593
+
594
+ #<strong>terminate</strong>(error) &#x21d2; <tt>Object</tt>
595
+
199
596
 
597
+
598
+
599
+
600
+ </h3><table class="source_code">
601
+ <tr>
602
+ <td>
603
+ <pre class="lines">
604
+
605
+
606
+ 48
607
+ 49
608
+ 50
609
+ 51
610
+ 52</pre>
611
+ </td>
612
+ <td>
613
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/wait_task.rb', line 48</span>
614
+
615
+ <span class='kw'>def</span> <span class='id identifier rubyid_terminate'>terminate</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
616
+ <span class='ivar'>@terminated</span> <span class='op'>=</span> <span class='kw'>true</span>
617
+ <span class='ivar'>@promise</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
618
+ <span class='id identifier rubyid_cleanup'>cleanup</span>
619
+ <span class='kw'>end</span></pre>
620
+ </td>
621
+ </tr>
622
+ </table>
623
+ </div>
624
+
625
+ </div>
200
626
 
201
627
  </div>
202
628
 
203
629
  <div id="footer">
204
- Generated on Sun Apr 26 15:52:57 2020 by
630
+ Generated on Sat Jun 20 17:15:07 2020 by
205
631
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
206
632
  0.9.24 (ruby-2.6.3).
207
633
  </div>