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
@@ -799,7 +799,7 @@
799
799
  </div>
800
800
 
801
801
  <div id="footer">
802
- Generated on Sun Apr 26 15:52:57 2020 by
802
+ Generated on Sat Jun 20 17:15:08 2020 by
803
803
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
804
804
  0.9.24 (ruby-2.6.3).
805
805
  </div>
@@ -204,7 +204,7 @@
204
204
  </div>
205
205
 
206
206
  <div id="footer">
207
- Generated on Sun Apr 26 15:52:57 2020 by
207
+ Generated on Sat Jun 20 17:15:08 2020 by
208
208
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
209
209
  0.9.24 (ruby-2.6.3).
210
210
  </div>
@@ -904,7 +904,7 @@
904
904
  </div>
905
905
 
906
906
  <div id="footer">
907
- Generated on Sun Apr 26 15:52:57 2020 by
907
+ Generated on Sat Jun 20 17:15:07 2020 by
908
908
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
909
909
  0.9.24 (ruby-2.6.3).
910
910
  </div>
@@ -467,7 +467,7 @@
467
467
  </div>
468
468
 
469
469
  <div id="footer">
470
- Generated on Sun Apr 26 15:52:57 2020 by
470
+ Generated on Sat Jun 20 17:15:07 2020 by
471
471
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
472
472
  0.9.24 (ruby-2.6.3).
473
473
  </div>
@@ -89,7 +89,7 @@
89
89
 
90
90
  <dl>
91
91
  <dt>Includes:</dt>
92
- <dd><span class='object_link'><a href="EventCallbackable.html" title="Puppeteer::EventCallbackable (module)">EventCallbackable</a></span></dd>
92
+ <dd><span class='object_link'><a href="DebugPrint.html" title="Puppeteer::DebugPrint (module)">DebugPrint</a></span>, <span class='object_link'><a href="EventCallbackable.html" title="Puppeteer::EventCallbackable (module)">EventCallbackable</a></span></dd>
93
93
  </dl>
94
94
 
95
95
 
@@ -313,6 +313,17 @@
313
313
 
314
314
  <h3 class="inherited">Methods included from <span class='object_link'><a href="EventCallbackable.html" title="Puppeteer::EventCallbackable (module)">EventCallbackable</a></span></h3>
315
315
  <p class="inherited"><span class='object_link'><a href="EventCallbackable.html#add_event_listener-instance_method" title="Puppeteer::EventCallbackable#add_event_listener (method)">#add_event_listener</a></span>, <span class='object_link'><a href="EventCallbackable.html#emit_event-instance_method" title="Puppeteer::EventCallbackable#emit_event (method)">#emit_event</a></span>, <span class='object_link'><a href="EventCallbackable.html#on_event-instance_method" title="Puppeteer::EventCallbackable#on_event (method)">#on_event</a></span>, <span class='object_link'><a href="EventCallbackable.html#remove_event_listener-instance_method" title="Puppeteer::EventCallbackable#remove_event_listener (method)">#remove_event_listener</a></span></p>
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="DebugPrint.html" title="Puppeteer::DebugPrint (module)">DebugPrint</a></span></h3>
326
+ <p class="inherited"><span class='object_link'><a href="DebugPrint.html#debug_print-instance_method" title="Puppeteer::DebugPrint#debug_print (method)">#debug_print</a></span>, <span class='object_link'><a href="DebugPrint.html#debug_puts-instance_method" title="Puppeteer::DebugPrint#debug_puts (method)">#debug_puts</a></span></p>
316
327
  <div id="constructor_details" class="method_details_list">
317
328
  <h2>Constructor Details</h2>
318
329
 
@@ -379,21 +390,23 @@
379
390
  <pre class="lines">
380
391
 
381
392
 
382
- 10
383
393
  11
384
394
  12
385
395
  13
386
396
  14
387
- 15</pre>
397
+ 15
398
+ 16
399
+ 17</pre>
388
400
  </td>
389
401
  <td>
390
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 10</span>
402
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 11</span>
391
403
 
392
404
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_connection'>connection</span><span class='comma'>,</span> <span class='id identifier rubyid_target_type'>target_type</span><span class='comma'>,</span> <span class='id identifier rubyid_session_id'>session_id</span><span class='rparen'>)</span>
393
405
  <span class='ivar'>@callbacks</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
394
406
  <span class='ivar'>@connection</span> <span class='op'>=</span> <span class='id identifier rubyid_connection'>connection</span>
