puppeteer-ruby 0.0.10 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +0 -12
  3. data/.github/workflows/docs.yml +45 -0
  4. data/.github/workflows/reviewdog.yml +15 -0
  5. data/README.md +54 -1
  6. data/lib/puppeteer.rb +37 -13
  7. data/lib/puppeteer/browser.rb +39 -26
  8. data/lib/puppeteer/cdp_session.rb +3 -19
  9. data/lib/puppeteer/concurrent_ruby_utils.rb +12 -2
  10. data/lib/puppeteer/connection.rb +16 -16
  11. data/lib/puppeteer/define_async_method.rb +23 -0
  12. data/lib/puppeteer/dom_world.rb +58 -71
  13. data/lib/puppeteer/element_handle.rb +15 -44
  14. data/lib/puppeteer/emulation_manager.rb +2 -6
  15. data/lib/puppeteer/event_callbackable.rb +11 -0
  16. data/lib/puppeteer/execution_context.rb +1 -6
  17. data/lib/puppeteer/frame.rb +38 -3
  18. data/lib/puppeteer/frame_manager.rb +7 -25
  19. data/lib/puppeteer/js_handle.rb +3 -12
  20. data/lib/puppeteer/keyboard.rb +6 -27
  21. data/lib/puppeteer/launcher.rb +6 -6
  22. data/lib/puppeteer/launcher/chrome.rb +10 -8
  23. data/lib/puppeteer/mouse.rb +8 -33
  24. data/lib/puppeteer/page.rb +132 -121
  25. data/lib/puppeteer/page/pdf_options.rb +166 -0
  26. data/lib/puppeteer/remote_object.rb +2 -5
  27. data/lib/puppeteer/target.rb +1 -1
  28. data/lib/puppeteer/touch_screen.rb +2 -7
  29. data/lib/puppeteer/version.rb +1 -1
  30. data/lib/puppeteer/wait_task.rb +2 -4
  31. data/lib/puppeteer/web_socket_transport.rb +8 -8
  32. data/puppeteer-ruby.gemspec +1 -1
  33. data/puppeteer-ruby.png +0 -0
  34. metadata +9 -102
  35. data/Dockerfile +0 -6
  36. data/docker-compose.yml +0 -15
  37. data/docs/Puppeteer.html +0 -2020
  38. data/docs/Puppeteer/AsyncAwaitBehavior.html +0 -105
  39. data/docs/Puppeteer/Browser.html +0 -2148
  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 -430
  47. data/docs/Puppeteer/Connection.html +0 -960
  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 -2219
  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/ElementNotFoundError.html +0 -206
  62. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +0 -206
  63. data/docs/Puppeteer/ElementHandle/Point.html +0 -492
  64. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +0 -124
  65. data/docs/Puppeteer/EmulationManager.html +0 -454
  66. data/docs/Puppeteer/EventCallbackable.html +0 -433
  67. data/docs/Puppeteer/EventCallbackable/EventListeners.html +0 -435
  68. data/docs/Puppeteer/ExecutionContext.html +0 -998
  69. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +0 -124
  70. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +0 -357
  71. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +0 -389
  72. data/docs/Puppeteer/FileChooser.html +0 -455
  73. data/docs/Puppeteer/Frame.html +0 -3677
  74. data/docs/Puppeteer/FrameManager.html +0 -2410
  75. data/docs/Puppeteer/FrameManager/NavigationError.html +0 -124
  76. data/docs/Puppeteer/IfPresent.html +0 -222
  77. data/docs/Puppeteer/JSHandle.html +0 -1352
  78. data/docs/Puppeteer/Keyboard.html +0 -1557
  79. data/docs/Puppeteer/Keyboard/KeyDefinition.html +0 -831
  80. data/docs/Puppeteer/Keyboard/KeyDescription.html +0 -603
  81. data/docs/Puppeteer/Launcher.html +0 -237
  82. data/docs/Puppeteer/Launcher/Base.html +0 -385
  83. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +0 -124
  84. data/docs/Puppeteer/Launcher/BrowserOptions.html +0 -441
  85. data/docs/Puppeteer/Launcher/Chrome.html +0 -669
  86. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +0 -382
  87. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +0 -531
  88. data/docs/Puppeteer/Launcher/LaunchOptions.html +0 -893
  89. data/docs/Puppeteer/LifecycleWatcher.html +0 -834
  90. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +0 -363
  91. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +0 -206
  92. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +0 -124
  93. data/docs/Puppeteer/Mouse.html +0 -1105
  94. data/docs/Puppeteer/Mouse/Button.html +0 -136
  95. data/docs/Puppeteer/NetworkManager.html +0 -901
  96. data/docs/Puppeteer/NetworkManager/Credentials.html +0 -385
  97. data/docs/Puppeteer/Page.html +0 -5970
  98. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +0 -206
  99. data/docs/Puppeteer/Page/ScreenshotOptions.html +0 -845
  100. data/docs/Puppeteer/Page/ScriptTag.html +0 -555
  101. data/docs/Puppeteer/Page/StyleTag.html +0 -448
  102. data/docs/Puppeteer/Page/TargetCrashedError.html +0 -124
  103. data/docs/Puppeteer/RemoteObject.html +0 -1087
  104. data/docs/Puppeteer/Target.html +0 -1336
  105. data/docs/Puppeteer/Target/InitializeFailure.html +0 -124
  106. data/docs/Puppeteer/Target/TargetInfo.html +0 -729
  107. data/docs/Puppeteer/TimeoutError.html +0 -135
  108. data/docs/Puppeteer/TimeoutSettings.html +0 -496
  109. data/docs/Puppeteer/TouchScreen.html +0 -464
  110. data/docs/Puppeteer/Viewport.html +0 -837
  111. data/docs/Puppeteer/WaitTask.html +0 -637
  112. data/docs/Puppeteer/WaitTask/TerminatedError.html +0 -124
  113. data/docs/Puppeteer/WaitTask/TimeoutError.html +0 -206
  114. data/docs/Puppeteer/WebSocket.html +0 -673
  115. data/docs/Puppeteer/WebSocket/DriverImpl.html +0 -412
  116. data/docs/Puppeteer/WebSocketTransport.html +0 -600
  117. data/docs/Puppeteer/WebSocktTransportError.html +0 -124
  118. data/docs/_index.html +0 -823
  119. data/docs/class_list.html +0 -51
  120. data/docs/css/common.css +0 -1
  121. data/docs/css/full_list.css +0 -58
  122. data/docs/css/style.css +0 -496
  123. data/docs/file.README.html +0 -123
  124. data/docs/file_list.html +0 -56
  125. data/docs/frames.html +0 -17
  126. data/docs/index.html +0 -123
  127. data/docs/js/app.js +0 -314
  128. data/docs/js/full_list.js +0 -216
  129. data/docs/js/jquery.js +0 -4
  130. data/docs/method_list.html +0 -4075
  131. data/docs/top-level-namespace.html +0 -126
  132. data/lib/puppeteer/async_await_behavior.rb +0 -38
