puppeteer-ruby 0.0.3 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +30 -0
  3. data/.github/stale.yml +16 -0
  4. data/.rubocop.yml +4 -5
  5. data/README.md +4 -1
  6. data/docs/Puppeteer.html +2020 -0
  7. data/docs/Puppeteer/AsyncAwaitBehavior.html +105 -0
  8. data/docs/Puppeteer/Browser.html +2150 -0
  9. data/docs/Puppeteer/BrowserContext.html +809 -0
  10. data/docs/Puppeteer/BrowserFetcher.html +214 -0
  11. data/docs/Puppeteer/BrowserRunner.html +914 -0
  12. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +477 -0
  13. data/docs/Puppeteer/CDPSession.html +813 -0
  14. data/docs/Puppeteer/CDPSession/Error.html +124 -0
  15. data/docs/Puppeteer/ConcurrentRubyUtils.html +430 -0
  16. data/docs/Puppeteer/Connection.html +960 -0
  17. data/docs/Puppeteer/Connection/MessageCallback.html +434 -0
  18. data/docs/Puppeteer/Connection/ProtocolError.html +216 -0
  19. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +217 -0
  20. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +244 -0
  21. data/docs/Puppeteer/ConsoleMessage.html +565 -0
  22. data/docs/Puppeteer/ConsoleMessage/Location.html +433 -0
  23. data/docs/Puppeteer/DOMWorld.html +2219 -0
  24. data/docs/Puppeteer/DOMWorld/DetachedError.html +124 -0
  25. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +124 -0
  26. data/docs/Puppeteer/DebugPrint.html +233 -0
  27. data/docs/Puppeteer/Device.html +470 -0
  28. data/docs/Puppeteer/Devices.html +139 -0
  29. data/docs/Puppeteer/ElementHandle.html +2224 -0
  30. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +206 -0
  31. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +206 -0
  32. data/docs/Puppeteer/ElementHandle/Point.html +481 -0
  33. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +124 -0
  34. data/docs/Puppeteer/EmulationManager.html +454 -0
  35. data/docs/Puppeteer/EventCallbackable.html +433 -0
  36. data/docs/Puppeteer/EventCallbackable/EventListeners.html +435 -0
  37. data/docs/Puppeteer/ExecutionContext.html +998 -0
  38. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +124 -0
  39. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +357 -0
  40. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +389 -0
  41. data/docs/Puppeteer/FileChooser.html +455 -0
  42. data/docs/Puppeteer/Frame.html +3677 -0
  43. data/docs/Puppeteer/FrameManager.html +2414 -0
  44. data/docs/Puppeteer/FrameManager/NavigationError.html +124 -0
  45. data/docs/Puppeteer/IfPresent.html +222 -0
  46. data/docs/Puppeteer/JSHandle.html +1352 -0
  47. data/docs/Puppeteer/Keyboard.html +1557 -0
  48. data/docs/Puppeteer/Keyboard/KeyDefinition.html +831 -0
  49. data/docs/Puppeteer/Keyboard/KeyDescription.html +603 -0
  50. data/docs/Puppeteer/Launcher.html +237 -0
  51. data/docs/Puppeteer/Launcher/Base.html +385 -0
  52. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +124 -0
  53. data/docs/Puppeteer/Launcher/BrowserOptions.html +441 -0
  54. data/docs/Puppeteer/Launcher/Chrome.html +669 -0
  55. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +382 -0
  56. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +531 -0
  57. data/docs/Puppeteer/Launcher/LaunchOptions.html +893 -0
  58. data/docs/Puppeteer/LifecycleWatcher.html +834 -0
  59. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +363 -0
  60. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +206 -0
  61. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +124 -0
  62. data/docs/Puppeteer/Mouse.html +1105 -0
  63. data/docs/Puppeteer/Mouse/Button.html +136 -0
  64. data/docs/Puppeteer/NetworkManager.html +901 -0
  65. data/docs/Puppeteer/NetworkManager/Credentials.html +385 -0
  66. data/docs/Puppeteer/Page.html +5970 -0
  67. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +206 -0
  68. data/docs/Puppeteer/Page/ScreenshotOptions.html +845 -0
  69. data/docs/Puppeteer/Page/ScriptTag.html +555 -0
  70. data/docs/Puppeteer/Page/StyleTag.html +448 -0
  71. data/docs/Puppeteer/Page/TargetCrashedError.html +124 -0
  72. data/docs/Puppeteer/RemoteObject.html +1016 -0
  73. data/docs/Puppeteer/Target.html +1384 -0
  74. data/docs/Puppeteer/Target/InitializeFailure.html +124 -0
  75. data/docs/Puppeteer/Target/TargetInfo.html +729 -0
  76. data/docs/Puppeteer/TimeoutError.html +135 -0
  77. data/docs/Puppeteer/TimeoutSettings.html +496 -0
  78. data/docs/Puppeteer/TouchScreen.html +464 -0
  79. data/docs/Puppeteer/Viewport.html +757 -0
  80. data/docs/Puppeteer/WaitTask.html +637 -0
  81. data/docs/Puppeteer/WaitTask/TerminatedError.html +124 -0
  82. data/docs/Puppeteer/WaitTask/TimeoutError.html +206 -0
  83. data/docs/Puppeteer/WebSocket.html +673 -0
  84. data/docs/Puppeteer/WebSocket/DriverImpl.html +412 -0
  85. data/docs/Puppeteer/WebSocketTransport.html +600 -0
  86. data/docs/Puppeteer/WebSocktTransportError.html +124 -0
  87. data/docs/_index.html +809 -0
  88. data/docs/class_list.html +51 -0
  89. data/docs/css/common.css +1 -0
  90. data/docs/css/full_list.css +58 -0
  91. data/docs/css/style.css +496 -0
  92. data/docs/file.README.html +123 -0
  93. data/docs/file_list.html +56 -0
  94. data/docs/frames.html +17 -0
  95. data/docs/index.html +123 -0
  96. data/docs/js/app.js +314 -0
  97. data/docs/js/full_list.js +216 -0
  98. data/docs/js/jquery.js +4 -0
  99. data/docs/method_list.html +3979 -0
  100. data/docs/top-level-namespace.html +126 -0
  101. data/lib/puppeteer.rb +16 -8
  102. data/lib/puppeteer/async_await_behavior.rb +6 -0
  103. data/lib/puppeteer/browser.rb +21 -1
  104. data/lib/puppeteer/browser_runner.rb +1 -1
  105. data/lib/puppeteer/cdp_session.rb +33 -11
  106. data/lib/puppeteer/connection.rb +1 -1
  107. data/lib/puppeteer/dom_world.rb +142 -121
  108. data/lib/puppeteer/element_handle.rb +223 -181
  109. data/lib/puppeteer/execution_context.rb +41 -17
  110. data/lib/puppeteer/file_chooser.rb +29 -0
  111. data/lib/puppeteer/frame.rb +23 -15
  112. data/lib/puppeteer/frame_manager.rb +7 -9
  113. data/lib/puppeteer/js_handle.rb +3 -3
  114. data/lib/puppeteer/keyboard.rb +1 -1
  115. data/lib/puppeteer/keyboard/us_keyboard_layout.rb +4 -4
  116. data/lib/puppeteer/launcher.rb +0 -1
  117. data/lib/puppeteer/launcher/chrome.rb +48 -2
  118. data/lib/puppeteer/lifecycle_watcher.rb +9 -4
  119. data/lib/puppeteer/mouse.rb +10 -7
  120. data/lib/puppeteer/page.rb +134 -70
  121. data/lib/puppeteer/remote_object.rb +11 -1
  122. data/lib/puppeteer/version.rb +1 -1
  123. data/lib/puppeteer/wait_task.rb +183 -1
  124. data/puppeteer-ruby.gemspec +4 -1
  125. metadata +143 -4