395
407
  <span class='ivar'>@target_type</span> <span class='op'>=</span> <span class='id identifier rubyid_target_type'>target_type</span>
396
408
  <span class='ivar'>@session_id</span> <span class='op'>=</span> <span class='id identifier rubyid_session_id'>session_id</span>
409
+ <span class='ivar'>@pending_messages</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
397
410
  <span class='kw'>end</span></pre>
398
411
  </td>
399
412
  </tr>
@@ -433,12 +446,12 @@
433
446
  <pre class="lines">
434
447
 
435
448
 
436
- 17
437
- 18
438
- 19</pre>
449
+ 19
450
+ 20
451
+ 21</pre>
439
452
  </td>
440
453
  <td>
441
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 17</span>
454
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 19</span>
442
455
 
443
456
  <span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
444
457
  <span class='ivar'>@connection</span>
@@ -507,18 +520,24 @@
507
520
  <pre class="lines">
508
521
 
509
522
 
510
- 29
511
- 30
512
523
  31
513
524
  32
514
525
  33
515
526
  34
516
527
  35
517
528
  36
518
- 37</pre>
529
+ 37
530
+ 38
531
+ 39
532
+ 40
533
+ 41
534
+ 42
535
+ 43
536
+ 44
537
+ 45</pre>
519
538
  </td>
520
539
  <td>
521
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 29</span>
540
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 31</span>
522
541
 
523
542
  <span class='kw'>def</span> <span class='id identifier rubyid_async_send_message'>async_send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
524
543
  <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@connection</span>
@@ -526,7 +545,13 @@
526
545
  <span class='kw'>end</span>
527
546
  <span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_raw_send'>raw_send</span><span class='lparen'>(</span><span class='label'>message:</span> <span class='lbrace'>{</span> <span class='label'>sessionId:</span> <span class='ivar'>@session_id</span><span class='comma'>,</span> <span class='label'>method:</span> <span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_params'>params</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
528
547
  <span class='id identifier rubyid_promise'>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>
529
- <span class='ivar'>@callbacks</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <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="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Connection/MessageCallback.html" title="Puppeteer::Connection::MessageCallback (class)">MessageCallback</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Connection/MessageCallback.html#initialize-instance_method" title="Puppeteer::Connection::MessageCallback#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>method:</span> <span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='label'>promise:</span> <span class='id identifier rubyid_promise'>promise</span><span class='rparen'>)</span>
548
+ <span class='id identifier rubyid_callback'>callback</span> <span class='op'>=</span> <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="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Connection/MessageCallback.html" title="Puppeteer::Connection::MessageCallback (class)">MessageCallback</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Connection/MessageCallback.html#initialize-instance_method" title="Puppeteer::Connection::MessageCallback#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>method:</span> <span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='label'>promise:</span> <span class='id identifier rubyid_promise'>promise</span><span class='rparen'>)</span>
549
+ <span class='kw'>if</span> <span class='id identifier rubyid_pending_message'>pending_message</span> <span class='op'>=</span> <span class='ivar'>@pending_messages</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
550
+ <span class='id identifier rubyid_debug_puts'>debug_puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Pending message (id: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>) is handled</span><span class='tstring_end'>&quot;</span></span>
551
+ <span class='id identifier rubyid_callback_with_message'>callback_with_message</span><span class='lparen'>(</span><span class='id identifier rubyid_callback'>callback</span><span class='comma'>,</span> <span class='id identifier rubyid_pending_message'>pending_message</span><span class='rparen'>)</span>
552
+ <span class='kw'>else</span>
553
+ <span class='ivar'>@callbacks</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_callback'>callback</span>
554
+ <span class='kw'>end</span>
530
555
  <span class='id identifier rubyid_promise'>promise</span>
531
556
  <span class='kw'>end</span></pre>
532
557
  </td>
@@ -549,15 +574,15 @@
549
574
  <pre class="lines">
550
575
 
551
576
 
552
- 60
553
- 61
554
- 62
555
- 63
556
- 64
557
- 65</pre>
577
+ 82
578
+ 83
579
+ 84
580
+ 85
581
+ 86
582
+ 87</pre>
558
583
  </td>
559
584
  <td>
560
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 60</span>
585
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 82</span>
561
586
 
562
587
  <span class='kw'>def</span> <span class='id identifier rubyid_detach'>detach</span>
563
588
  <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@connection</span>
@@ -585,20 +610,20 @@
585
610
  <pre class="lines">