@@ -1,960 +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#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</pre>
458
- </td>
459
- <td>
460
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 39</span>
461
-
462
- <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>
463
- <span class='ivar'>@url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span>
464
- <span class='ivar'>@last_id</span> <span class='op'>=</span> <span class='int'>0</span>
465
- <span class='ivar'>@callbacks</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
466
- <span class='ivar'>@delay</span> <span class='op'>=</span> <span class='id identifier rubyid_delay'>delay</span>
467
-
468
- <span class='ivar'>@transport</span> <span class='op'>=</span> <span class='id identifier rubyid_transport'>transport</span>
469
- <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_on_message'>on_message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
470
- <span class='id identifier rubyid_async_handle_message'>async_handle_message</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='rparen'>)</span>
471
- <span class='kw'>end</span>
472
- <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_on_close'>on_close</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_reason'>reason</span><span class='comma'>,</span> <span class='id identifier rubyid_code'>code</span><span class='op'>|</span>
473
- <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>
474
- <span class='kw'>end</span>
475
-
476
- <span class='ivar'>@sessions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
477
- <span class='ivar'>@closed</span> <span class='op'>=</span> <span class='kw'>false</span>
478
- <span class='kw'>end</span></pre>
479
- </td>
480
- </tr>
481
- </table>
482
- </div>
483
-
484
- </div>
485
-
486
-
487
- <div id="class_method_details" class="method_details_list">
488
- <h2>Class Method Details</h2>
489
-
490
-
491
- <div class="method_details first">
492
- <h3 class="signature first" id="from_session-class_method">
493
-
494
- .<strong>from_session</strong>(session) &#x21d2; <tt>Object</tt>
495
-
496
-
497
-
498
-
499
-
500
- </h3><table class="source_code">
501
- <tr>
502
- <td>
503
- <pre class="lines">
504
-
505
-
506
- 57
507
- 58
508
- 59</pre>
509
- </td>
510
- <td>
511
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 57</span>
512
-
513
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_session'>from_session</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='rparen'>)</span>
514
- <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span>
515
- <span class='kw'>end</span></pre>
516
- </td>
517
- </tr>
518
- </table>
519
- </div>
520
-
521
- </div>
522
-
523
- <div id="instance_method_details" class="method_details_list">
524
- <h2>Instance Method Details</h2>
525
-
526
-
527
- <div class="method_details first">
528
- <h3 class="signature first" id="async_send_message-instance_method">
529
-
530
- #<strong>async_send_message</strong>(method, params = {}) &#x21d2; <tt>Object</tt>
531
-
532
-
533
-
534
-
535
-
536
- </h3><table class="source_code">
537
- <tr>
538
- <td>
539
- <pre class="lines">
540
-
541
-
542
- 77
543
- 78
544
- 79
545
- 80
546
- 81
547
- 82</pre>
548
- </td>
549
- <td>
550
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 77</span>
551
-
552
- <span class='kw'>def</span> <span class='id identifier rubyid_async_send_message'>async_send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
553
- <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>
554
- <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>
555
- <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>
556
- <span class='id identifier rubyid_promise'>promise</span>
557
- <span class='kw'>end</span></pre>
558
- </td>
559
- </tr>
560
- </table>
561
- </div>
562
-
563
- <div class="method_details ">
564
- <h3 class="signature " id="create_session-instance_method">
565
-
566
- #<strong>create_session</strong>(target_info) &#x21d2; <tt><span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>
567
-
568
-
569
-
570
-
571
-
572
- </h3><div class="docstring">
573
- <div class="discussion">
574
-
575
-
576
- </div>
577
- </div>
578
- <div class="tags">
579
- <p class="tag_title">Parameters:</p>
580
- <ul class="param">
581
-
582
- <li>
583
-
584
- <span class='name'>targetInfo</span>
585
-
586
-
587
- <span class='type'>(<tt>Protocol.<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>.TargetInfo</tt>)</span>
588
-
589
-
590
-
591
- </li>
592
-
593
- </ul>
594
-
595
- <p class="tag_title">Returns:</p>
596
- <ul class="return">
597
-
598
- <li>
599
-
600
-
601
- <span class='type'>(<tt><span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>)</span>
602
-
603
-
604
-
605
- </li>
606
-
607
- </ul>
608
-
609
- </div><table class="source_code">
610
- <tr>
611
- <td>
612
- <pre class="lines">
613
-
614
-
615
- 239
616
- 240
617
- 241
618
- 242
619
- 243
620
- 244
621
- 245
622
- 246
623
- 247
624
- 248
625
- 249
626
- 250
627
- 251
628
- 252
629
- 253</pre>
630
- </td>
631
- <td>
632
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 239</span>
633
-
634
- <span class='kw'>def</span> <span class='id identifier rubyid_create_session'>create_session</span><span class='lparen'>(</span><span class='id identifier rubyid_target_info'>target_info</span><span class='rparen'>)</span>
635
- <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>
636
- <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>
637
-
638
- <span class='comment'># Target.attachedToTarget is often notified after the result of Target.attachToTarget.
639
- </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;}}
640
- </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}}
641
- </span> <span class='comment'># So we have to wait for &quot;Target.attachedToTarget&quot; a bit.
642
- </span> <span class='int'>20</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span>
643
- <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>
644
- <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>
645
- <span class='kw'>end</span>
646
- <span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.1</span>
647
- <span class='kw'>end</span>
648
- <span class='kw'>end</span></pre>
649
- </td>
650
- </tr>
651
- </table>
652
- </div>
653
-
654
- <div class="method_details ">
655
- <h3 class="signature " id="dispose-instance_method">
656
-
657
- #<strong>dispose</strong> &#x21d2; <tt>Object</tt>
658
-
659
-
660
-
661
-
662
-
663
- </h3><table class="source_code">
664
- <tr>
665
- <td>
666
- <pre class="lines">
667
-
668
-
669
- 232
670
- 233
671
- 234
672
- 235</pre>
673
- </td>
674
- <td>
675
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 232</span>
676
-
677
- <span class='kw'>def</span> <span class='id identifier rubyid_dispose'>dispose</span>
678
- <span class='id identifier rubyid_handle_close'>handle_close</span>
679
- <span class='ivar'>@transport</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
680
- <span class='kw'>end</span></pre>
681
- </td>
682
- </tr>
683
- </table>
684
- </div>
685
-
686
- <div class="method_details ">
687
- <h3 class="signature " id="on_close-instance_method">
688
-
689
- #<strong>on_close</strong>(&amp;block) &#x21d2; <tt>Object</tt>
690
-
691
-
692
-
693
-
694
-
695
- </h3><table class="source_code">
696
- <tr>
697
- <td>
698
- <pre class="lines">
699
-
700
-
701
- 224
702
- 225
703
- 226</pre>
704
- </td>
705
- <td>
706
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 224</span>
707
-
708
- <span class='kw'>def</span> <span class='id identifier rubyid_on_close'>on_close</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
709
- <span class='ivar'>@on_close</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
710
- <span class='kw'>end</span></pre>
711
- </td>
712
- </tr>
713
- </table>
714
- </div>
715
-
716
- <div class="method_details ">
717
- <h3 class="signature " id="on_message-instance_method">
718
-
719
- #<strong>on_message</strong>(&amp;block) &#x21d2; <tt>Object</tt>
720
-
721
-
722
-
723
-
724
-
725
- </h3><table class="source_code">
726
- <tr>
727
- <td>
728
- <pre class="lines">
729
-
730
-
731
- 228
732
- 229
733
- 230</pre>
734
- </td>
735
- <td>
736
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 228</span>
737
-
738
- <span class='kw'>def</span> <span class='id identifier rubyid_on_message'>on_message</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
739
- <span class='ivar'>@on_message</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
740
- <span class='kw'>end</span></pre>
741
- </td>
742
- </tr>
743
- </table>
744
- </div>
745
-
746
- <div class="method_details ">
747
- <h3 class="signature " id="raw_send-instance_method">
748
-
749
- #<strong>raw_send</strong>(message:) &#x21d2; <tt>Object</tt>
750
-
751
-
752
-
753
-
754
-
755
- </h3><table class="source_code">
756
- <tr>
757
- <td>
758
- <pre class="lines">
759
-
760
-
761
- 88
762
- 89
763
- 90
764
- 91
765
- 92
766
- 93
767
- 94</pre>
768
- </td>
769
- <td>
770
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 88</span>
771
-
772
- <span class='kw'>def</span> <span class='id identifier rubyid_raw_send'>raw_send</span><span class='lparen'>(</span><span class='label'>message:</span><span class='rparen'>)</span>
773
- <span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_id'>generate_id</span>
774
- <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>
775
- <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>
776
- <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>
777
- <span class='id identifier rubyid_id'>id</span>
778
- <span class='kw'>end</span></pre>
779
- </td>
780
- </tr>
781
- </table>
782
- </div>
783
-
784
- <div class="method_details ">
785
- <h3 class="signature " id="send_message-instance_method">
786
-
787
- #<strong>send_message</strong>(method, params = {}) &#x21d2; <tt>Object</tt>
788
-
789
-
790
-
791
-
792
-
793
- </h3><div class="docstring">
794
- <div class="discussion">
795
-
796
-
797
- </div>
798
- </div>
799
- <div class="tags">
800
- <p class="tag_title">Parameters:</p>
801
- <ul class="param">
802
-
803
- <li>
804
-
805
- <span class='name'>method</span>
806
-
807
-
808
- <span class='type'>(<tt>string</tt>)</span>
809
-
810
-
811
-
812
- </li>
813
-
814
- <li>
815
-
816
- <span class='name'>params</span>
817
-
818
-
819
- <span class='type'>(<tt>!Object=</tt>)</span>
820
-
821
-
822
- <em class="default">(defaults to: <tt>{}</tt>)</em>
823
-
824
-
825
- </li>
826
-
827
- </ul>
828
-
829
-
830
- </div><table class="source_code">
831
- <tr>
832
- <td>
833
- <pre class="lines">
834
-
835
-
836
- 73
837
- 74
838
- 75</pre>
839
- </td>
840
- <td>
841
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 73</span>
842
-
843
- <span class='kw'>def</span> <span class='id identifier rubyid_send_message'>send_message</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
844
- <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>
845
- <span class='kw'>end</span></pre>
846
- </td>
847
- </tr>
848
- </table>
849
- </div>
850
-
851
- <div class="method_details ">
852
- <h3 class="signature " id="session-instance_method">
853
-
854
- #<strong>session</strong>(session_id) &#x21d2; <tt>?<span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>
855
-
856
-
857
-
858
-
859
-
860
- </h3><div class="docstring">
861
- <div class="discussion">
862
-
863
-
864
- </div>
865
- </div>
866
- <div class="tags">
867
- <p class="tag_title">Parameters:</p>
868
- <ul class="param">
869
-
870
- <li>
871
-
872
- <span class='name'>sessionId</span>
873
-
874
-
875
- <span class='type'>(<tt>string</tt>)</span>
876
-
877
-
878
-
879
- </li>
880
-
881
- </ul>
882
-
883
- <p class="tag_title">Returns:</p>
884
- <ul class="return">
885
-
886
- <li>
887
-
888
-
889
- <span class='type'>(<tt>?<span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span></tt>)</span>
890
-
891
-
892
-
893
- </li>
894
-
895
- </ul>
896
-
897
- </div><table class="source_code">
898
- <tr>
899
- <td>
900
- <pre class="lines">
901
-
902
-
903
- 63
904
- 64
905
- 65</pre>
906
- </td>
907
- <td>
908
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 63</span>
909
-
910
- <span class='kw'>def</span> <span class='id identifier rubyid_session'>session</span><span class='lparen'>(</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rparen'>)</span>
911
- <span class='ivar'>@sessions</span><span class='lbracket'>[</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rbracket'>]</span>
912
- <span class='kw'>end</span></pre>
913
- </td>
914
- </tr>
915
- </table>
916
- </div>
917
-
918
- <div class="method_details ">
919
- <h3 class="signature " id="url-instance_method">
920
-
921
- #<strong>url</strong> &#x21d2; <tt>Object</tt>
922
-
923
-
924
-
925
-
926
-
927
- </h3><table class="source_code">
928
- <tr>
929
- <td>
930
- <pre class="lines">
931
-
932
-
933
- 67
934
- 68
935
- 69</pre>
936
- </td>
937
- <td>
938
- <pre class="code"><span class="info file"># File 'lib/puppeteer/connection.rb', line 67</span>
939
-
940
- <span class='kw'>def</span> <span class='id identifier rubyid_url'>url</span>
941
- <span class='ivar'>@url</span>
942
- <span class='kw'>end</span></pre>
943
- </td>
944
- </tr>
945
- </table>
946
- </div>
947
-
948
- </div>
949
-
950
- </div>
951
-
952
- <div id="footer">
953
- Generated on Fri Jun 12 12:38:34 2020 by
954
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
955
- 0.9.24 (ruby-2.6.3).
956
- </div>
957
-
958
- </div>
959
- </body>
960
- </html>