@@ -0,0 +1,813 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Puppeteer::CDPSession
8
+
9
+ &mdash; Documentation by YARD 0.9.24
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Puppeteer::CDPSession";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span>
41
+ &raquo;
42
+ <span class="title">CDPSession</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Puppeteer::CDPSession
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Puppeteer::CDPSession</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <dl>
91
+ <dt>Includes:</dt>
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
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/puppeteer/cdp_session.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Defined Under Namespace</h2>
108
+ <p class="children">
109
+
110
+
111
+
112
+
113
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="CDPSession/Error.html" title="Puppeteer::CDPSession::Error (class)">Error</a></span>
114
+
115
+
116
+ </p>
117
+
118
+
119
+
120
+
121
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
122
+ <ul class="summary">
123
+
124
+ <li class="public ">
125
+ <span class="summary_signature">
126
+
127
+ <a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> &#x21d2; Object </a>
128
+
129
+
130
+
131
+ </span>
132
+
133
+
134
+
135
+
136
+ <span class="note title readonly">readonly</span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>Returns the value of attribute connection.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ </ul>
154
+
155
+
156
+
157
+
158
+
159
+ <h2>
160
+ Instance Method Summary
161
+ <small><a href="#" class="summary_toggle">collapse</a></small>
162
+ </h2>
163
+
164
+ <ul class="summary">
165
+
166
+ <li class="public ">
167
+ <span class="summary_signature">
168
+
169
+ <a href="#async_send_message-instance_method" title="#async_send_message (instance method)">#<strong>async_send_message</strong>(method, params = {}) &#x21d2; Object </a>
170
+
171
+
172
+
173
+ </span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'></div></span>
184
+
185
+ </li>
186
+
187
+
188
+ <li class="public ">
189
+ <span class="summary_signature">
190
+
191
+ <a href="#detach-instance_method" title="#detach (instance method)">#<strong>detach</strong> &#x21d2; Object </a>
192
+
193
+
194
+
195
+ </span>
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <span class="summary_desc"><div class='inline'></div></span>
206
+
207
+ </li>
208
+
209
+
210
+ <li class="public ">
211
+ <span class="summary_signature">
212
+
213
+ <a href="#handle_closed-instance_method" title="#handle_closed (instance method)">#<strong>handle_closed</strong> &#x21d2; Object </a>
214
+
215
+
216
+
217
+ </span>
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+ <span class="summary_desc"><div class='inline'></div></span>
228
+
229
+ </li>
230
+
231
+
232
+ <li class="public ">
233
+ <span class="summary_signature">
234
+
235
+ <a href="#handle_message-instance_method" title="#handle_message (instance method)">#<strong>handle_message</strong>(message) &#x21d2; Object </a>
236
+
237
+
238
+
239
+ </span>
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+ <span class="summary_desc"><div class='inline'></div></span>
250
+
251
+ </li>
252
+
253
+
254
+ <li class="public ">
255
+ <span class="summary_signature">
256
+
257
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(connection, target_type, session_id) &#x21d2; CDPSession </a>
258
+
259
+
260
+
261
+ </span>
262
+
263
+
264
+ <span class="note title constructor">constructor</span>
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <span class="summary_desc"><div class='inline'>
274
+ <p>A new instance of CDPSession.</p>
275
+ </div></span>
276
+
277
+ </li>
278
+
279
+
280
+ <li class="public ">
281
+ <span class="summary_signature">
282
+
283
+ <a href="#send_message-instance_method" title="#send_message (instance method)">#<strong>send_message</strong>(method, params = {}) &#x21d2; Object </a>
284
+
285
+
286
+
287
+ </span>
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+ <span class="summary_desc"><div class='inline'></div></span>
298
+
299
+ </li>
300
+
301
+
302
+ </ul>
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="EventCallbackable.html" title="Puppeteer::EventCallbackable (module)">EventCallbackable</a></span></h3>
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>
327
+ <div id="constructor_details" class="method_details_list">
328
+ <h2>Constructor Details</h2>
329
+
330
+ <div class="method_details first">
331
+ <h3 class="signature first" id="initialize-instance_method">
332
+
333
+ #<strong>initialize</strong>(connection, target_type, session_id) &#x21d2; <tt><span class='object_link'><a href="" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>
334
+
335
+
336
+
337
+
338
+
339
+ </h3><div class="docstring">
340
+ <div class="discussion">
341
+
342
+ <p>Returns a new instance of CDPSession.</p>
343
+
344
+
345
+ </div>
346
+ </div>
347
+ <div class="tags">
348
+ <p class="tag_title">Parameters:</p>
349
+ <ul class="param">
350
+
351
+ <li>
352
+
353
+ <span class='name'>connection</span>
354
+
355
+
356
+ <span class='type'>(<tt>!<span class='object_link'><a href="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span></tt>)</span>
357
+
358
+
359
+
360
+ </li>
361
+
362
+ <li>
363
+
364
+ <span class='name'>targetType</span>
365
+
366
+
367
+ <span class='type'>(<tt>string</tt>)</span>
368
+
369
+
370
+
371
+ </li>
372
+
373
+ <li>
374
+
375
+ <span class='name'>sessionId</span>
376
+
377
+
378
+ <span class='type'>(<tt>string</tt>)</span>
379
+
380
+
381
+
382
+ </li>
383
+
384
+ </ul>
385
+
386
+
387
+ </div><table class="source_code">
388
+ <tr>
389
+ <td>
390
+ <pre class="lines">
391
+
392
+
393
+ 11
394
+ 12
395
+ 13
396
+ 14
397
+ 15
398
+ 16
399
+ 17</pre>
400
+ </td>
401
+ <td>
402
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 11</span>
403
+
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>
405
+ <span class='ivar'>@callbacks</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
406
+ <span class='ivar'>@connection</span> <span class='op'>=</span> <span class='id identifier rubyid_connection'>connection</span>
407
+ <span class='ivar'>@target_type</span> <span class='op'>=</span> <span class='id identifier rubyid_target_type'>target_type</span>
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>
410
+ <span class='kw'>end</span></pre>
411
+ </td>
412
+ </tr>
413
+ </table>
414
+ </div>
415
+
416
+ </div>
417
+
418
+ <div id="instance_attr_details" class="attr_details">
419
+ <h2>Instance Attribute Details</h2>
420
+
421
+
422
+ <span id=""></span>
423
+ <div class="method_details first">
424
+ <h3 class="signature first" id="connection-instance_method">
425
+
426
+ #<strong>connection</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
427
+
428
+
429
+
430
+
431
+
432
+ </h3><div class="docstring">
433
+ <div class="discussion">
434
+
435
+ <p>Returns the value of attribute connection.</p>
436
+
437
+
438
+ </div>
439
+ </div>
440
+ <div class="tags">
441
+
442
+
443
+ </div><table class="source_code">
444
+ <tr>
445
+ <td>
446
+ <pre class="lines">
447
+
448
+
449
+ 19
450
+ 20
451
+ 21</pre>
452
+ </td>
453
+ <td>
454
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 19</span>
455
+
456
+ <span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
457
+ <span class='ivar'>@connection</span>
458
+ <span class='kw'>end</span></pre>
459
+ </td>
460
+ </tr>
461
+ </table>
462
+ </div>
463
+
464
+ </div>
465
+
466
+
467
+ <div id="instance_method_details" class="method_details_list">
468
+ <h2>Instance Method Details</h2>
469
+
470
+
471
+ <div class="method_details first">
472
+ <h3 class="signature first" id="async_send_message-instance_method">
473
+
474
+ #<strong>async_send_message</strong>(method, params = {}) &#x21d2; <tt>Object</tt>
475
+
476
+
477
+
478
+
479
+
480
+ </h3><div class="docstring">
481
+ <div class="discussion">
482
+
483
+
484
+ </div>
485
+ </div>
486
+ <div class="tags">
487
+ <p class="tag_title">Parameters:</p>
488
+ <ul class="param">
489
+
490
+ <li>
491
+
492
+ <span class='name'>method</span>
493
+
494
+
495
+ <span class='type'>(<tt>String</tt>)</span>
496
+
497
+
498
+
499
+ </li>
500
+
501
+ <li>
502
+
503
+ <span class='name'>params</span>
504
+
505
+
506
+ <span class='type'>(<tt>Hash</tt>)</span>
507
+
508
+
509
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
510
+
511
+
512
+ </li>
513
+
514
+ </ul>
515
+
516
+
517
+ </div><table class="source_code">
518
+ <tr>
519
+ <td>
520
+ <pre class="lines">
521
+
522
+
523
+ 31
524
+ 32
525
+ 33
526
+ 34
527
+ 35
528
+ 36
529
+ 37
530
+ 38
531
+ 39
532
+ 40
533
+ 41
534
+ 42
535
+ 43
536
+ 44
537
+ 45</pre>
538
+ </td>
539
+ <td>
540
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 31</span>
541
+
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>
543
+ <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@connection</span>
544
+ <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'>Protocol error (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method'>method</span><span class='embexpr_end'>}</span><span class='tstring_content'>): Session closed. Most likely the </span><span class='embexpr_beg'>#{</span><span class='ivar'>@target_type</span><span class='embexpr_end'>}</span><span class='tstring_content'> has been closed.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
545
+ <span class='kw'>end</span>
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>
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>
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>
555
+ <span class='id identifier rubyid_promise'>promise</span>
556
+ <span class='kw'>end</span></pre>
557
+ </td>
558
+ </tr>
559
+ </table>
560
+ </div>
561
+
562
+ <div class="method_details ">
563
+ <h3 class="signature " id="detach-instance_method">
564
+
565
+ #<strong>detach</strong> &#x21d2; <tt>Object</tt>
566
+
567
+
568
+
569
+
570
+
571
+ </h3><table class="source_code">
572
+ <tr>
573
+ <td>
574
+ <pre class="lines">
575
+
576
+
577
+ 82
578
+ 83
579
+ 84
580
+ 85
581
+ 86
582
+ 87</pre>
583
+ </td>
584
+ <td>
585
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 82</span>
586
+
587
+ <span class='kw'>def</span> <span class='id identifier rubyid_detach'>detach</span>
588
+ <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@connection</span>
589
+ <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'>Session already detarched. Most likely the </span><span class='embexpr_beg'>#{</span><span class='ivar'>@target_type</span><span class='embexpr_end'>}</span><span class='tstring_content'> has been closed.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
590
+ <span class='kw'>end</span>
591
+ <span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_send_message'>send_message</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Target.detachFromTarget</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>sessionId:</span> <span class='ivar'>@session_id</span><span class='rparen'>)</span>
592
+ <span class='kw'>end</span></pre>
593
+ </td>
594
+ </tr>
595
+ </table>
596
+ </div>
597
+
598
+ <div class="method_details ">
599
+ <h3 class="signature " id="handle_closed-instance_method">
600
+
601
+ #<strong>handle_closed</strong> &#x21d2; <tt>Object</tt>
602
+
603
+
604
+
605
+
606
+
607
+ </h3><table class="source_code">
608
+ <tr>
609
+ <td>
610
+ <pre class="lines">
611
+
612
+
613
+ 89
614
+ 90
615
+ 91
616
+ 92
617
+ 93
618
+ 94
619
+ 95
620
+ 96
621
+ 97
622
+ 98
623
+ 99</pre>
624
+ </td>
625
+ <td>
626
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 89</span>
627
+
628
+ <span class='kw'>def</span> <span class='id identifier rubyid_handle_closed'>handle_closed</span>
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>
630
+ <span class='id identifier rubyid_callback'>callback</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span>
631
+ <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>
632
+ <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>
633
+ <span class='label'>error_message:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Target Closed.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
634
+ <span class='kw'>end</span>
635
+ <span class='ivar'>@callbacks</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
636
+ <span class='ivar'>@connection</span> <span class='op'>=</span> <span class='kw'>nil</span>
637
+ <span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Events.CDPSession.Disconnected</span><span class='tstring_end'>&#39;</span></span>
638
+ <span class='kw'>end</span></pre>
639
+ </td>
640
+ </tr>
641
+ </table>
642
+ </div>
643
+
644
+ <div class="method_details ">
645
+ <h3 class="signature " id="handle_message-instance_method">
646
+
647
+ #<strong>handle_message</strong>(message) &#x21d2; <tt>Object</tt>
648
+
649
+
650
+
651
+
652
+
653
+ </h3><div class="docstring">
654
+ <div class="discussion">
655
+
656
+
657
+ </div>
658
+ </div>
659
+ <div class="tags">
660
+ <p class="tag_title">Parameters:</p>
661
+ <ul class="param">
662
+
663
+ <li>
664
+
665
+ <span class='name'>object</span>
666
+
667
+
668
+ <span class='type'>(<tt>{id?: number, method: string, params: Object, error: {message: string, data: any}, result?: *}</tt>)</span>
669
+
670
+
671
+
672
+ </li>
673
+
674
+ </ul>
675
+
676
+
677
+ </div><table class="source_code">
678
+ <tr>
679
+ <td>
680
+ <pre class="lines">
681
+
682
+
683
+ 48
684
+ 49
685
+ 50
686
+ 51
687
+ 52
688
+ 53
689
+ 54
690
+ 55
691
+ 56
692
+ 57
693
+ 58
694
+ 59
695
+ 60
696
+ 61
697
+ 62
698
+ 63
699
+ 64
700
+ 65
701
+ 66
702
+ 67
703
+ 68</pre>
704
+ </td>
705
+ <td>
706
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 48</span>
707
+
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>
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>
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>
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>
712
+ <span class='kw'>else</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>
724
+ <span class='kw'>end</span>
725
+ <span class='kw'>else</span>
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>
727
+ <span class='kw'>end</span>
728
+ <span class='kw'>end</span></pre>
729
+ </td>
730
+ </tr>
731
+ </table>
732
+ </div>
733
+
734
+ <div class="method_details ">
735
+ <h3 class="signature " id="send_message-instance_method">
736
+
737
+ #<strong>send_message</strong>(method, params = {}) &#x21d2; <tt>Object</tt>
738
+
739
+
740
+
741
+
742
+
743
+ </h3><div class="docstring">
744
+ <div class="discussion">
745
+
746
+
747
+ </div>
748
+ </div>
749
+ <div class="tags">
750
+ <p class="tag_title">Parameters:</p>
751
+ <ul class="param">
752
+
753
+ <li>
754
+
755
+ <span class='name'>method</span>
756
+
757
+
758
+ <span class='type'>(<tt>String</tt>)</span>
759
+
760
+
761
+
762
+ </li>
763
+
764
+ <li>
765
+
766
+ <span class='name'>params</span>
767
+
768
+
769
+ <span class='type'>(<tt>Hash</tt>)</span>
770
+
771
+
772
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
773
+
774
+
775
+ </li>
776
+
777
+ </ul>
778
+
779
+
780
+ </div><table class="source_code">
781
+ <tr>
782
+ <td>
783
+ <pre class="lines">
784
+
785
+
786
+ 24
787
+ 25
788
+ 26</pre>
789
+ </td>
790
+ <td>
791
+ <pre class="code"><span class="info file"># File 'lib/puppeteer/cdp_session.rb', line 24</span>
792
+
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>
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>
795
+ <span class='kw'>end</span></pre>
796
+ </td>
797
+ </tr>
798
+ </table>
799
+ </div>
800
+
801
+ </div>
802
+
803
+ </div>
804
+
805
+ <div id="footer">
806
+ Generated on Thu Jun 4 23:54:42 2020 by
807
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
808
+ 0.9.24 (ruby-2.6.3).
809
+ </div>
810
+
811
+ </div>
812
+ </body>
813
+ </html>