586
611
 
587
612
 
588
- 67
589
- 68
590
- 69
591
- 70
592
- 71
593
- 72
594
- 73
595
- 74
596
- 75
597
- 76
598
- 77</pre>
613
+ 89
614
+ 90
615
+ 91
616
+ 92
617
+ 93
618
+ 94
619
+ 95
620
+ 96
621
+ 97
622
+ 98
623
+ 99</pre>
599
624
  </td>
600
625
  <td>
601
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 67</span>
626
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 89</span>
602
627
 
603
628
  <span class='kw'>def</span> <span class='id identifier rubyid_handle_closed'>handle_closed</span>
604
629
  <span class='ivar'>@callbacks</span><span class='period'>.</span><span class='id identifier rubyid_each_value'>each_value</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_callback'>callback</span><span class='op'>|</span>
@@ -655,14 +680,6 @@
655
680
  <pre class="lines">
656
681
 
657
682
 
658
- 40
659
- 41
660
- 42
661
- 43
662
- 44
663
- 45
664
- 46
665
- 47
666
683
  48
667
684
  49
668
685
  50
@@ -673,25 +690,37 @@
673
690
  55
674
691
  56
675
692
  57
676
- 58</pre>
693
+ 58
694
+ 59
695
+ 60
696
+ 61
697
+ 62
698
+ 63
699
+ 64
700
+ 65
701
+ 66
702
+ 67
703
+ 68</pre>
677
704
  </td>
678
705
  <td>
679
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 40</span>
706
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 48</span>
680
707
 
681
708
  <span class='kw'>def</span> <span class='id identifier rubyid_handle_message'>handle_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
682
709
  <span class='kw'>if</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
683
710
  <span class='kw'>if</span> <span class='id identifier rubyid_callback'>callback</span> <span class='op'>=</span> <span class='ivar'>@callbacks</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
684
- <span class='kw'>if</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>error</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
685
- <span class='id identifier rubyid_callback'>callback</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span>
686
- <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="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Connection/ProtocolError.html" title="Puppeteer::Connection::ProtocolError (class)">ProtocolError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Connection/ProtocolError.html#initialize-instance_method" title="Puppeteer::Connection::ProtocolError#initialize (method)">new</a></span></span><span class='lparen'>(</span>
687
- <span class='label'>method:</span> <span class='id identifier rubyid_callback'>callback</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span>
688
- <span class='label'>error_message:</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>error</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>message</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
689
- <span class='label'>error_data:</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>error</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>data</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
690
- <span class='kw'>else</span>
691
- <span class='id identifier rubyid_callback'>callback</span><span class='period'>.</span><span class='id identifier rubyid_resolve'>resolve</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
692
- <span class='kw'>end</span>
711
+ <span class='id identifier rubyid_callback_with_message'>callback_with_message</span><span class='lparen'>(</span><span class='id identifier rubyid_callback'>callback</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
693
712
  <span class='kw'>else</span>
694
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="CDPSession/Error.html" title="Puppeteer::CDPSession::Error (class)">Error</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Puppeteer::CDPSession#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>unknown id: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
713
+ <span class='id identifier rubyid_debug_puts'>debug_puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>unknown id: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>. Store it into pending message</span><span class='tstring_end'>&quot;</span></span>
714
+
715
+ <span class='comment'># RECV is often notified before SEND.
716
+ </span> <span class='comment'># Wait about 10 frames before throwing an error.
717
+ </span> <span class='id identifier rubyid_message_id'>message_id</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
718
+ <span class='ivar'>@pending_messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_message_id'>message_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span>
719
+ <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='float'>0.16</span><span class='comma'>,</span> <span class='id identifier rubyid_message_id'>message_id</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_id'>id</span><span class='op'>|</span>
720
+ <span class='kw'>if</span> <span class='ivar'>@pending_messages</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
721
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="CDPSession/Error.html" title="Puppeteer::CDPSession::Error (class)">Error</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Puppeteer::CDPSession#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>unknown id: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
722
+ <span class='kw'>end</span>
723
+ <span class='kw'>end</span>
695
724
  <span class='kw'>end</span>
696
725
  <span class='kw'>else</span>
697
726
  <span class='id identifier rubyid_emit_event'>emit_event</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>method</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>params</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
@@ -754,12 +783,12 @@
754
783
  <pre class="lines">
755
784
 
756
785
 
757
- 22
758
- 23
759
- 24</pre>
786
+ 24
787
+ 25
788
+ 26</pre>
760
789
  </td>
761
790
  <td>
762
- <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 22</span>
791
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 24</span>
763
792
 
764
793
  <span class='kw'>def</span> <span class='id identifier rubyid_send_message'>send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
765
794
  <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_async_send_message'>async_send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
@@ -774,7 +803,7 @@
774
803
  </div>
775
804
 
776
805
  <div id="footer">
777
- Generated on Sun Apr 26 15:52:57 2020 by
806
+ Generated on Sat Jun 20 17:15:07 2020 by
778
807
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
779
808
  0.9.24 (ruby-2.6.3).
780
809
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sun Apr 26 15:52:57 2020 by
117
+ Generated on Sat Jun 20 17:15:07 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>
@@ -420,7 +420,7 @@
420
420
  </div>
421
421
 
422
422
  <div id="footer">
423
- Generated on Sun Apr 26 15:52:55 2020 by
423
+ Generated on Sat Jun 20 17:15:05 2020 by
424
424
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
425
425
  0.9.24 (ruby-2.6.3).
426
426
  </div>
@@ -454,7 +454,9 @@
454
454
  52
455
455
  53
456
456
  54
457
- 55</pre>
457
+ 55
458
+ 56
459
+ 57</pre>
458
460
  </td>
459
461
  <td>
460
462
  <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 39</span>
@@ -467,7 +469,9 @@
467
469
 
468
470
  <span class='ivar'>@transport</span> <span class='op'>=</span> <span class='id identifier rubyid_transport'>transport</span>
469
471
  <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_on_message'>on_message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
470
- <span class='id identifier rubyid_async_handle_message'>async_handle_message</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='rparen'>)</span>
472
+ <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
473
+ <span class='id identifier rubyid_sleep_before_handling_message'>sleep_before_handling_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
474
+ <span class='id identifier rubyid_async_handle_message'>async_handle_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
471
475
  <span class='kw'>end</span>
