puppeteer-ruby 0.0.13 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +2 -14
  3. data/.github/workflows/docs.yml +45 -0
  4. data/.github/workflows/reviewdog.yml +15 -0
  5. data/.rubocop.yml +39 -3
  6. data/README.md +54 -1
  7. data/lib/puppeteer.rb +10 -2
  8. data/lib/puppeteer/browser.rb +53 -34
  9. data/lib/puppeteer/browser_context.rb +35 -5
  10. data/lib/puppeteer/cdp_session.rb +3 -19
  11. data/lib/puppeteer/concurrent_ruby_utils.rb +6 -0
  12. data/lib/puppeteer/connection.rb +9 -16
  13. data/lib/puppeteer/debug_print.rb +1 -1
  14. data/lib/puppeteer/define_async_method.rb +23 -0
  15. data/lib/puppeteer/dom_world.rb +84 -73
  16. data/lib/puppeteer/element_handle.rb +46 -63
  17. data/lib/puppeteer/emulation_manager.rb +2 -6
  18. data/lib/puppeteer/env.rb +18 -0
  19. data/lib/puppeteer/execution_context.rb +1 -6
  20. data/lib/puppeteer/frame.rb +46 -46
  21. data/lib/puppeteer/frame_manager.rb +7 -25
  22. data/lib/puppeteer/js_handle.rb +39 -38
  23. data/lib/puppeteer/keyboard.rb +9 -29
  24. data/lib/puppeteer/mouse.rb +20 -24
  25. data/lib/puppeteer/network_manager.rb +163 -5
  26. data/lib/puppeteer/page.rb +221 -181
  27. data/lib/puppeteer/page/pdf_options.rb +166 -0
  28. data/lib/puppeteer/remote_object.rb +18 -5
  29. data/lib/puppeteer/request.rb +330 -0
  30. data/lib/puppeteer/response.rb +113 -0
  31. data/lib/puppeteer/touch_screen.rb +2 -7
  32. data/lib/puppeteer/version.rb +1 -1
  33. data/lib/puppeteer/wait_task.rb +3 -5
  34. data/lib/puppeteer/web_socket.rb +7 -0
  35. data/puppeteer-ruby.gemspec +2 -1
  36. metadata +25 -103
  37. data/docs/Puppeteer.html +0 -2338
  38. data/docs/Puppeteer/AsyncAwaitBehavior.html +0 -105
  39. data/docs/Puppeteer/Browser.html +0 -2258
  40. data/docs/Puppeteer/BrowserContext.html +0 -809
  41. data/docs/Puppeteer/BrowserFetcher.html +0 -214
  42. data/docs/Puppeteer/BrowserRunner.html +0 -914
  43. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +0 -477
  44. data/docs/Puppeteer/CDPSession.html +0 -813
  45. data/docs/Puppeteer/CDPSession/Error.html +0 -124
  46. data/docs/Puppeteer/ConcurrentRubyUtils.html +0 -438
  47. data/docs/Puppeteer/Connection.html +0 -964
  48. data/docs/Puppeteer/Connection/MessageCallback.html +0 -434
  49. data/docs/Puppeteer/Connection/ProtocolError.html +0 -216
  50. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +0 -217
  51. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +0 -244
  52. data/docs/Puppeteer/ConsoleMessage.html +0 -565
  53. data/docs/Puppeteer/ConsoleMessage/Location.html +0 -433
  54. data/docs/Puppeteer/DOMWorld.html +0 -2293
  55. data/docs/Puppeteer/DOMWorld/DetachedError.html +0 -124
  56. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +0 -124
  57. data/docs/Puppeteer/DebugPrint.html +0 -233
  58. data/docs/Puppeteer/Device.html +0 -470
  59. data/docs/Puppeteer/Devices.html +0 -139
  60. data/docs/Puppeteer/ElementHandle.html +0 -2542
  61. data/docs/Puppeteer/ElementHandle/BoundingBox.html +0 -507
  62. data/docs/Puppeteer/ElementHandle/BoxModel.html +0 -404
  63. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +0 -206
  64. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +0 -206
  65. data/docs/Puppeteer/ElementHandle/Point.html +0 -492
  66. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +0 -124
  67. data/docs/Puppeteer/EmulationManager.html +0 -454
  68. data/docs/Puppeteer/EventCallbackable.html +0 -499
  69. data/docs/Puppeteer/EventCallbackable/EventListeners.html +0 -435
  70. data/docs/Puppeteer/ExecutionContext.html +0 -998
  71. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +0 -124
  72. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +0 -357
  73. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +0 -389
  74. data/docs/Puppeteer/FileChooser.html +0 -455
  75. data/docs/Puppeteer/Frame.html +0 -3835
  76. data/docs/Puppeteer/FrameManager.html +0 -2410
  77. data/docs/Puppeteer/FrameManager/NavigationError.html +0 -124
  78. data/docs/Puppeteer/IfPresent.html +0 -222
  79. data/docs/Puppeteer/JSHandle.html +0 -1352
  80. data/docs/Puppeteer/Keyboard.html +0 -1557
  81. data/docs/Puppeteer/Keyboard/KeyDefinition.html +0 -831
  82. data/docs/Puppeteer/Keyboard/KeyDescription.html +0 -603
  83. data/docs/Puppeteer/Launcher.html +0 -237
  84. data/docs/Puppeteer/Launcher/Base.html +0 -385
  85. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +0 -124
  86. data/docs/Puppeteer/Launcher/BrowserOptions.html +0 -441
  87. data/docs/Puppeteer/Launcher/Chrome.html +0 -674
  88. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +0 -382
  89. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +0 -531
  90. data/docs/Puppeteer/Launcher/LaunchOptions.html +0 -893
  91. data/docs/Puppeteer/LifecycleWatcher.html +0 -834
  92. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +0 -363
  93. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +0 -206
  94. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +0 -124
  95. data/docs/Puppeteer/Mouse.html +0 -1095
  96. data/docs/Puppeteer/Mouse/Button.html +0 -136
  97. data/docs/Puppeteer/NetworkManager.html +0 -901
  98. data/docs/Puppeteer/NetworkManager/Credentials.html +0 -385
  99. data/docs/Puppeteer/Page.html +0 -6173
  100. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +0 -206
  101. data/docs/Puppeteer/Page/ScreenshotOptions.html +0 -845
  102. data/docs/Puppeteer/Page/ScriptTag.html +0 -555
  103. data/docs/Puppeteer/Page/StyleTag.html +0 -448
  104. data/docs/Puppeteer/Page/TargetCrashedError.html +0 -124
  105. data/docs/Puppeteer/RemoteObject.html +0 -1087
  106. data/docs/Puppeteer/Target.html +0 -1336
  107. data/docs/Puppeteer/Target/InitializeFailure.html +0 -124
  108. data/docs/Puppeteer/Target/TargetInfo.html +0 -729
  109. data/docs/Puppeteer/TimeoutError.html +0 -135
  110. data/docs/Puppeteer/TimeoutSettings.html +0 -496
  111. data/docs/Puppeteer/TouchScreen.html +0 -464
  112. data/docs/Puppeteer/Viewport.html +0 -837
  113. data/docs/Puppeteer/WaitTask.html +0 -637
  114. data/docs/Puppeteer/WaitTask/TerminatedError.html +0 -124
  115. data/docs/Puppeteer/WaitTask/TimeoutError.html +0 -206
  116. data/docs/Puppeteer/WebSocket.html +0 -673
  117. data/docs/Puppeteer/WebSocket/DriverImpl.html +0 -412
  118. data/docs/Puppeteer/WebSocket/TransportError.html +0 -124
  119. data/docs/Puppeteer/WebSocketTransport.html +0 -600
  120. data/docs/Puppeteer/WebSocktTransportError.html +0 -124
  121. data/docs/_index.html +0 -816
  122. data/docs/class_list.html +0 -51
  123. data/docs/css/common.css +0 -1
  124. data/docs/css/full_list.css +0 -58
  125. data/docs/css/style.css +0 -496
  126. data/docs/file.README.html +0 -125
  127. data/docs/file_list.html +0 -56
  128. data/docs/frames.html +0 -17
  129. data/docs/index.html +0 -125
  130. data/docs/js/app.js +0 -314
  131. data/docs/js/full_list.js +0 -216
  132. data/docs/js/jquery.js +0 -4
  133. data/docs/method_list.html +0 -4123
  134. data/docs/top-level-namespace.html +0 -126
  135. data/lib/puppeteer/async_await_behavior.rb +0 -38
@@ -1,813 +0,0 @@
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#observe_first-instance_method" title="Puppeteer::EventCallbackable#observe_first (method)">#observe_first</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 Wed Jun 24 03:08:00 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>