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,964 +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::Connection
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::Connection";
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">Connection</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::Connection
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::Connection</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/connection.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="Connection/MessageCallback.html" title="Puppeteer::Connection::MessageCallback (class)">MessageCallback</a></span>, <span class='object_link'><a href="Connection/ProtocolError.html" title="Puppeteer::Connection::ProtocolError (class)">ProtocolError</a></span>, <span class='object_link'><a href="Connection/RequestDebugPrinter.html" title="Puppeteer::Connection::RequestDebugPrinter (class)">RequestDebugPrinter</a></span>, <span class='object_link'><a href="Connection/ResponseDebugPrinter.html" title="Puppeteer::Connection::ResponseDebugPrinter (class)">ResponseDebugPrinter</a></span>
114
-
115
-
116
- </p>
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
- <h2>
126
- Class Method Summary
127
- <small><a href="#" class="summary_toggle">collapse</a></small>
128
- </h2>
129
-
130
- <ul class="summary">
131
-
132
- <li class="public ">
133
- <span class="summary_signature">
134
-
135
- <a href="#from_session-class_method" title="from_session (class method)">.<strong>from_session</strong>(session) &#x21d2; Object </a>
136
-
137
-
138
-
139
- </span>
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
- <span class="summary_desc"><div class='inline'></div></span>
150
-
151
- </li>
152
-
153
-
154
- </ul>
155
-
156
- <h2>
157
- Instance Method Summary
158
- <small><a href="#" class="summary_toggle">collapse</a></small>
159
- </h2>
160
-
161
- <ul class="summary">
162
-
163
- <li class="public ">
164
- <span class="summary_signature">
165
-
166
- <a href="#async_send_message-instance_method" title="#async_send_message (instance method)">#<strong>async_send_message</strong>(method, params = {}) &#x21d2; Object </a>
167
-
168
-
169
-
170
- </span>
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
- <span class="summary_desc"><div class='inline'></div></span>
181
-
182
- </li>
183
-
184
-
185
- <li class="public ">
186
- <span class="summary_signature">
187
-
188
- <a href="#create_session-instance_method" title="#create_session (instance method)">#<strong>create_session</strong>(target_info) &#x21d2; CDPSession </a>
189
-
190
-
191
-
192
- </span>
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
- <span class="summary_desc"><div class='inline'></div></span>
203
-
204
- </li>
205
-
206
-
207
- <li class="public ">
208
- <span class="summary_signature">
209
-
210
- <a href="#dispose-instance_method" title="#dispose (instance method)">#<strong>dispose</strong> &#x21d2; Object </a>
211
-
212
-
213
-
214
- </span>
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
- <span class="summary_desc"><div class='inline'></div></span>
225
-
226
- </li>
227
-
228
-
229
- <li class="public ">
230
- <span class="summary_signature">
231
-
232
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(url, transport, delay = 0) &#x21d2; Connection </a>
233
-
234
-
235
-
236
- </span>
237
-
238
-
239
- <span class="note title constructor">constructor</span>
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
- <span class="summary_desc"><div class='inline'>
249
- <p>A new instance of Connection.</p>
250
- </div></span>
251
-
252
- </li>
253
-
254
-
255
- <li class="public ">
256
- <span class="summary_signature">
257
-
258
- <a href="#on_close-instance_method" title="#on_close (instance method)">#<strong>on_close</strong>(&amp;block) &#x21d2; Object </a>
259
-
260
-
261
-
262
- </span>
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
- <span class="summary_desc"><div class='inline'></div></span>
273
-
274
- </li>
275
-
276
-
277
- <li class="public ">
278
- <span class="summary_signature">
279
-
280
- <a href="#on_message-instance_method" title="#on_message (instance method)">#<strong>on_message</strong>(&amp;block) &#x21d2; Object </a>
281
-
282
-
283
-
284
- </span>
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
- <span class="summary_desc"><div class='inline'></div></span>
295
-
296
- </li>
297
-
298
-
299
- <li class="public ">
300
- <span class="summary_signature">
301
-
302
- <a href="#raw_send-instance_method" title="#raw_send (instance method)">#<strong>raw_send</strong>(message:) &#x21d2; Object </a>
303
-
304
-
305
-
306
- </span>
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
- <span class="summary_desc"><div class='inline'></div></span>
317
-
318
- </li>
319
-
320
-
321
- <li class="public ">
322
- <span class="summary_signature">
323
-
324
- <a href="#send_message-instance_method" title="#send_message (instance method)">#<strong>send_message</strong>(method, params = {}) &#x21d2; Object </a>
325
-
326
-
327
-
328
- </span>
329
-
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
- <span class="summary_desc"><div class='inline'></div></span>
339
-
340
- </li>
341
-
342
-
343
- <li class="public ">
344
- <span class="summary_signature">
345
-
346
- <a href="#session-instance_method" title="#session (instance method)">#<strong>session</strong>(session_id) &#x21d2; ?CDPSession </a>
347
-
348
-
349
-
350
- </span>
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
- <span class="summary_desc"><div class='inline'></div></span>
361
-
362
- </li>
363
-
364
-
365
- <li class="public ">
366
- <span class="summary_signature">
367
-
368
- <a href="#url-instance_method" title="#url (instance method)">#<strong>url</strong> &#x21d2; Object </a>
369
-
370
-
371
-
372
- </span>
373
-
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
- <span class="summary_desc"><div class='inline'></div></span>
383
-
384
- </li>
385
-
386
-
387
- </ul>
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
- <h3 class="inherited">Methods included from <span class='object_link'><a href="EventCallbackable.html" title="Puppeteer::EventCallbackable (module)">EventCallbackable</a></span></h3>
400
- <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>
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
- <h3 class="inherited">Methods included from <span class='object_link'><a href="DebugPrint.html" title="Puppeteer::DebugPrint (module)">DebugPrint</a></span></h3>
411
- <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>
412
- <div id="constructor_details" class="method_details_list">
413
- <h2>Constructor Details</h2>
414
-
415
- <div class="method_details first">
416
- <h3 class="signature first" id="initialize-instance_method">
417
-
418
- #<strong>initialize</strong>(url, transport, delay = 0) &#x21d2; <tt><span class='object_link'><a href="" title="Puppeteer::Connection (class)">Connection</a></span></tt>
419
-
420
-
421
-
422
-
423
-
424
- </h3><div class="docstring">
425
- <div class="discussion">
426
-
427
- <p>Returns a new instance of Connection.</p>
428
-
429
-
430
- </div>
431
- </div>
432
- <div class="tags">
433
-
434
-
435
- </div><table class="source_code">
436
- <tr>
437
- <td>
438
- <pre class="lines">
439
-
440
-
441
- 39
442
- 40
443
- 41
444
- 42
445
- 43
446
- 44
447
- 45
448
- 46
449
- 47
450
- 48
451
- 49
452
- 50
453
- 51
454
- 52
455
- 53
456
- 54
457
- 55
458
- 56
459
- 57</pre>
460
- </td>
461
- <td>
462
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 39</span>
463
-
464
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_transport'>transport</span><span class='comma'>,</span> <span class='id identifier rubyid_delay'>delay</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
465
- <span class='ivar'>@url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span>
466
- <span class='ivar'>@last_id</span> <span class='op'>=</span> <span class='int'>0</span>
467
- <span class='ivar'>@callbacks</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
468
- <span class='ivar'>@delay</span> <span class='op'>=</span> <span class='id identifier rubyid_delay'>delay</span>
469
-
470
- <span class='ivar'>@transport</span> <span class='op'>=</span> <span class='id identifier rubyid_transport'>transport</span>
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>
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>
475
- <span class='kw'>end</span>
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>
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>
478
- <span class='kw'>end</span>
479
-
480
- <span class='ivar'>@sessions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
481
- <span class='ivar'>@closed</span> <span class='op'>=</span> <span class='kw'>false</span>
482
- <span class='kw'>end</span></pre>
483
- </td>
484
- </tr>
485
- </table>
486
- </div>
487
-
488
- </div>
489
-
490
-
491
- <div id="class_method_details" class="method_details_list">
492
- <h2>Class Method Details</h2>
493
-
494
-
495
- <div class="method_details first">
496
- <h3 class="signature first" id="from_session-class_method">
497
-
498
- .<strong>from_session</strong>(session) &#x21d2; <tt>Object</tt>
499
-
500
-
501
-
502
-
503
-
504
- </h3><table class="source_code">
505
- <tr>
506
- <td>
507
- <pre class="lines">
508
-
509
-
510
- 69
511
- 70
512
- 71</pre>
513
- </td>
514
- <td>
515
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 69</span>
516
-
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>
518
- <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span>
519
- <span class='kw'>end</span></pre>
520
- </td>
521
- </tr>
522
- </table>
523
- </div>
524
-
525
- </div>
526
-
527
- <div id="instance_method_details" class="method_details_list">
528
- <h2>Instance Method Details</h2>
529
-
530
-
531
- <div class="method_details first">
532
- <h3 class="signature first" id="async_send_message-instance_method">
533
-
534
- #<strong>async_send_message</strong>(method, params = {}) &#x21d2; <tt>Object</tt>
535
-
536
-
537
-
538
-
539
-
540
- </h3><table class="source_code">
541
- <tr>
542
- <td>
543
- <pre class="lines">
544
-
545
-
546
- 89
547
- 90
548
- 91
549
- 92
550
- 93
551
- 94</pre>
552
- </td>
553
- <td>
554
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 89</span>
555
-
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>
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>
558
- <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>
559
- <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="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>
560
- <span class='id identifier rubyid_promise'>promise</span>
561
- <span class='kw'>end</span></pre>
562
- </td>
563
- </tr>
564
- </table>
565
- </div>
566
-
567
- <div class="method_details ">
568
- <h3 class="signature " id="create_session-instance_method">
569
-
570
- #<strong>create_session</strong>(target_info) &#x21d2; <tt><span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>
571
-
572
-
573
-
574
-
575
-
576
- </h3><div class="docstring">
577
- <div class="discussion">
578
-
579
-
580
- </div>
581
- </div>
582
- <div class="tags">
583
- <p class="tag_title">Parameters:</p>
584
- <ul class="param">
585
-
586
- <li>
587
-
588
- <span class='name'>targetInfo</span>
589
-
590
-
591
- <span class='type'>(<tt>Protocol.<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>.TargetInfo</tt>)</span>
592
-
593
-
594
-
595
- </li>
596
-
597
- </ul>
598
-
599
- <p class="tag_title">Returns:</p>
600
- <ul class="return">
601
-
602
- <li>
603
-
604
-
605
- <span class='type'>(<tt><span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>)</span>
606
-
607
-
608
-
609
- </li>
610
-
611
- </ul>
612
-
613
- </div><table class="source_code">
614
- <tr>
615
- <td>
616
- <pre class="lines">
617
-
618
-
619
- 251
620
- 252
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>
634
- </td>
635
- <td>
636
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 251</span>
637
-
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>
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>
640
- <span class='id identifier rubyid_session_id'>session_id</span> <span class='op'>=</span> <span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>sessionId</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
641
-
642
- <span class='comment'># Target.attachedToTarget is often notified after the result of Target.attachToTarget.
643
- </span> <span class='comment'># D, [2020-04-04T23:04:30.736311 #91875] DEBUG -- : RECV &lt;&lt; {&quot;id&quot;=&gt;2, &quot;result&quot;=&gt;{&quot;sessionId&quot;=&gt;&quot;DA002F8A95B04710502CB40D8430B95A&quot;}}
644
- </span> <span class='comment'># D, [2020-04-04T23:04:30.736649 #91875] DEBUG -- : RECV &lt;&lt; {&quot;method&quot;=&gt;&quot;Target.attachedToTarget&quot;, &quot;params&quot;=&gt;{&quot;sessionId&quot;=&gt;&quot;DA002F8A95B04710502CB40D8430B95A&quot;, &quot;targetInfo&quot;=&gt;{&quot;targetId&quot;=&gt;&quot;EBAB949A7DE63F12CB94268AD3A9976B&quot;, &quot;type&quot;=&gt;&quot;page&quot;, &quot;title&quot;=&gt;&quot;about:blank&quot;, &quot;url&quot;=&gt;&quot;about:blank&quot;, &quot;attached&quot;=&gt;true, &quot;browserContextId&quot;=&gt;&quot;46D23767E9B79DD9E589101121F6DADD&quot;}, &quot;waitingForDebugger&quot;=&gt;false}}
645
- </span> <span class='comment'># So we have to wait for &quot;Target.attachedToTarget&quot; a bit.
646
- </span> <span class='int'>20</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span>
647
- <span class='kw'>if</span> <span class='ivar'>@sessions</span><span class='lbracket'>[</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rbracket'>]</span>
648
- <span class='kw'>return</span> <span class='ivar'>@sessions</span><span class='lbracket'>[</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rbracket'>]</span>
649
- <span class='kw'>end</span>
650
- <span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.1</span>
651
- <span class='kw'>end</span>
652
- <span class='kw'>end</span></pre>
653
- </td>
654
- </tr>
655
- </table>
656
- </div>
657
-
658
- <div class="method_details ">
659
- <h3 class="signature " id="dispose-instance_method">
660
-
661
- #<strong>dispose</strong> &#x21d2; <tt>Object</tt>
662
-
663
-
664
-
665
-
666
-
667
- </h3><table class="source_code">
668
- <tr>
669
- <td>
670
- <pre class="lines">
671
-
672
-
673
- 244
674
- 245
675
- 246
676
- 247</pre>
677
- </td>
678
- <td>
679
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 244</span>
680
-
681
- <span class='kw'>def</span> <span class='id identifier rubyid_dispose'>dispose</span>
682
- <span class='id identifier rubyid_handle_close'>handle_close</span>
683
- <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
684
- <span class='kw'>end</span></pre>
685
- </td>
686
- </tr>
687
- </table>
688
- </div>
689
-
690
- <div class="method_details ">
691
- <h3 class="signature " id="on_close-instance_method">
692
-
693
- #<strong>on_close</strong>(&amp;block) &#x21d2; <tt>Object</tt>
694
-
695
-
696
-
697
-
698
-
699
- </h3><table class="source_code">
700
- <tr>
701
- <td>
702
- <pre class="lines">
703
-
704
-
705
- 236
706
- 237
707
- 238</pre>
708
- </td>
709
- <td>
710
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 236</span>
711
-
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>
713
- <span class='ivar'>@on_close</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
714
- <span class='kw'>end</span></pre>
715
- </td>
716
- </tr>
717
- </table>
718
- </div>
719
-
720
- <div class="method_details ">
721
- <h3 class="signature " id="on_message-instance_method">
722
-
723
- #<strong>on_message</strong>(&amp;block) &#x21d2; <tt>Object</tt>
724
-
725
-
726
-
727
-
728
-
729
- </h3><table class="source_code">
730
- <tr>
731
- <td>
732
- <pre class="lines">
733
-
734
-
735
- 240
736
- 241
737
- 242</pre>
738
- </td>
739
- <td>
740
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 240</span>
741
-
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>
743
- <span class='ivar'>@on_message</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
744
- <span class='kw'>end</span></pre>
745
- </td>
746
- </tr>
747
- </table>
748
- </div>
749
-
750
- <div class="method_details ">
751
- <h3 class="signature " id="raw_send-instance_method">
752
-
753
- #<strong>raw_send</strong>(message:) &#x21d2; <tt>Object</tt>
754
-
755
-
756
-
757
-
758
-
759
- </h3><table class="source_code">
760
- <tr>
761
- <td>
762
- <pre class="lines">
763
-
764
-
765
- 100
766
- 101
767
- 102
768
- 103
769
- 104
770
- 105
771
- 106</pre>
772
- </td>
773
- <td>
774
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 100</span>
775
-
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>
777
- <span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_id'>generate_id</span>
778
- <span class='id identifier rubyid_payload'>payload</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_fast_generate'>fast_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>id:</span> <span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span><span class='rparen'>)</span>
779
- <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_send_text'>send_text</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
780
- <span class='id identifier rubyid_request_debug_printer'>request_debug_printer</span><span class='period'>.</span><span class='id identifier rubyid_handle_payload'>handle_payload</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
781
- <span class='id identifier rubyid_id'>id</span>
782
- <span class='kw'>end</span></pre>
783
- </td>
784
- </tr>
785
- </table>
786
- </div>
787
-
788
- <div class="method_details ">
789
- <h3 class="signature " id="send_message-instance_method">
790
-
791
- #<strong>send_message</strong>(method, params = {}) &#x21d2; <tt>Object</tt>
792
-
793
-
794
-
795
-
796
-
797
- </h3><div class="docstring">
798
- <div class="discussion">
799
-
800
-
801
- </div>
802
- </div>
803
- <div class="tags">
804
- <p class="tag_title">Parameters:</p>
805
- <ul class="param">
806
-
807
- <li>
808
-
809
- <span class='name'>method</span>
810
-
811
-
812
- <span class='type'>(<tt>string</tt>)</span>
813
-
814
-
815
-
816
- </li>
817
-
818
- <li>
819
-
820
- <span class='name'>params</span>
821
-
822
-
823
- <span class='type'>(<tt>!Object=</tt>)</span>
824
-
825
-
826
- <em class="default">(defaults to: <tt>{}</tt>)</em>
827
-
828
-
829
- </li>
830
-
831
- </ul>
832
-
833
-
834
- </div><table class="source_code">
835
- <tr>
836
- <td>
837
- <pre class="lines">
838
-
839
-
840
- 85
841
- 86
842
- 87</pre>
843
- </td>
844
- <td>
845
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 85</span>
846
-
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>
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>
849
- <span class='kw'>end</span></pre>
850
- </td>
851
- </tr>
852
- </table>
853
- </div>
854
-
855
- <div class="method_details ">
856
- <h3 class="signature " id="session-instance_method">
857
-
858
- #<strong>session</strong>(session_id) &#x21d2; <tt>?<span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>
859
-
860
-
861
-
862
-
863
-
864
- </h3><div class="docstring">
865
- <div class="discussion">
866
-
867
-
868
- </div>
869
- </div>
870
- <div class="tags">
871
- <p class="tag_title">Parameters:</p>
872
- <ul class="param">
873
-
874
- <li>
875
-
876
- <span class='name'>sessionId</span>
877
-
878
-
879
- <span class='type'>(<tt>string</tt>)</span>
880
-
881
-
882
-
883
- </li>
884
-
885
- </ul>
886
-
887
- <p class="tag_title">Returns:</p>
888
- <ul class="return">
889
-
890
- <li>
891
-
892
-
893
- <span class='type'>(<tt>?<span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>)</span>
894
-
895
-
896
-
897
- </li>
898
-
899
- </ul>
900
-
901
- </div><table class="source_code">
902
- <tr>
903
- <td>
904
- <pre class="lines">
905
-
906
-
907
- 75
908
- 76
909
- 77</pre>
910
- </td>
911
- <td>
912
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 75</span>
913
-
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>
915
- <span class='ivar'>@sessions</span><span class='lbracket'>[</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rbracket'>]</span>
916
- <span class='kw'>end</span></pre>
917
- </td>
918
- </tr>
919
- </table>
920
- </div>
921
-
922
- <div class="method_details ">
923
- <h3 class="signature " id="url-instance_method">
924
-
925
- #<strong>url</strong> &#x21d2; <tt>Object</tt>
926
-
927
-
928
-
929
-
930
-
931
- </h3><table class="source_code">
932
- <tr>
933
- <td>
934
- <pre class="lines">
935
-
936
-
937
- 79
938
- 80
939
- 81</pre>
940
- </td>
941
- <td>
942
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 79</span>
943
-
944
- <span class='kw'>def</span> <span class='id identifier rubyid_url'>url</span>
945
- <span class='ivar'>@url</span>
946
- <span class='kw'>end</span></pre>
947
- </td>
948
- </tr>
949
- </table>
950
- </div>
951
-
952
- </div>
953
-
954
- </div>
955
-
956
- <div id="footer">
957
- Generated on Wed Jun 24 03:08:00 2020 by
958
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
959
- 0.9.24 (ruby-2.6.3).
960
- </div>
961
-
962
- </div>
963
- </body>
964
- </html>