472
476
  <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_on_close'>on_close</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_reason'>reason</span><span class='comma'>,</span> <span class='id identifier rubyid_code'>code</span><span class='op'>|</span>
473
477
  <span class='id identifier rubyid_handle_close'>handle_close</span><span class='lparen'>(</span><span class='id identifier rubyid_reason'>reason</span><span class='comma'>,</span> <span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
@@ -503,12 +507,12 @@
503
507
  <pre class="lines">
504
508
 
505
509
 
506
- 57
507
- 58
508
- 59</pre>
510
+ 69
511
+ 70
512
+ 71</pre>
509
513
  </td>
510
514
  <td>
511
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 57</span>
515
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 69</span>
512
516
 
513
517
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_session'>from_session</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='rparen'>)</span>
514
518
  <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span>
@@ -539,15 +543,15 @@
539
543
  <pre class="lines">
540
544
 
541
545
 
542
- 77
543
- 78
544
- 79
545
- 80
546
- 81
547
- 82</pre>
546
+ 89
547
+ 90
548
+ 91
549
+ 92
550
+ 93
551
+ 94</pre>
548
552
  </td>
549
553
  <td>
550
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 77</span>
554
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 89</span>
551
555
 
552
556
  <span class='kw'>def</span> <span class='id identifier rubyid_async_send_message'>async_send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
553
557
  <span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_raw_send'>raw_send</span><span class='lparen'>(</span><span class='label'>message:</span> <span class='lbrace'>{</span> <span class='label'>method:</span> <span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_params'>params</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
@@ -612,24 +616,24 @@
612
616
  <pre class="lines">
613
617
 
614
618
 
615
- 239
616
- 240
617
- 241
618
- 242
619
- 243
620
- 244
621
- 245
622
- 246
623
- 247
624
- 248
625
- 249
626
- 250
627
619
  251
628
620
  252
629
- 253</pre>
621
+ 253
622
+ 254
623
+ 255
624
+ 256
625
+ 257
626
+ 258
627
+ 259
628
+ 260
629
+ 261
630
+ 262
631
+ 263
632
+ 264
633
+ 265</pre>
630
634
  </td>
631
635
  <td>
632
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 239</span>
636
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 251</span>
633
637
 
634
638
  <span class='kw'>def</span> <span class='id identifier rubyid_create_session'>create_session</span><span class='lparen'>(</span><span class='id identifier rubyid_target_info'>target_info</span><span class='rparen'>)</span>
635
639
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_message'>send_message</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Target.attachToTarget</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>targetId:</span> <span class='id identifier rubyid_target_info'>target_info</span><span class='period'>.</span><span class='id identifier rubyid_target_id'>target_id</span><span class='comma'>,</span> <span class='label'>flatten:</span> <span class='kw'>true</span><span class='rparen'>)</span>
@@ -666,13 +670,13 @@
666
670
  <pre class="lines">
667
671
 
668
672
 
669
- 232
670
- 233
671
- 234
672
- 235</pre>
673
+ 244
674
+ 245
675
+ 246
676
+ 247</pre>
673
677
  </td>
674
678
  <td>
675
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 232</span>
679
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 244</span>
676
680
 
677
681
  <span class='kw'>def</span> <span class='id identifier rubyid_dispose'>dispose</span>
678
682
  <span class='id identifier rubyid_handle_close'>handle_close</span>
@@ -698,12 +702,12 @@
698
702
  <pre class="lines">
699
703
 
700
704
 
701
- 224
702
- 225
703
- 226</pre>
705
+ 236
706
+ 237
707
+ 238</pre>
704
708
  </td>
705
709
  <td>
706
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 224</span>
710
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 236</span>
707
711
 
708
712
  <span class='kw'>def</span> <span class='id identifier rubyid_on_close'>on_close</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
709
713
  <span class='ivar'>@on_close</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
@@ -728,12 +732,12 @@
728
732
  <pre class="lines">
729
733
 
730
734
 
731
- 228
732
- 229
733
- 230</pre>
735
+ 240
736
+ 241
737
+ 242</pre>
734
738
  </td>
735
739
  <td>
736
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 228</span>
740
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 240</span>
737
741
 
738
742
  <span class='kw'>def</span> <span class='id identifier rubyid_on_message'>on_message</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
739
743
  <span class='ivar'>@on_message</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
@@ -758,16 +762,16 @@
758
762
  <pre class="lines">
759
763
 
760
764
 
761
- 88
762
- 89
763
- 90
764
- 91
765
- 92
766
- 93
767
- 94</pre>
765
+ 100
766
+ 101
767
+ 102
768
+ 103
769
+ 104
770
+ 105
771
+ 106</pre>
768
772
  </td>
769
773
  <td>
770
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 88</span>
774
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 100</span>
771
775
 
772
776
  <span class='kw'>def</span> <span class='id identifier rubyid_raw_send'>raw_send</span><span class='lparen'>(</span><span class='label'>message:</span><span class='rparen'>)</span>
773
777
  <span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_id'>generate_id</span>
@@ -833,12 +837,12 @@
833
837
  <pre class="lines">
834
838
 
835
839
 
836
- 73
837
- 74
838
- 75</pre>
840
+ 85
841
+ 86
842
+ 87</pre>
839
843
  </td>
840
844
  <td>
841
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 73</span>
845
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 85</span>
842
846
 
843
847
  <span class='kw'>def</span> <span class='id identifier rubyid_send_message'>send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
844
848
  <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_async_send_message'>async_send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
@@ -900,12 +904,12 @@
900
904
  <pre class="lines">
901
905
 
902
906
 
903
- 63
904
- 64
905
- 65</pre>
907
+ 75
908
+ 76
909
+ 77</pre>
906
910
  </td>
907
911
  <td>
908
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 63</span>
912
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 75</span>
909
913
 
910
914
  <span class='kw'>def</span> <span class='id identifier rubyid_session'>session</span><span class='lparen'>(</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rparen'>)</span>
911
915
  <span class='ivar'>@sessions</span><span class='lbracket'>[</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rbracket'>]</span>
@@ -930,12 +934,12 @@
930
934
  <pre class="lines">
931
935
 
932
936
 
933
- 67
934
- 68
935
- 69</pre>
937
+ 79
938
+ 80
939
+ 81</pre>
936
940
  </td>
937
941
  <td>
938
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 67</span>
942
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 79</span>
939
943
 
940
944
  <span class='kw'>def</span> <span class='id identifier rubyid_url'>url</span>
941
945
  <span class='ivar'>@url</span>
@@ -950,7 +954,7 @@
950
954
  </div>
951
955
 
952
956
  <div id="footer">
953
- Generated on Sun Apr 26 15:52:57 2020 by
957
+ Generated on Sat Jun 20 17:15:07 2020 by
954
958
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
955
959
  0.9.24 (ruby-2.6.3).
956
960
  </div>