puppeteer-ruby 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/docs/Puppeteer.html +2 -2
  3. data/docs/Puppeteer/AsyncAwaitBehavior.html +1 -1
  4. data/docs/Puppeteer/Browser.html +1 -1
  5. data/docs/Puppeteer/BrowserContext.html +1 -1
  6. data/docs/Puppeteer/BrowserFetcher.html +1 -1
  7. data/docs/Puppeteer/BrowserRunner.html +1 -1
  8. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +1 -1
  9. data/docs/Puppeteer/CDPSession.html +86 -57
  10. data/docs/Puppeteer/CDPSession/Error.html +1 -1
  11. data/docs/Puppeteer/ConcurrentRubyUtils.html +1 -1
  12. data/docs/Puppeteer/Connection.html +1 -1
  13. data/docs/Puppeteer/Connection/MessageCallback.html +1 -1
  14. data/docs/Puppeteer/Connection/ProtocolError.html +1 -1
  15. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +1 -1
  16. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +1 -1
  17. data/docs/Puppeteer/ConsoleMessage.html +1 -1
  18. data/docs/Puppeteer/ConsoleMessage/Location.html +1 -1
  19. data/docs/Puppeteer/DOMWorld.html +610 -68
  20. data/docs/Puppeteer/DOMWorld/DetachedError.html +1 -1
  21. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +1 -1
  22. data/docs/Puppeteer/DebugPrint.html +2 -2
  23. data/docs/Puppeteer/Device.html +1 -1
  24. data/docs/Puppeteer/Devices.html +1 -1
  25. data/docs/Puppeteer/ElementHandle.html +306 -109
  26. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +5 -5
  27. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +5 -5
  28. data/docs/Puppeteer/ElementHandle/Point.html +28 -28
  29. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +1 -1
  30. data/docs/Puppeteer/EmulationManager.html +1 -1
  31. data/docs/Puppeteer/EventCallbackable.html +1 -1
  32. data/docs/Puppeteer/EventCallbackable/EventListeners.html +1 -1
  33. data/docs/Puppeteer/ExecutionContext.html +124 -1
  34. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +1 -1
  35. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +1 -1
  36. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +2 -2
  37. data/docs/Puppeteer/Frame.html +117 -65
  38. data/docs/Puppeteer/FrameManager.html +1 -1
  39. data/docs/Puppeteer/FrameManager/NavigationError.html +1 -1
  40. data/docs/Puppeteer/IfPresent.html +1 -1
  41. data/docs/Puppeteer/JSHandle.html +1 -1
  42. data/docs/Puppeteer/Keyboard.html +1 -1
  43. data/docs/Puppeteer/Keyboard/KeyDefinition.html +1 -1
  44. data/docs/Puppeteer/Keyboard/KeyDescription.html +1 -1
  45. data/docs/Puppeteer/Launcher.html +1 -1
  46. data/docs/Puppeteer/Launcher/Base.html +1 -1
  47. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +1 -1
  48. data/docs/Puppeteer/Launcher/BrowserOptions.html +1 -1
  49. data/docs/Puppeteer/Launcher/Chrome.html +1 -1
  50. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +1 -1
  51. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +1 -1
  52. data/docs/Puppeteer/Launcher/LaunchOptions.html +1 -1
  53. data/docs/Puppeteer/LifecycleWatcher.html +1 -1
  54. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +1 -1
  55. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +1 -1
  56. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +1 -1
  57. data/docs/Puppeteer/Mouse.html +1 -1
  58. data/docs/Puppeteer/Mouse/Button.html +1 -1
  59. data/docs/Puppeteer/NetworkManager.html +1 -1
  60. data/docs/Puppeteer/NetworkManager/Credentials.html +1 -1
  61. data/docs/Puppeteer/Page.html +95 -43
  62. data/docs/Puppeteer/Page/ScreenshotOptions.html +1 -1
  63. data/docs/Puppeteer/Page/ScriptTag.html +1 -1
  64. data/docs/Puppeteer/Page/StyleTag.html +1 -1
  65. data/docs/Puppeteer/Page/TargetCrashedError.html +1 -1
  66. data/docs/Puppeteer/RemoteObject.html +1 -1
  67. data/docs/Puppeteer/Target.html +1 -1
  68. data/docs/Puppeteer/Target/InitializeFailure.html +1 -1
  69. data/docs/Puppeteer/Target/TargetInfo.html +1 -1
  70. data/docs/Puppeteer/TimeoutError.html +1 -1
  71. data/docs/Puppeteer/TimeoutSettings.html +1 -1
  72. data/docs/Puppeteer/TouchScreen.html +1 -1
  73. data/docs/Puppeteer/Viewport.html +1 -1
  74. data/docs/Puppeteer/WaitTask.html +434 -8
  75. data/docs/Puppeteer/WaitTask/TerminatedError.html +1 -1
  76. data/docs/Puppeteer/WaitTask/TimeoutError.html +206 -0
  77. data/docs/Puppeteer/WebSocket.html +1 -1
  78. data/docs/Puppeteer/WebSocket/DriverImpl.html +1 -1
  79. data/docs/Puppeteer/WebSocketTransport.html +1 -1
  80. data/docs/Puppeteer/WebSocktTransportError.html +1 -1
  81. data/docs/_index.html +8 -1
  82. data/docs/class_list.html +1 -1
  83. data/docs/file.README.html +1 -1
  84. data/docs/index.html +1 -1
  85. data/docs/method_list.html +615 -519
  86. data/docs/top-level-namespace.html +1 -1
  87. data/lib/puppeteer/cdp_session.rb +33 -11
  88. data/lib/puppeteer/dom_world.rb +97 -90
  89. data/lib/puppeteer/element_handle.rb +36 -54
  90. data/lib/puppeteer/execution_context.rb +23 -17
  91. data/lib/puppeteer/frame.rb +13 -11
  92. data/lib/puppeteer/page.rb +29 -11
  93. data/lib/puppeteer/version.rb +1 -1
  94. data/lib/puppeteer/wait_task.rb +183 -1
  95. metadata +3 -2
@@ -835,7 +835,7 @@
835
835
  </div>
836
836
 
837
837
  <div id="footer">
838
- Generated on Sun Apr 26 15:52:58 2020 by
838
+ Generated on Mon May 25 23:22:51 2020 by
839
839
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
840
840
  0.9.24 (ruby-2.6.3).
841
841
  </div>
@@ -545,7 +545,7 @@ if (items.length)
545
545
  </div>
546
546
 
547
547
  <div id="footer">
548
- Generated on Sun Apr 26 15:52:56 2020 by
548
+ Generated on Mon May 25 23:22:49 2020 by
549
549
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
550
550
  0.9.24 (ruby-2.6.3).
551
551
  </div>
@@ -438,7 +438,7 @@
438
438
  </div>
439
439
 
440
440
  <div id="footer">
441
- Generated on Sun Apr 26 15:52:56 2020 by
441
+ Generated on Mon May 25 23:22:49 2020 by
442
442
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
443
443
  0.9.24 (ruby-2.6.3).
444
444
  </div>
@@ -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 Mon May 25 23:22:48 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>
@@ -941,7 +941,7 @@
941
941
  </div>
942
942
 
943
943
  <div id="footer">
944
- Generated on Sun Apr 26 15:52:57 2020 by
944
+ Generated on Mon May 25 23:22:50 2020 by
945
945
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
946
946
  0.9.24 (ruby-2.6.3).
947
947
  </div>
@@ -1374,7 +1374,7 @@
1374
1374
  </div>
1375
1375
 
1376
1376
  <div id="footer">
1377
- Generated on Sun Apr 26 15:52:56 2020 by
1377
+ Generated on Mon May 25 23:22:49 2020 by
1378
1378
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1379
1379
  0.9.24 (ruby-2.6.3).
1380
1380
  </div>
@@ -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 Mon May 25 23:22:49 2020 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.24 (ruby-2.6.3).
120
120
  </div>
@@ -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 Mon May 25 23:22:49 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>
@@ -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 Mon May 25 23:22:49 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 Mon May 25 23:22:50 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 Mon May 25 23:22:50 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>
@@ -747,7 +747,7 @@
747
747
  </div>
748
748
 
749
749
  <div id="footer">
750
- Generated on Sun Apr 26 15:52:57 2020 by
750
+ Generated on Mon May 25 23:22:49 2020 by
751
751
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
752
752
  0.9.24 (ruby-2.6.3).
753
753
  </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 Mon May 25 23:22:50 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>