puppeteer-ruby 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.circleci/config.yml +71 -0
- data/.github/stale.yml +16 -0
- data/.gitignore +19 -0
- data/.rspec +3 -0
- data/.rubocop.yml +302 -0
- data/.travis.yml +7 -0
- data/Dockerfile +6 -0
- data/Gemfile +6 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +15 -0
- data/docs/Puppeteer.html +2020 -0
- data/docs/Puppeteer/AsyncAwaitBehavior.html +105 -0
- data/docs/Puppeteer/Browser.html +2148 -0
- data/docs/Puppeteer/BrowserContext.html +809 -0
- data/docs/Puppeteer/BrowserFetcher.html +214 -0
- data/docs/Puppeteer/BrowserRunner.html +914 -0
- data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +477 -0
- data/docs/Puppeteer/CDPSession.html +813 -0
- data/docs/Puppeteer/CDPSession/Error.html +124 -0
- data/docs/Puppeteer/ConcurrentRubyUtils.html +430 -0
- data/docs/Puppeteer/Connection.html +960 -0
- data/docs/Puppeteer/Connection/MessageCallback.html +434 -0
- data/docs/Puppeteer/Connection/ProtocolError.html +216 -0
- data/docs/Puppeteer/Connection/RequestDebugPrinter.html +217 -0
- data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +244 -0
- data/docs/Puppeteer/ConsoleMessage.html +565 -0
- data/docs/Puppeteer/ConsoleMessage/Location.html +433 -0
- data/docs/Puppeteer/DOMWorld.html +2219 -0
- data/docs/Puppeteer/DOMWorld/DetachedError.html +124 -0
- data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +124 -0
- data/docs/Puppeteer/DebugPrint.html +233 -0
- data/docs/Puppeteer/Device.html +470 -0
- data/docs/Puppeteer/Devices.html +139 -0
- data/docs/Puppeteer/ElementHandle.html +2542 -0
- data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +206 -0
- data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +206 -0
- data/docs/Puppeteer/ElementHandle/Point.html +492 -0
- data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +124 -0
- data/docs/Puppeteer/EmulationManager.html +454 -0
- data/docs/Puppeteer/EventCallbackable.html +433 -0
- data/docs/Puppeteer/EventCallbackable/EventListeners.html +435 -0
- data/docs/Puppeteer/ExecutionContext.html +998 -0
- data/docs/Puppeteer/ExecutionContext/EvaluationError.html +124 -0
- data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +357 -0
- data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +389 -0
- data/docs/Puppeteer/FileChooser.html +455 -0
- data/docs/Puppeteer/Frame.html +3677 -0
- data/docs/Puppeteer/FrameManager.html +2410 -0
- data/docs/Puppeteer/FrameManager/NavigationError.html +124 -0
- data/docs/Puppeteer/IfPresent.html +222 -0
- data/docs/Puppeteer/JSHandle.html +1352 -0
- data/docs/Puppeteer/Keyboard.html +1557 -0
- data/docs/Puppeteer/Keyboard/KeyDefinition.html +831 -0
- data/docs/Puppeteer/Keyboard/KeyDescription.html +603 -0
- data/docs/Puppeteer/Launcher.html +237 -0
- data/docs/Puppeteer/Launcher/Base.html +385 -0
- data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +124 -0
- data/docs/Puppeteer/Launcher/BrowserOptions.html +441 -0
- data/docs/Puppeteer/Launcher/Chrome.html +669 -0
- data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +382 -0
- data/docs/Puppeteer/Launcher/ChromeArgOptions.html +531 -0
- data/docs/Puppeteer/Launcher/LaunchOptions.html +893 -0
- data/docs/Puppeteer/LifecycleWatcher.html +834 -0
- data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +363 -0
- data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +206 -0
- data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +124 -0
- data/docs/Puppeteer/Mouse.html +1105 -0
- data/docs/Puppeteer/Mouse/Button.html +136 -0
- data/docs/Puppeteer/NetworkManager.html +901 -0
- data/docs/Puppeteer/NetworkManager/Credentials.html +385 -0
- data/docs/Puppeteer/Page.html +5970 -0
- data/docs/Puppeteer/Page/FileChooserTimeoutError.html +206 -0
- data/docs/Puppeteer/Page/ScreenshotOptions.html +845 -0
- data/docs/Puppeteer/Page/ScriptTag.html +555 -0
- data/docs/Puppeteer/Page/StyleTag.html +448 -0
- data/docs/Puppeteer/Page/TargetCrashedError.html +124 -0
- data/docs/Puppeteer/RemoteObject.html +1087 -0
- data/docs/Puppeteer/Target.html +1336 -0
- data/docs/Puppeteer/Target/InitializeFailure.html +124 -0
- data/docs/Puppeteer/Target/TargetInfo.html +729 -0
- data/docs/Puppeteer/TimeoutError.html +135 -0
- data/docs/Puppeteer/TimeoutSettings.html +496 -0
- data/docs/Puppeteer/TouchScreen.html +464 -0
- data/docs/Puppeteer/Viewport.html +837 -0
- data/docs/Puppeteer/WaitTask.html +637 -0
- data/docs/Puppeteer/WaitTask/TerminatedError.html +124 -0
- data/docs/Puppeteer/WaitTask/TimeoutError.html +206 -0
- data/docs/Puppeteer/WebSocket.html +673 -0
- data/docs/Puppeteer/WebSocket/DriverImpl.html +412 -0
- data/docs/Puppeteer/WebSocketTransport.html +600 -0
- data/docs/Puppeteer/WebSocktTransportError.html +124 -0
- data/docs/_index.html +823 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +123 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +123 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +4075 -0
- data/docs/top-level-namespace.html +126 -0
- data/lib/puppeteer.rb +200 -0
- data/lib/puppeteer/async_await_behavior.rb +38 -0
- data/lib/puppeteer/browser.rb +259 -0
- data/lib/puppeteer/browser_context.rb +90 -0
- data/lib/puppeteer/browser_fetcher.rb +6 -0
- data/lib/puppeteer/browser_runner.rb +161 -0
- data/lib/puppeteer/cdp_session.rb +100 -0
- data/lib/puppeteer/concurrent_ruby_utils.rb +37 -0
- data/lib/puppeteer/connection.rb +254 -0
- data/lib/puppeteer/console_message.rb +24 -0
- data/lib/puppeteer/debug_print.rb +20 -0
- data/lib/puppeteer/device.rb +12 -0
- data/lib/puppeteer/devices.rb +885 -0
- data/lib/puppeteer/dom_world.rb +484 -0
- data/lib/puppeteer/element_handle.rb +433 -0
- data/lib/puppeteer/element_handle/bounding_box.rb +12 -0
- data/lib/puppeteer/element_handle/box_model.rb +19 -0
- data/lib/puppeteer/element_handle/point.rb +26 -0
- data/lib/puppeteer/emulation_manager.rb +46 -0
- data/lib/puppeteer/errors.rb +2 -0
- data/lib/puppeteer/event_callbackable.rb +88 -0
- data/lib/puppeteer/execution_context.rb +254 -0
- data/lib/puppeteer/file_chooser.rb +29 -0
- data/lib/puppeteer/frame.rb +286 -0
- data/lib/puppeteer/frame_manager.rb +378 -0
- data/lib/puppeteer/if_present.rb +18 -0
- data/lib/puppeteer/js_handle.rb +142 -0
- data/lib/puppeteer/keyboard.rb +183 -0
- data/lib/puppeteer/keyboard/key_description.rb +19 -0
- data/lib/puppeteer/keyboard/us_keyboard_layout.rb +283 -0
- data/lib/puppeteer/launcher.rb +25 -0
- data/lib/puppeteer/launcher/base.rb +48 -0
- data/lib/puppeteer/launcher/browser_options.rb +41 -0
- data/lib/puppeteer/launcher/chrome.rb +211 -0
- data/lib/puppeteer/launcher/chrome_arg_options.rb +49 -0
- data/lib/puppeteer/launcher/launch_options.rb +68 -0
- data/lib/puppeteer/lifecycle_watcher.rb +171 -0
- data/lib/puppeteer/mouse.rb +123 -0
- data/lib/puppeteer/network_manager.rb +122 -0
- data/lib/puppeteer/page.rb +1065 -0
- data/lib/puppeteer/page/screenshot_options.rb +78 -0
- data/lib/puppeteer/remote_object.rb +143 -0
- data/lib/puppeteer/target.rb +150 -0
- data/lib/puppeteer/timeout_settings.rb +15 -0
- data/lib/puppeteer/touch_screen.rb +43 -0
- data/lib/puppeteer/version.rb +3 -0
- data/lib/puppeteer/viewport.rb +54 -0
- data/lib/puppeteer/wait_task.rb +188 -0
- data/lib/puppeteer/web_socket.rb +122 -0
- data/lib/puppeteer/web_socket_transport.rb +49 -0
- data/puppeteer-ruby.gemspec +32 -0
- metadata +355 -0
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
Module: Puppeteer::AsyncAwaitBehavior
|
|
8
|
+
|
|
9
|
+
— 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::AsyncAwaitBehavior";
|
|
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 (A)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">AsyncAwaitBehavior</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>Module: Puppeteer::AsyncAwaitBehavior
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<dl>
|
|
80
|
+
<dt>Defined in:</dt>
|
|
81
|
+
<dd>lib/puppeteer/async_await_behavior.rb</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div id="footer">
|
|
98
|
+
Generated on Fri Jun 12 12:38:32 2020 by
|
|
99
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
100
|
+
0.9.24 (ruby-2.6.3).
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
</div>
|
|
104
|
+
</body>
|
|
105
|
+
</html>
|
|
@@ -0,0 +1,2148 @@
|
|
|
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::Browser
|
|
8
|
+
|
|
9
|
+
— 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::Browser";
|
|
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 (B)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">Browser</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::Browser
|
|
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::Browser</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>, <span class='object_link'><a href="IfPresent.html" title="Puppeteer::IfPresent (module)">IfPresent</a></span></dd>
|
|
93
|
+
</dl>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<dl>
|
|
101
|
+
<dt>Defined in:</dt>
|
|
102
|
+
<dd>lib/puppeteer/browser.rb</dd>
|
|
103
|
+
</dl>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
<h2>
|
|
116
|
+
Class Method Summary
|
|
117
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
118
|
+
</h2>
|
|
119
|
+
|
|
120
|
+
<ul class="summary">
|
|
121
|
+
|
|
122
|
+
<li class="public ">
|
|
123
|
+
<span class="summary_signature">
|
|
124
|
+
|
|
125
|
+
<a href="#create-class_method" title="create (class method)">.<strong>create</strong>(connection:, context_ids:, ignore_https_errors:, default_viewport:, process:, close_callback:) ⇒ Object </a>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</span>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
140
|
+
|
|
141
|
+
</li>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
</ul>
|
|
145
|
+
|
|
146
|
+
<h2>
|
|
147
|
+
Instance Method Summary
|
|
148
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
149
|
+
</h2>
|
|
150
|
+
|
|
151
|
+
<ul class="summary">
|
|
152
|
+
|
|
153
|
+
<li class="public ">
|
|
154
|
+
<span class="summary_signature">
|
|
155
|
+
|
|
156
|
+
<a href="#browser_contexts-instance_method" title="#browser_contexts (instance method)">#<strong>browser_contexts</strong> ⇒ Object </a>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
</span>
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
171
|
+
|
|
172
|
+
</li>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<li class="public ">
|
|
176
|
+
<span class="summary_signature">
|
|
177
|
+
|
|
178
|
+
<a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> ⇒ Object </a>
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
</span>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
193
|
+
|
|
194
|
+
</li>
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<li class="public ">
|
|
198
|
+
<span class="summary_signature">
|
|
199
|
+
|
|
200
|
+
<a href="#connected%3F-instance_method" title="#connected? (instance method)">#<strong>connected?</strong> ⇒ Boolean </a>
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
</span>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
215
|
+
|
|
216
|
+
</li>
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
<li class="public ">
|
|
220
|
+
<span class="summary_signature">
|
|
221
|
+
|
|
222
|
+
<a href="#create_incognito_browser_context-instance_method" title="#create_incognito_browser_context (instance method)">#<strong>create_incognito_browser_context</strong> ⇒ Puppeteer::BrowserContext </a>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
</span>
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
237
|
+
|
|
238
|
+
</li>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
<li class="public ">
|
|
242
|
+
<span class="summary_signature">
|
|
243
|
+
|
|
244
|
+
<a href="#create_page_in_context-instance_method" title="#create_page_in_context (instance method)">#<strong>create_page_in_context</strong>(context_id) ⇒ !Promise<!Puppeteer.Page> </a>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
</span>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
259
|
+
|
|
260
|
+
</li>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<li class="public ">
|
|
264
|
+
<span class="summary_signature">
|
|
265
|
+
|
|
266
|
+
<a href="#default_browser_context-instance_method" title="#default_browser_context (instance method)">#<strong>default_browser_context</strong> ⇒ Puppeteer::BrowserContext </a>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
</span>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
281
|
+
|
|
282
|
+
</li>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<li class="public ">
|
|
286
|
+
<span class="summary_signature">
|
|
287
|
+
|
|
288
|
+
<a href="#disconnect-instance_method" title="#disconnect (instance method)">#<strong>disconnect</strong> ⇒ Object </a>
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
</span>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
303
|
+
|
|
304
|
+
</li>
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
<li class="public ">
|
|
308
|
+
<span class="summary_signature">
|
|
309
|
+
|
|
310
|
+
<a href="#dispose_context-instance_method" title="#dispose_context (instance method)">#<strong>dispose_context</strong>(context_id) ⇒ Object </a>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
</span>
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
325
|
+
|
|
326
|
+
</li>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<li class="public ">
|
|
330
|
+
<span class="summary_signature">
|
|
331
|
+
|
|
332
|
+
<a href="#handle_target_created-instance_method" title="#handle_target_created (instance method)">#<strong>handle_target_created</strong>(event) ⇒ Object </a>
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
</span>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
347
|
+
|
|
348
|
+
</li>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
<li class="public ">
|
|
352
|
+
<span class="summary_signature">
|
|
353
|
+
|
|
354
|
+
<a href="#handle_target_destroyed-instance_method" title="#handle_target_destroyed (instance method)">#<strong>handle_target_destroyed</strong>(event) ⇒ Object </a>
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
</span>
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
369
|
+
|
|
370
|
+
</li>
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
<li class="public ">
|
|
374
|
+
<span class="summary_signature">
|
|
375
|
+
|
|
376
|
+
<a href="#handle_target_info_changed-instance_method" title="#handle_target_info_changed (instance method)">#<strong>handle_target_info_changed</strong>(event) ⇒ Object </a>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
</span>
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
391
|
+
|
|
392
|
+
</li>
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
<li class="public ">
|
|
396
|
+
<span class="summary_signature">
|
|
397
|
+
|
|
398
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(connection:, context_ids:, ignore_https_errors:, default_viewport:, process:, close_callback:) ⇒ Browser </a>
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
</span>
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
<span class="note title constructor">constructor</span>
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
<span class="summary_desc"><div class='inline'>
|
|
415
|
+
<p>A new instance of Browser.</p>
|
|
416
|
+
</div></span>
|
|
417
|
+
|
|
418
|
+
</li>
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
<li class="public ">
|
|
422
|
+
<span class="summary_signature">
|
|
423
|
+
|
|
424
|
+
<a href="#new_page-instance_method" title="#new_page (instance method)">#<strong>new_page</strong> ⇒ Object </a>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
</span>
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
439
|
+
|
|
440
|
+
</li>
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
<li class="public ">
|
|
444
|
+
<span class="summary_signature">
|
|
445
|
+
|
|
446
|
+
<a href="#pages-instance_method" title="#pages (instance method)">#<strong>pages</strong> ⇒ !Promise<!Array<!Puppeteer.Page>> </a>
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
</span>
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
461
|
+
|
|
462
|
+
</li>
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
<li class="public ">
|
|
466
|
+
<span class="summary_signature">
|
|
467
|
+
|
|
468
|
+
<a href="#process-instance_method" title="#process (instance method)">#<strong>process</strong> ⇒ Puppeteer::BrowserRunner::BrowserProcess </a>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
</span>
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
483
|
+
|
|
484
|
+
</li>
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
<li class="public ">
|
|
488
|
+
<span class="summary_signature">
|
|
489
|
+
|
|
490
|
+
<a href="#target-instance_method" title="#target (instance method)">#<strong>target</strong> ⇒ !Target </a>
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
</span>
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
505
|
+
|
|
506
|
+
</li>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
<li class="public ">
|
|
510
|
+
<span class="summary_signature">
|
|
511
|
+
|
|
512
|
+
<a href="#targets-instance_method" title="#targets (instance method)">#<strong>targets</strong> ⇒ !Array<!Target> </a>
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
</span>
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
527
|
+
|
|
528
|
+
</li>
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
<li class="public ">
|
|
532
|
+
<span class="summary_signature">
|
|
533
|
+
|
|
534
|
+
<a href="#user_agent-instance_method" title="#user_agent (instance method)">#<strong>user_agent</strong> ⇒ String </a>
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
</span>
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
549
|
+
|
|
550
|
+
</li>
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
<li class="public ">
|
|
554
|
+
<span class="summary_signature">
|
|
555
|
+
|
|
556
|
+
<a href="#version-instance_method" title="#version (instance method)">#<strong>version</strong> ⇒ String </a>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
</span>
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
571
|
+
|
|
572
|
+
</li>
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
<li class="public ">
|
|
576
|
+
<span class="summary_signature">
|
|
577
|
+
|
|
578
|
+
<a href="#wait_for_target-instance_method" title="#wait_for_target (instance method)">#<strong>wait_for_target</strong>(predicate:, timeout: nil) ⇒ !Promise<!Target> </a>
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
</span>
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
593
|
+
|
|
594
|
+
</li>
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
<li class="public ">
|
|
598
|
+
<span class="summary_signature">
|
|
599
|
+
|
|
600
|
+
<a href="#websocket_endpoint-instance_method" title="#websocket_endpoint (instance method)">#<strong>websocket_endpoint</strong> ⇒ String </a>
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
</span>
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
615
|
+
|
|
616
|
+
</li>
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
</ul>
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="IfPresent.html" title="Puppeteer::IfPresent (module)">IfPresent</a></span></h3>
|
|
632
|
+
<p class="inherited"><span class='object_link'><a href="IfPresent.html#if_present-instance_method" title="Puppeteer::IfPresent#if_present (method)">#if_present</a></span></p>
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="EventCallbackable.html" title="Puppeteer::EventCallbackable (module)">EventCallbackable</a></span></h3>
|
|
643
|
+
<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>
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="DebugPrint.html" title="Puppeteer::DebugPrint (module)">DebugPrint</a></span></h3>
|
|
654
|
+
<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>
|
|
655
|
+
<div id="constructor_details" class="method_details_list">
|
|
656
|
+
<h2>Constructor Details</h2>
|
|
657
|
+
|
|
658
|
+
<div class="method_details first">
|
|
659
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
660
|
+
|
|
661
|
+
#<strong>initialize</strong>(connection:, context_ids:, ignore_https_errors:, default_viewport:, process:, close_callback:) ⇒ <tt><span class='object_link'><a href="" title="Puppeteer::Browser (class)">Browser</a></span></tt>
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
</h3><div class="docstring">
|
|
668
|
+
<div class="discussion">
|
|
669
|
+
|
|
670
|
+
<p>Returns a new instance of Browser.</p>
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
</div>
|
|
674
|
+
</div>
|
|
675
|
+
<div class="tags">
|
|
676
|
+
<p class="tag_title">Parameters:</p>
|
|
677
|
+
<ul class="param">
|
|
678
|
+
|
|
679
|
+
<li>
|
|
680
|
+
|
|
681
|
+
<span class='name'>connection</span>
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
<span class='type'>(<tt>!<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span></tt>)</span>
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
</li>
|
|
689
|
+
|
|
690
|
+
<li>
|
|
691
|
+
|
|
692
|
+
<span class='name'>contextIds</span>
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
<span class='type'>(<tt>!Array<string></tt>)</span>
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
</li>
|
|
700
|
+
|
|
701
|
+
<li>
|
|
702
|
+
|
|
703
|
+
<span class='name'>ignoreHTTPSErrors</span>
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
<span class='type'>(<tt>boolean</tt>)</span>
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
</li>
|
|
711
|
+
|
|
712
|
+
<li>
|
|
713
|
+
|
|
714
|
+
<span class='name'>defaultViewport</span>
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
<span class='type'>(<tt>?<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Viewport.html" title="Puppeteer::Viewport (class)">Viewport</a></span></tt>)</span>
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
</li>
|
|
722
|
+
|
|
723
|
+
<li>
|
|
724
|
+
|
|
725
|
+
<span class='name'>process</span>
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
<span class='type'>(<tt>?<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.ChildProcess</tt>)</span>
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
</li>
|
|
733
|
+
|
|
734
|
+
<li>
|
|
735
|
+
|
|
736
|
+
<span class='name'>closeCallback</span>
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
<span class='type'>(<tt>(function():Promise)=</tt>)</span>
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
</li>
|
|
744
|
+
|
|
745
|
+
</ul>
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
</div><table class="source_code">
|
|
749
|
+
<tr>
|
|
750
|
+
<td>
|
|
751
|
+
<pre class="lines">
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
35
|
|
755
|
+
36
|
|
756
|
+
37
|
|
757
|
+
38
|
|
758
|
+
39
|
|
759
|
+
40
|
|
760
|
+
41
|
|
761
|
+
42
|
|
762
|
+
43
|
|
763
|
+
44
|
|
764
|
+
45
|
|
765
|
+
46
|
|
766
|
+
47
|
|
767
|
+
48
|
|
768
|
+
49
|
|
769
|
+
50
|
|
770
|
+
51
|
|
771
|
+
52
|
|
772
|
+
53
|
|
773
|
+
54
|
|
774
|
+
55</pre>
|
|
775
|
+
</td>
|
|
776
|
+
<td>
|
|
777
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 35</span>
|
|
778
|
+
|
|
779
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>connection:</span><span class='comma'>,</span> <span class='label'>context_ids:</span><span class='comma'>,</span> <span class='label'>ignore_https_errors:</span><span class='comma'>,</span> <span class='label'>default_viewport:</span><span class='comma'>,</span> <span class='label'>process:</span><span class='comma'>,</span> <span class='label'>close_callback:</span><span class='rparen'>)</span>
|
|
780
|
+
<span class='ivar'>@ignore_https_errors</span> <span class='op'>=</span> <span class='id identifier rubyid_ignore_https_errors'>ignore_https_errors</span>
|
|
781
|
+
<span class='ivar'>@default_viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_default_viewport'>default_viewport</span>
|
|
782
|
+
<span class='ivar'>@process</span> <span class='op'>=</span> <span class='id identifier rubyid_process'>process</span>
|
|
783
|
+
<span class='comment'># @screenshot_task_queue = TaskQueue.new
|
|
784
|
+
</span> <span class='ivar'>@connection</span> <span class='op'>=</span> <span class='id identifier rubyid_connection'>connection</span>
|
|
785
|
+
<span class='ivar'>@close_callback</span> <span class='op'>=</span> <span class='id identifier rubyid_close_callback'>close_callback</span>
|
|
786
|
+
|
|
787
|
+
<span class='ivar'>@default_context</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="BrowserContext.html" title="Puppeteer::BrowserContext (class)">BrowserContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BrowserContext.html#initialize-instance_method" title="Puppeteer::BrowserContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@connection</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
788
|
+
<span class='ivar'>@contexts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
789
|
+
<span class='id identifier rubyid_context_ids'>context_ids</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_context_id'>context_id</span><span class='op'>|</span>
|
|
790
|
+
<span class='ivar'>@contexts</span><span class='lbracket'>[</span><span class='id identifier rubyid_context_id'>context_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">BrowserContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BrowserContext.html#initialize-instance_method" title="Puppeteer::BrowserContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@connection</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span> <span class='id identifier rubyid_context_id'>context_id</span><span class='rparen'>)</span>
|
|
791
|
+
<span class='kw'>end</span>
|
|
792
|
+
<span class='ivar'>@targets</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
793
|
+
<span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_on_event'>on_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.CDPSession.Disconnected</span><span class='tstring_end'>'</span></span> <span class='kw'>do</span>
|
|
794
|
+
<span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.Browser.Disconnected</span><span class='tstring_end'>'</span></span>
|
|
795
|
+
<span class='kw'>end</span>
|
|
796
|
+
<span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_on_event'>on_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Target.targetCreated</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:handle_target_created</span><span class='rparen'>)</span>
|
|
797
|
+
<span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_on_event'>on_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Target.targetDestroyed</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:handle_target_destroyed</span><span class='rparen'>)</span>
|
|
798
|
+
<span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_on_event'>on_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Target.targetInfoChanged</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:handle_target_info_changed</span><span class='rparen'>)</span>
|
|
799
|
+
<span class='kw'>end</span></pre>
|
|
800
|
+
</td>
|
|
801
|
+
</tr>
|
|
802
|
+
</table>
|
|
803
|
+
</div>
|
|
804
|
+
|
|
805
|
+
</div>
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
<div id="class_method_details" class="method_details_list">
|
|
809
|
+
<h2>Class Method Details</h2>
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
<div class="method_details first">
|
|
813
|
+
<h3 class="signature first" id="create-class_method">
|
|
814
|
+
|
|
815
|
+
.<strong>create</strong>(connection:, context_ids:, ignore_https_errors:, default_viewport:, process:, close_callback:) ⇒ <tt>Object</tt>
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
</h3><div class="docstring">
|
|
822
|
+
<div class="discussion">
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
</div>
|
|
826
|
+
</div>
|
|
827
|
+
<div class="tags">
|
|
828
|
+
<p class="tag_title">Parameters:</p>
|
|
829
|
+
<ul class="param">
|
|
830
|
+
|
|
831
|
+
<li>
|
|
832
|
+
|
|
833
|
+
<span class='name'>connection</span>
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
<span class='type'>(<tt>!<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span></tt>)</span>
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
</li>
|
|
841
|
+
|
|
842
|
+
<li>
|
|
843
|
+
|
|
844
|
+
<span class='name'>contextIds</span>
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
<span class='type'>(<tt>!Array<string></tt>)</span>
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
</li>
|
|
852
|
+
|
|
853
|
+
<li>
|
|
854
|
+
|
|
855
|
+
<span class='name'>ignoreHTTPSErrors</span>
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
<span class='type'>(<tt>boolean</tt>)</span>
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
</li>
|
|
863
|
+
|
|
864
|
+
<li>
|
|
865
|
+
|
|
866
|
+
<span class='name'>defaultViewport</span>
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
<span class='type'>(<tt>?<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Viewport.html" title="Puppeteer::Viewport (class)">Viewport</a></span></tt>)</span>
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
</li>
|
|
874
|
+
|
|
875
|
+
<li>
|
|
876
|
+
|
|
877
|
+
<span class='name'>process</span>
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
<span class='type'>(<tt><span class='object_link'><a href="BrowserRunner/BrowserProcess.html" title="Puppeteer::BrowserRunner::BrowserProcess (class)">Puppeteer::BrowserRunner::BrowserProcess</a></span>|NilClass</tt>)</span>
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
</li>
|
|
885
|
+
|
|
886
|
+
<li>
|
|
887
|
+
|
|
888
|
+
<span class='name'>closeCallback</span>
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
<span class='type'>(<tt>function()=</tt>)</span>
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
</li>
|
|
896
|
+
|
|
897
|
+
</ul>
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
</div><table class="source_code">
|
|
901
|
+
<tr>
|
|
902
|
+
<td>
|
|
903
|
+
<pre class="lines">
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
16
|
|
907
|
+
17
|
|
908
|
+
18
|
|
909
|
+
19
|
|
910
|
+
20
|
|
911
|
+
21
|
|
912
|
+
22
|
|
913
|
+
23
|
|
914
|
+
24
|
|
915
|
+
25
|
|
916
|
+
26
|
|
917
|
+
27</pre>
|
|
918
|
+
</td>
|
|
919
|
+
<td>
|
|
920
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 16</span>
|
|
921
|
+
|
|
922
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>connection:</span><span class='comma'>,</span> <span class='label'>context_ids:</span><span class='comma'>,</span> <span class='label'>ignore_https_errors:</span><span class='comma'>,</span> <span class='label'>default_viewport:</span><span class='comma'>,</span> <span class='label'>process:</span><span class='comma'>,</span> <span class='label'>close_callback:</span><span class='rparen'>)</span>
|
|
923
|
+
<span class='id identifier rubyid_browser'>browser</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="" title="Puppeteer::Browser (class)">Browser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Puppeteer::Browser#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
|
924
|
+
<span class='label'>connection:</span> <span class='id identifier rubyid_connection'>connection</span><span class='comma'>,</span>
|
|
925
|
+
<span class='label'>context_ids:</span> <span class='id identifier rubyid_context_ids'>context_ids</span><span class='comma'>,</span>
|
|
926
|
+
<span class='label'>ignore_https_errors:</span> <span class='id identifier rubyid_ignore_https_errors'>ignore_https_errors</span><span class='comma'>,</span>
|
|
927
|
+
<span class='label'>default_viewport:</span> <span class='id identifier rubyid_default_viewport'>default_viewport</span><span class='comma'>,</span>
|
|
928
|
+
<span class='label'>process:</span> <span class='id identifier rubyid_process'>process</span><span class='comma'>,</span>
|
|
929
|
+
<span class='label'>close_callback:</span> <span class='id identifier rubyid_close_callback'>close_callback</span><span class='comma'>,</span>
|
|
930
|
+
<span class='rparen'>)</span>
|
|
931
|
+
<span class='id identifier rubyid_connection'>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'>'</span><span class='tstring_content'>Target.setDiscoverTargets</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>discover:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
|
932
|
+
<span class='id identifier rubyid_browser'>browser</span>
|
|
933
|
+
<span class='kw'>end</span></pre>
|
|
934
|
+
</td>
|
|
935
|
+
</tr>
|
|
936
|
+
</table>
|
|
937
|
+
</div>
|
|
938
|
+
|
|
939
|
+
</div>
|
|
940
|
+
|
|
941
|
+
<div id="instance_method_details" class="method_details_list">
|
|
942
|
+
<h2>Instance Method Details</h2>
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
<div class="method_details first">
|
|
946
|
+
<h3 class="signature first" id="browser_contexts-instance_method">
|
|
947
|
+
|
|
948
|
+
#<strong>browser_contexts</strong> ⇒ <tt>Object</tt>
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
</h3><table class="source_code">
|
|
955
|
+
<tr>
|
|
956
|
+
<td>
|
|
957
|
+
<pre class="lines">
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
69
|
|
961
|
+
70
|
|
962
|
+
71</pre>
|
|
963
|
+
</td>
|
|
964
|
+
<td>
|
|
965
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 69</span>
|
|
966
|
+
|
|
967
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_browser_contexts'>browser_contexts</span>
|
|
968
|
+
<span class='lbracket'>[</span><span class='ivar'>@default_context</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_concat'>concat</span><span class='lparen'>(</span><span class='ivar'>@contexts</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
|
|
969
|
+
<span class='kw'>end</span></pre>
|
|
970
|
+
</td>
|
|
971
|
+
</tr>
|
|
972
|
+
</table>
|
|
973
|
+
</div>
|
|
974
|
+
|
|
975
|
+
<div class="method_details ">
|
|
976
|
+
<h3 class="signature " id="close-instance_method">
|
|
977
|
+
|
|
978
|
+
#<strong>close</strong> ⇒ <tt>Object</tt>
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
</h3><table class="source_code">
|
|
985
|
+
<tr>
|
|
986
|
+
<td>
|
|
987
|
+
<pre class="lines">
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
243
|
|
991
|
+
244
|
|
992
|
+
245
|
|
993
|
+
246</pre>
|
|
994
|
+
</td>
|
|
995
|
+
<td>
|
|
996
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 243</span>
|
|
997
|
+
|
|
998
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
|
|
999
|
+
<span class='ivar'>@close_callback</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
|
1000
|
+
<span class='id identifier rubyid_disconnect'>disconnect</span>
|
|
1001
|
+
<span class='kw'>end</span></pre>
|
|
1002
|
+
</td>
|
|
1003
|
+
</tr>
|
|
1004
|
+
</table>
|
|
1005
|
+
</div>
|
|
1006
|
+
|
|
1007
|
+
<div class="method_details ">
|
|
1008
|
+
<h3 class="signature " id="connected?-instance_method">
|
|
1009
|
+
|
|
1010
|
+
#<strong>connected?</strong> ⇒ <tt>Boolean</tt>
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
</h3><div class="docstring">
|
|
1017
|
+
<div class="discussion">
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
</div>
|
|
1021
|
+
</div>
|
|
1022
|
+
<div class="tags">
|
|
1023
|
+
|
|
1024
|
+
<p class="tag_title">Returns:</p>
|
|
1025
|
+
<ul class="return">
|
|
1026
|
+
|
|
1027
|
+
<li>
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
</li>
|
|
1035
|
+
|
|
1036
|
+
</ul>
|
|
1037
|
+
|
|
1038
|
+
</div><table class="source_code">
|
|
1039
|
+
<tr>
|
|
1040
|
+
<td>
|
|
1041
|
+
<pre class="lines">
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
252
|
|
1045
|
+
253
|
|
1046
|
+
254</pre>
|
|
1047
|
+
</td>
|
|
1048
|
+
<td>
|
|
1049
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 252</span>
|
|
1050
|
+
|
|
1051
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_connected?'>connected?</span>
|
|
1052
|
+
<span class='op'>!</span><span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
|
|
1053
|
+
<span class='kw'>end</span></pre>
|
|
1054
|
+
</td>
|
|
1055
|
+
</tr>
|
|
1056
|
+
</table>
|
|
1057
|
+
</div>
|
|
1058
|
+
|
|
1059
|
+
<div class="method_details ">
|
|
1060
|
+
<h3 class="signature " id="create_incognito_browser_context-instance_method">
|
|
1061
|
+
|
|
1062
|
+
#<strong>create_incognito_browser_context</strong> ⇒ <tt><span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">Puppeteer::BrowserContext</a></span></tt>
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
</h3><div class="docstring">
|
|
1069
|
+
<div class="discussion">
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
</div>
|
|
1073
|
+
</div>
|
|
1074
|
+
<div class="tags">
|
|
1075
|
+
|
|
1076
|
+
<p class="tag_title">Returns:</p>
|
|
1077
|
+
<ul class="return">
|
|
1078
|
+
|
|
1079
|
+
<li>
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
<span class='type'>(<tt><span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">Puppeteer::BrowserContext</a></span></tt>)</span>
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
</li>
|
|
1087
|
+
|
|
1088
|
+
</ul>
|
|
1089
|
+
|
|
1090
|
+
</div><table class="source_code">
|
|
1091
|
+
<tr>
|
|
1092
|
+
<td>
|
|
1093
|
+
<pre class="lines">
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
63
|
|
1097
|
+
64
|
|
1098
|
+
65
|
|
1099
|
+
66
|
|
1100
|
+
67</pre>
|
|
1101
|
+
</td>
|
|
1102
|
+
<td>
|
|
1103
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 63</span>
|
|
1104
|
+
|
|
1105
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_incognito_browser_context'>create_incognito_browser_context</span>
|
|
1106
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <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'>'</span><span class='tstring_content'>Target.createBrowserContext</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
1107
|
+
<span class='id identifier rubyid_browser_context_id'>browser_context_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'>'</span><span class='tstring_content'>browserContextId</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
|
1108
|
+
<span class='ivar'>@contexts</span><span class='lbracket'>[</span><span class='id identifier rubyid_browser_context_id'>browser_context_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">BrowserContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BrowserContext.html#initialize-instance_method" title="Puppeteer::BrowserContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@connection</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_browser_context_id'>browser_context_id</span><span class='rparen'>)</span>
|
|
1109
|
+
<span class='kw'>end</span></pre>
|
|
1110
|
+
</td>
|
|
1111
|
+
</tr>
|
|
1112
|
+
</table>
|
|
1113
|
+
</div>
|
|
1114
|
+
|
|
1115
|
+
<div class="method_details ">
|
|
1116
|
+
<h3 class="signature " id="create_page_in_context-instance_method">
|
|
1117
|
+
|
|
1118
|
+
#<strong>create_page_in_context</strong>(context_id) ⇒ <tt>!Promise<!<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Page</a></span>></tt>
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
</h3><div class="docstring">
|
|
1125
|
+
<div class="discussion">
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
</div>
|
|
1129
|
+
</div>
|
|
1130
|
+
<div class="tags">
|
|
1131
|
+
<p class="tag_title">Parameters:</p>
|
|
1132
|
+
<ul class="param">
|
|
1133
|
+
|
|
1134
|
+
<li>
|
|
1135
|
+
|
|
1136
|
+
<span class='name'>contextId</span>
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
<span class='type'>(<tt>?string</tt>)</span>
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
</li>
|
|
1144
|
+
|
|
1145
|
+
</ul>
|
|
1146
|
+
|
|
1147
|
+
<p class="tag_title">Returns:</p>
|
|
1148
|
+
<ul class="return">
|
|
1149
|
+
|
|
1150
|
+
<li>
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
<span class='type'>(<tt>!Promise<!<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Page</a></span>></tt>)</span>
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
</li>
|
|
1158
|
+
|
|
1159
|
+
</ul>
|
|
1160
|
+
|
|
1161
|
+
</div><table class="source_code">
|
|
1162
|
+
<tr>
|
|
1163
|
+
<td>
|
|
1164
|
+
<pre class="lines">
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
171
|
|
1168
|
+
172
|
|
1169
|
+
173
|
|
1170
|
+
174
|
|
1171
|
+
175
|
|
1172
|
+
176
|
|
1173
|
+
177
|
|
1174
|
+
178
|
|
1175
|
+
179
|
|
1176
|
+
180
|
|
1177
|
+
181</pre>
|
|
1178
|
+
</td>
|
|
1179
|
+
<td>
|
|
1180
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 171</span>
|
|
1181
|
+
|
|
1182
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_page_in_context'>create_page_in_context</span><span class='lparen'>(</span><span class='id identifier rubyid_context_id'>context_id</span><span class='rparen'>)</span>
|
|
1183
|
+
<span class='id identifier rubyid_create_target_params'>create_target_params</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>url:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>about:blank</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
|
|
1184
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_context_id'>context_id</span>
|
|
1185
|
+
<span class='id identifier rubyid_create_target_params'>create_target_params</span><span class='lbracket'>[</span><span class='symbol'>:browserContextId</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_context_id'>context_id</span>
|
|
1186
|
+
<span class='kw'>end</span>
|
|
1187
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <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'>'</span><span class='tstring_content'>Target.createTarget</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_create_target_params'>create_target_params</span><span class='rparen'>)</span>
|
|
1188
|
+
<span class='id identifier rubyid_target_id'>target_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'>'</span><span class='tstring_content'>targetId</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
|
1189
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='ivar'>@targets</span><span class='lbracket'>[</span><span class='id identifier rubyid_target_id'>target_id</span><span class='rbracket'>]</span>
|
|
1190
|
+
<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_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_initialized_promise'>initialized_promise</span>
|
|
1191
|
+
<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_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_page'>page</span>
|
|
1192
|
+
<span class='kw'>end</span></pre>
|
|
1193
|
+
</td>
|
|
1194
|
+
</tr>
|
|
1195
|
+
</table>
|
|
1196
|
+
</div>
|
|
1197
|
+
|
|
1198
|
+
<div class="method_details ">
|
|
1199
|
+
<h3 class="signature " id="default_browser_context-instance_method">
|
|
1200
|
+
|
|
1201
|
+
#<strong>default_browser_context</strong> ⇒ <tt><span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">Puppeteer::BrowserContext</a></span></tt>
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
</h3><div class="docstring">
|
|
1208
|
+
<div class="discussion">
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
</div>
|
|
1212
|
+
</div>
|
|
1213
|
+
<div class="tags">
|
|
1214
|
+
|
|
1215
|
+
<p class="tag_title">Returns:</p>
|
|
1216
|
+
<ul class="return">
|
|
1217
|
+
|
|
1218
|
+
<li>
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
<span class='type'>(<tt><span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">Puppeteer::BrowserContext</a></span></tt>)</span>
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
</li>
|
|
1226
|
+
|
|
1227
|
+
</ul>
|
|
1228
|
+
|
|
1229
|
+
</div><table class="source_code">
|
|
1230
|
+
<tr>
|
|
1231
|
+
<td>
|
|
1232
|
+
<pre class="lines">
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
74
|
|
1236
|
+
75
|
|
1237
|
+
76</pre>
|
|
1238
|
+
</td>
|
|
1239
|
+
<td>
|
|
1240
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 74</span>
|
|
1241
|
+
|
|
1242
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_default_browser_context'>default_browser_context</span>
|
|
1243
|
+
<span class='ivar'>@default_context</span>
|
|
1244
|
+
<span class='kw'>end</span></pre>
|
|
1245
|
+
</td>
|
|
1246
|
+
</tr>
|
|
1247
|
+
</table>
|
|
1248
|
+
</div>
|
|
1249
|
+
|
|
1250
|
+
<div class="method_details ">
|
|
1251
|
+
<h3 class="signature " id="disconnect-instance_method">
|
|
1252
|
+
|
|
1253
|
+
#<strong>disconnect</strong> ⇒ <tt>Object</tt>
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
</h3><table class="source_code">
|
|
1260
|
+
<tr>
|
|
1261
|
+
<td>
|
|
1262
|
+
<pre class="lines">
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
248
|
|
1266
|
+
249
|
|
1267
|
+
250</pre>
|
|
1268
|
+
</td>
|
|
1269
|
+
<td>
|
|
1270
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 248</span>
|
|
1271
|
+
|
|
1272
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_disconnect'>disconnect</span>
|
|
1273
|
+
<span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
|
1274
|
+
<span class='kw'>end</span></pre>
|
|
1275
|
+
</td>
|
|
1276
|
+
</tr>
|
|
1277
|
+
</table>
|
|
1278
|
+
</div>
|
|
1279
|
+
|
|
1280
|
+
<div class="method_details ">
|
|
1281
|
+
<h3 class="signature " id="dispose_context-instance_method">
|
|
1282
|
+
|
|
1283
|
+
#<strong>dispose_context</strong>(context_id) ⇒ <tt>Object</tt>
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
</h3><div class="docstring">
|
|
1290
|
+
<div class="discussion">
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
</div>
|
|
1294
|
+
</div>
|
|
1295
|
+
<div class="tags">
|
|
1296
|
+
<p class="tag_title">Parameters:</p>
|
|
1297
|
+
<ul class="param">
|
|
1298
|
+
|
|
1299
|
+
<li>
|
|
1300
|
+
|
|
1301
|
+
<span class='name'>context_id</span>
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
</li>
|
|
1309
|
+
|
|
1310
|
+
</ul>
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
</div><table class="source_code">
|
|
1314
|
+
<tr>
|
|
1315
|
+
<td>
|
|
1316
|
+
<pre class="lines">
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
79
|
|
1320
|
+
80
|
|
1321
|
+
81
|
|
1322
|
+
82</pre>
|
|
1323
|
+
</td>
|
|
1324
|
+
<td>
|
|
1325
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 79</span>
|
|
1326
|
+
|
|
1327
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dispose_context'>dispose_context</span><span class='lparen'>(</span><span class='id identifier rubyid_context_id'>context_id</span><span class='rparen'>)</span>
|
|
1328
|
+
<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'>'</span><span class='tstring_content'>Target.disposeBrowserContext</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>browserContextId:</span> <span class='id identifier rubyid_context_id'>context_id</span><span class='rparen'>)</span>
|
|
1329
|
+
<span class='ivar'>@contexts</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='id identifier rubyid_context_id'>context_id</span><span class='rparen'>)</span>
|
|
1330
|
+
<span class='kw'>end</span></pre>
|
|
1331
|
+
</td>
|
|
1332
|
+
</tr>
|
|
1333
|
+
</table>
|
|
1334
|
+
</div>
|
|
1335
|
+
|
|
1336
|
+
<div class="method_details ">
|
|
1337
|
+
<h3 class="signature " id="handle_target_created-instance_method">
|
|
1338
|
+
|
|
1339
|
+
#<strong>handle_target_created</strong>(event) ⇒ <tt>Object</tt>
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
</h3><div class="docstring">
|
|
1346
|
+
<div class="discussion">
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
</div>
|
|
1350
|
+
</div>
|
|
1351
|
+
<div class="tags">
|
|
1352
|
+
<p class="tag_title">Parameters:</p>
|
|
1353
|
+
<ul class="param">
|
|
1354
|
+
|
|
1355
|
+
<li>
|
|
1356
|
+
|
|
1357
|
+
<span class='name'>event</span>
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
<span class='type'>(<tt>!Protocol.<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>.targetCreatedPayload</tt>)</span>
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
</li>
|
|
1365
|
+
|
|
1366
|
+
</ul>
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
</div><table class="source_code">
|
|
1370
|
+
<tr>
|
|
1371
|
+
<td>
|
|
1372
|
+
<pre class="lines">
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
85
|
|
1376
|
+
86
|
|
1377
|
+
87
|
|
1378
|
+
88
|
|
1379
|
+
89
|
|
1380
|
+
90
|
|
1381
|
+
91
|
|
1382
|
+
92
|
|
1383
|
+
93
|
|
1384
|
+
94
|
|
1385
|
+
95
|
|
1386
|
+
96
|
|
1387
|
+
97
|
|
1388
|
+
98
|
|
1389
|
+
99
|
|
1390
|
+
100
|
|
1391
|
+
101
|
|
1392
|
+
102
|
|
1393
|
+
103
|
|
1394
|
+
104
|
|
1395
|
+
105
|
|
1396
|
+
106
|
|
1397
|
+
107
|
|
1398
|
+
108
|
|
1399
|
+
109
|
|
1400
|
+
110
|
|
1401
|
+
111
|
|
1402
|
+
112
|
|
1403
|
+
113</pre>
|
|
1404
|
+
</td>
|
|
1405
|
+
<td>
|
|
1406
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 85</span>
|
|
1407
|
+
|
|
1408
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_handle_target_created'>handle_target_created</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
|
|
1409
|
+
<span class='id identifier rubyid_target_info'>target_info</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="Target.html" title="Puppeteer::Target (class)">Target</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Target/TargetInfo.html" title="Puppeteer::Target::TargetInfo (class)">TargetInfo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Target/TargetInfo.html#initialize-instance_method" title="Puppeteer::Target::TargetInfo#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>targetInfo</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
1410
|
+
<span class='id identifier rubyid_browser_context_id'>browser_context_id</span> <span class='op'>=</span> <span class='id identifier rubyid_target_info'>target_info</span><span class='period'>.</span><span class='id identifier rubyid_browser_context_id'>browser_context_id</span>
|
|
1411
|
+
<span class='id identifier rubyid_context'>context</span> <span class='op'>=</span>
|
|
1412
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_browser_context_id'>browser_context_id</span> <span class='op'>&&</span> <span class='ivar'>@contexts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_browser_context_id'>browser_context_id</span><span class='rparen'>)</span>
|
|
1413
|
+
<span class='ivar'>@contexts</span><span class='lbracket'>[</span><span class='id identifier rubyid_browser_context_id'>browser_context_id</span><span class='rbracket'>]</span>
|
|
1414
|
+
<span class='kw'>else</span>
|
|
1415
|
+
<span class='ivar'>@default_context</span>
|
|
1416
|
+
<span class='kw'>end</span>
|
|
1417
|
+
|
|
1418
|
+
<span class='id identifier rubyid_target'>target</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="Target.html" title="Puppeteer::Target (class)">Target</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Target.html#initialize-instance_method" title="Puppeteer::Target#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
|
1419
|
+
<span class='label'>target_info:</span> <span class='id identifier rubyid_target_info'>target_info</span><span class='comma'>,</span>
|
|
1420
|
+
<span class='label'>browser_context:</span> <span class='id identifier rubyid_context'>context</span><span class='comma'>,</span>
|
|
1421
|
+
<span class='label'>session_factory:</span> <span class='tlambda'>-></span> <span class='tlambeg'>{</span> <span class='ivar'>@connection</span><span class='period'>.</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> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
1422
|
+
<span class='label'>ignore_https_errors:</span> <span class='ivar'>@ignore_https_errors</span><span class='comma'>,</span>
|
|
1423
|
+
<span class='label'>default_viewport:</span> <span class='ivar'>@default_viewport</span><span class='comma'>,</span>
|
|
1424
|
+
<span class='label'>screenshot_task_queue:</span> <span class='ivar'>@screenshot_task_queue</span><span class='comma'>,</span>
|
|
1425
|
+
<span class='rparen'>)</span>
|
|
1426
|
+
<span class='comment'># assert(!this._targets.has(event.targetInfo.targetId), 'Target should not exist before targetCreated');
|
|
1427
|
+
</span> <span class='ivar'>@targets</span><span class='lbracket'>[</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='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span>
|
|
1428
|
+
<span class='kw'>if</span> <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_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_initialized_promise'>initialized_promise</span>
|
|
1429
|
+
<span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.Browser.TargetCreated</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
|
1430
|
+
<span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.BrowserContext.TargetCreated</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
|
1431
|
+
<span class='kw'>end</span>
|
|
1432
|
+
|
|
1433
|
+
<span class='id identifier rubyid_if_present'>if_present</span><span class='lparen'>(</span><span class='id identifier rubyid_pending_target_info_changed_event'>pending_target_info_changed_event</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_pending_event'>pending_event</span><span class='op'>|</span>
|
|
1434
|
+
<span class='id identifier rubyid_handle_target_info_changed'>handle_target_info_changed</span><span class='lparen'>(</span><span class='id identifier rubyid_pending_event'>pending_event</span><span class='rparen'>)</span>
|
|
1435
|
+
<span class='kw'>end</span>
|
|
1436
|
+
<span class='kw'>end</span></pre>
|
|
1437
|
+
</td>
|
|
1438
|
+
</tr>
|
|
1439
|
+
</table>
|
|
1440
|
+
</div>
|
|
1441
|
+
|
|
1442
|
+
<div class="method_details ">
|
|
1443
|
+
<h3 class="signature " id="handle_target_destroyed-instance_method">
|
|
1444
|
+
|
|
1445
|
+
#<strong>handle_target_destroyed</strong>(event) ⇒ <tt>Object</tt>
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
</h3><div class="docstring">
|
|
1452
|
+
<div class="discussion">
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
</div>
|
|
1456
|
+
</div>
|
|
1457
|
+
<div class="tags">
|
|
1458
|
+
<p class="tag_title">Parameters:</p>
|
|
1459
|
+
<ul class="param">
|
|
1460
|
+
|
|
1461
|
+
<li>
|
|
1462
|
+
|
|
1463
|
+
<span class='name'>event</span>
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
<span class='type'>(<tt>{targetId: string}</tt>)</span>
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
</li>
|
|
1471
|
+
|
|
1472
|
+
</ul>
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
</div><table class="source_code">
|
|
1476
|
+
<tr>
|
|
1477
|
+
<td>
|
|
1478
|
+
<pre class="lines">
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
117
|
|
1482
|
+
118
|
|
1483
|
+
119
|
|
1484
|
+
120
|
|
1485
|
+
121
|
|
1486
|
+
122
|
|
1487
|
+
123
|
|
1488
|
+
124
|
|
1489
|
+
125
|
|
1490
|
+
126
|
|
1491
|
+
127</pre>
|
|
1492
|
+
</td>
|
|
1493
|
+
<td>
|
|
1494
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 117</span>
|
|
1495
|
+
|
|
1496
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_handle_target_destroyed'>handle_target_destroyed</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
|
|
1497
|
+
<span class='id identifier rubyid_target_id'>target_id</span> <span class='op'>=</span> <span class='id identifier rubyid_event'>event</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>targetId</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
|
1498
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='ivar'>@targets</span><span class='lbracket'>[</span><span class='id identifier rubyid_target_id'>target_id</span><span class='rbracket'>]</span>
|
|
1499
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_ignore_initialize_callback_promise'>ignore_initialize_callback_promise</span>
|
|
1500
|
+
<span class='ivar'>@targets</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_target_id'>target_id</span><span class='rparen'>)</span>
|
|
1501
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_closed_callback'>closed_callback</span>
|
|
1502
|
+
<span class='kw'>if</span> <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_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_initialized_promise'>initialized_promise</span>
|
|
1503
|
+
<span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.Browser.TargetDestroyed</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
|
1504
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_browser_context'>browser_context</span><span class='period'>.</span><span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.BrowserContext.TargetDestroyed</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
|
1505
|
+
<span class='kw'>end</span>
|
|
1506
|
+
<span class='kw'>end</span></pre>
|
|
1507
|
+
</td>
|
|
1508
|
+
</tr>
|
|
1509
|
+
</table>
|
|
1510
|
+
</div>
|
|
1511
|
+
|
|
1512
|
+
<div class="method_details ">
|
|
1513
|
+
<h3 class="signature " id="handle_target_info_changed-instance_method">
|
|
1514
|
+
|
|
1515
|
+
#<strong>handle_target_info_changed</strong>(event) ⇒ <tt>Object</tt>
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
</h3><div class="docstring">
|
|
1522
|
+
<div class="discussion">
|
|
1523
|
+
|
|
1524
|
+
|
|
1525
|
+
</div>
|
|
1526
|
+
</div>
|
|
1527
|
+
<div class="tags">
|
|
1528
|
+
<p class="tag_title">Parameters:</p>
|
|
1529
|
+
<ul class="param">
|
|
1530
|
+
|
|
1531
|
+
<li>
|
|
1532
|
+
|
|
1533
|
+
<span class='name'>event</span>
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
<span class='type'>(<tt>!Protocol.<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>.targetInfoChangedPayload</tt>)</span>
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
</li>
|
|
1541
|
+
|
|
1542
|
+
</ul>
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
</div><table class="source_code">
|
|
1546
|
+
<tr>
|
|
1547
|
+
<td>
|
|
1548
|
+
<pre class="lines">
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
130
|
|
1552
|
+
131
|
|
1553
|
+
132
|
|
1554
|
+
133
|
|
1555
|
+
134
|
|
1556
|
+
135
|
|
1557
|
+
136
|
|
1558
|
+
137
|
|
1559
|
+
138
|
|
1560
|
+
139
|
|
1561
|
+
140
|
|
1562
|
+
141
|
|
1563
|
+
142
|
|
1564
|
+
143
|
|
1565
|
+
144
|
|
1566
|
+
145
|
|
1567
|
+
146
|
|
1568
|
+
147
|
|
1569
|
+
148
|
|
1570
|
+
149
|
|
1571
|
+
150
|
|
1572
|
+
151
|
|
1573
|
+
152
|
|
1574
|
+
153
|
|
1575
|
+
154</pre>
|
|
1576
|
+
</td>
|
|
1577
|
+
<td>
|
|
1578
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 130</span>
|
|
1579
|
+
|
|
1580
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_handle_target_info_changed'>handle_target_info_changed</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
|
|
1581
|
+
<span class='id identifier rubyid_target_info'>target_info</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="Target.html" title="Puppeteer::Target (class)">Target</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Target/TargetInfo.html" title="Puppeteer::Target::TargetInfo (class)">TargetInfo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Target/TargetInfo.html#initialize-instance_method" title="Puppeteer::Target::TargetInfo#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>targetInfo</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
1582
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='ivar'>@targets</span><span class='lbracket'>[</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='rbracket'>]</span>
|
|
1583
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_target'>target</span>
|
|
1584
|
+
<span class='comment'># targetCreated is sometimes notified after targetInfoChanged.
|
|
1585
|
+
</span> <span class='comment'># We don't raise error. Instead, keep the event as a pending change,
|
|
1586
|
+
</span> <span class='comment'># and handle it on handle_target_created.
|
|
1587
|
+
</span> <span class='comment'>#
|
|
1588
|
+
</span> <span class='comment'># D, [2020-04-22T00:22:26.630328 #79646] DEBUG -- : RECV << {"method"=>"Target.targetInfoChanged", "params"=>{"targetInfo"=>{"targetId"=>"8068CED48357B9557EEC85AA62165A8E", "type"=>"iframe", "title"=>"", "url"=>"", "attached"=>true, "browserContextId"=>"7895BFB24BF22CE40584808713D96E8D"}}}
|
|
1589
|
+
</span> <span class='comment'># E, [2020-04-22T00:22:26.630448 #79646] ERROR -- : target should exist before targetInfoChanged (StandardError)
|
|
1590
|
+
</span> <span class='comment'># D, [2020-04-22T00:22:26.630648 #79646] DEBUG -- : RECV << {"method"=>"Target.targetCreated", "params"=>{"targetInfo"=>{"targetId"=>"8068CED48357B9557EEC85AA62165A8E", "type"=>"iframe", "title"=>"", "url"=>"", "attached"=>false, "browserContextId"=>"7895BFB24BF22CE40584808713D96E8D"}}}
|
|
1591
|
+
</span> <span class='id identifier rubyid_pending_target_info_changed_event'>pending_target_info_changed_event</span><span class='lbracket'>[</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='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_event'>event</span>
|
|
1592
|
+
<span class='kw'>return</span>
|
|
1593
|
+
<span class='comment'># original implementation is:
|
|
1594
|
+
</span> <span class='comment'>#
|
|
1595
|
+
</span> <span class='comment'># raise StandardError.new('target should exist before targetInfoChanged')
|
|
1596
|
+
</span> <span class='kw'>end</span>
|
|
1597
|
+
<span class='id identifier rubyid_previous_url'>previous_url</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span>
|
|
1598
|
+
<span class='id identifier rubyid_was_initialized'>was_initialized</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_initialized?'>initialized?</span>
|
|
1599
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_handle_target_info_changed'>handle_target_info_changed</span><span class='lparen'>(</span><span class='id identifier rubyid_target_info'>target_info</span><span class='rparen'>)</span>
|
|
1600
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_was_initialized'>was_initialized</span> <span class='op'>&&</span> <span class='id identifier rubyid_previous_url'>previous_url</span> <span class='op'>!=</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span>
|
|
1601
|
+
<span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.Browser.TargetChanged</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
|
1602
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_browser_context'>browser_context</span><span class='period'>.</span><span class='id identifier rubyid_emit_event'>emit_event</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.BrowserContext.TargetChanged</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
|
1603
|
+
<span class='kw'>end</span>
|
|
1604
|
+
<span class='kw'>end</span></pre>
|
|
1605
|
+
</td>
|
|
1606
|
+
</tr>
|
|
1607
|
+
</table>
|
|
1608
|
+
</div>
|
|
1609
|
+
|
|
1610
|
+
<div class="method_details ">
|
|
1611
|
+
<h3 class="signature " id="new_page-instance_method">
|
|
1612
|
+
|
|
1613
|
+
#<strong>new_page</strong> ⇒ <tt>Object</tt>
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
</h3><table class="source_code">
|
|
1620
|
+
<tr>
|
|
1621
|
+
<td>
|
|
1622
|
+
<pre class="lines">
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
165
|
|
1626
|
+
166
|
|
1627
|
+
167</pre>
|
|
1628
|
+
</td>
|
|
1629
|
+
<td>
|
|
1630
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 165</span>
|
|
1631
|
+
|
|
1632
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_new_page'>new_page</span>
|
|
1633
|
+
<span class='ivar'>@default_context</span><span class='period'>.</span><span class='id identifier rubyid_new_page'>new_page</span>
|
|
1634
|
+
<span class='kw'>end</span></pre>
|
|
1635
|
+
</td>
|
|
1636
|
+
</tr>
|
|
1637
|
+
</table>
|
|
1638
|
+
</div>
|
|
1639
|
+
|
|
1640
|
+
<div class="method_details ">
|
|
1641
|
+
<h3 class="signature " id="pages-instance_method">
|
|
1642
|
+
|
|
1643
|
+
#<strong>pages</strong> ⇒ <tt>!Promise<!Array<!<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Page</a></span>>></tt>
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
</h3><div class="docstring">
|
|
1650
|
+
<div class="discussion">
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
</div>
|
|
1654
|
+
</div>
|
|
1655
|
+
<div class="tags">
|
|
1656
|
+
|
|
1657
|
+
<p class="tag_title">Returns:</p>
|
|
1658
|
+
<ul class="return">
|
|
1659
|
+
|
|
1660
|
+
<li>
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
<span class='type'>(<tt>!Promise<!Array<!<span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>.<span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Page</a></span>>></tt>)</span>
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
</li>
|
|
1668
|
+
|
|
1669
|
+
</ul>
|
|
1670
|
+
|
|
1671
|
+
</div><table class="source_code">
|
|
1672
|
+
<tr>
|
|
1673
|
+
<td>
|
|
1674
|
+
<pre class="lines">
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
229
|
|
1678
|
+
230
|
|
1679
|
+
231</pre>
|
|
1680
|
+
</td>
|
|
1681
|
+
<td>
|
|
1682
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 229</span>
|
|
1683
|
+
|
|
1684
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pages'>pages</span>
|
|
1685
|
+
<span class='id identifier rubyid_browser_contexts'>browser_contexts</span><span class='period'>.</span><span class='id identifier rubyid_flat_map'>flat_map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:pages</span><span class='rparen'>)</span>
|
|
1686
|
+
<span class='kw'>end</span></pre>
|
|
1687
|
+
</td>
|
|
1688
|
+
</tr>
|
|
1689
|
+
</table>
|
|
1690
|
+
</div>
|
|
1691
|
+
|
|
1692
|
+
<div class="method_details ">
|
|
1693
|
+
<h3 class="signature " id="process-instance_method">
|
|
1694
|
+
|
|
1695
|
+
#<strong>process</strong> ⇒ <tt><span class='object_link'><a href="BrowserRunner/BrowserProcess.html" title="Puppeteer::BrowserRunner::BrowserProcess (class)">Puppeteer::BrowserRunner::BrowserProcess</a></span></tt>
|
|
1696
|
+
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
</h3><div class="docstring">
|
|
1702
|
+
<div class="discussion">
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
</div>
|
|
1706
|
+
</div>
|
|
1707
|
+
<div class="tags">
|
|
1708
|
+
|
|
1709
|
+
<p class="tag_title">Returns:</p>
|
|
1710
|
+
<ul class="return">
|
|
1711
|
+
|
|
1712
|
+
<li>
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
<span class='type'>(<tt><span class='object_link'><a href="BrowserRunner/BrowserProcess.html" title="Puppeteer::BrowserRunner::BrowserProcess (class)">Puppeteer::BrowserRunner::BrowserProcess</a></span></tt>)</span>
|
|
1716
|
+
|
|
1717
|
+
|
|
1718
|
+
|
|
1719
|
+
</li>
|
|
1720
|
+
|
|
1721
|
+
</ul>
|
|
1722
|
+
|
|
1723
|
+
</div><table class="source_code">
|
|
1724
|
+
<tr>
|
|
1725
|
+
<td>
|
|
1726
|
+
<pre class="lines">
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
58
|
|
1730
|
+
59
|
|
1731
|
+
60</pre>
|
|
1732
|
+
</td>
|
|
1733
|
+
<td>
|
|
1734
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 58</span>
|
|
1735
|
+
|
|
1736
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process'>process</span>
|
|
1737
|
+
<span class='ivar'>@process</span>
|
|
1738
|
+
<span class='kw'>end</span></pre>
|
|
1739
|
+
</td>
|
|
1740
|
+
</tr>
|
|
1741
|
+
</table>
|
|
1742
|
+
</div>
|
|
1743
|
+
|
|
1744
|
+
<div class="method_details ">
|
|
1745
|
+
<h3 class="signature " id="target-instance_method">
|
|
1746
|
+
|
|
1747
|
+
#<strong>target</strong> ⇒ <tt>!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span></tt>
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
</h3><div class="docstring">
|
|
1754
|
+
<div class="discussion">
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
</div>
|
|
1758
|
+
</div>
|
|
1759
|
+
<div class="tags">
|
|
1760
|
+
|
|
1761
|
+
<p class="tag_title">Returns:</p>
|
|
1762
|
+
<ul class="return">
|
|
1763
|
+
|
|
1764
|
+
<li>
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
<span class='type'>(<tt>!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span></tt>)</span>
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
</li>
|
|
1772
|
+
|
|
1773
|
+
</ul>
|
|
1774
|
+
|
|
1775
|
+
</div><table class="source_code">
|
|
1776
|
+
<tr>
|
|
1777
|
+
<td>
|
|
1778
|
+
<pre class="lines">
|
|
1779
|
+
|
|
1780
|
+
|
|
1781
|
+
190
|
|
1782
|
+
191
|
|
1783
|
+
192</pre>
|
|
1784
|
+
</td>
|
|
1785
|
+
<td>
|
|
1786
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 190</span>
|
|
1787
|
+
|
|
1788
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_target'>target</span>
|
|
1789
|
+
<span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_target'>target</span><span class='op'>|</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>browser</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
|
|
1790
|
+
<span class='kw'>end</span></pre>
|
|
1791
|
+
</td>
|
|
1792
|
+
</tr>
|
|
1793
|
+
</table>
|
|
1794
|
+
</div>
|
|
1795
|
+
|
|
1796
|
+
<div class="method_details ">
|
|
1797
|
+
<h3 class="signature " id="targets-instance_method">
|
|
1798
|
+
|
|
1799
|
+
#<strong>targets</strong> ⇒ <tt>!Array<!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>></tt>
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
</h3><div class="docstring">
|
|
1806
|
+
<div class="discussion">
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
</div>
|
|
1810
|
+
</div>
|
|
1811
|
+
<div class="tags">
|
|
1812
|
+
|
|
1813
|
+
<p class="tag_title">Returns:</p>
|
|
1814
|
+
<ul class="return">
|
|
1815
|
+
|
|
1816
|
+
<li>
|
|
1817
|
+
|
|
1818
|
+
|
|
1819
|
+
<span class='type'>(<tt>!Array<!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>></tt>)</span>
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
</li>
|
|
1824
|
+
|
|
1825
|
+
</ul>
|
|
1826
|
+
|
|
1827
|
+
</div><table class="source_code">
|
|
1828
|
+
<tr>
|
|
1829
|
+
<td>
|
|
1830
|
+
<pre class="lines">
|
|
1831
|
+
|
|
1832
|
+
|
|
1833
|
+
184
|
|
1834
|
+
185
|
|
1835
|
+
186</pre>
|
|
1836
|
+
</td>
|
|
1837
|
+
<td>
|
|
1838
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 184</span>
|
|
1839
|
+
|
|
1840
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_targets'>targets</span>
|
|
1841
|
+
<span class='ivar'>@targets</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_target'>target</span><span class='op'>|</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_initialized?'>initialized?</span> <span class='rbrace'>}</span>
|
|
1842
|
+
<span class='kw'>end</span></pre>
|
|
1843
|
+
</td>
|
|
1844
|
+
</tr>
|
|
1845
|
+
</table>
|
|
1846
|
+
</div>
|
|
1847
|
+
|
|
1848
|
+
<div class="method_details ">
|
|
1849
|
+
<h3 class="signature " id="user_agent-instance_method">
|
|
1850
|
+
|
|
1851
|
+
#<strong>user_agent</strong> ⇒ <tt>String</tt>
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
</h3><div class="docstring">
|
|
1858
|
+
<div class="discussion">
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
</div>
|
|
1862
|
+
</div>
|
|
1863
|
+
<div class="tags">
|
|
1864
|
+
|
|
1865
|
+
<p class="tag_title">Returns:</p>
|
|
1866
|
+
<ul class="return">
|
|
1867
|
+
|
|
1868
|
+
<li>
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
|
|
1875
|
+
</li>
|
|
1876
|
+
|
|
1877
|
+
</ul>
|
|
1878
|
+
|
|
1879
|
+
</div><table class="source_code">
|
|
1880
|
+
<tr>
|
|
1881
|
+
<td>
|
|
1882
|
+
<pre class="lines">
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
239
|
|
1886
|
+
240
|
|
1887
|
+
241</pre>
|
|
1888
|
+
</td>
|
|
1889
|
+
<td>
|
|
1890
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 239</span>
|
|
1891
|
+
|
|
1892
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_user_agent'>user_agent</span>
|
|
1893
|
+
<span class='id identifier rubyid_get_version'>get_version</span><span class='period'>.</span><span class='id identifier rubyid_user_agent'>user_agent</span>
|
|
1894
|
+
<span class='kw'>end</span></pre>
|
|
1895
|
+
</td>
|
|
1896
|
+
</tr>
|
|
1897
|
+
</table>
|
|
1898
|
+
</div>
|
|
1899
|
+
|
|
1900
|
+
<div class="method_details ">
|
|
1901
|
+
<h3 class="signature " id="version-instance_method">
|
|
1902
|
+
|
|
1903
|
+
#<strong>version</strong> ⇒ <tt>String</tt>
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
</h3><div class="docstring">
|
|
1910
|
+
<div class="discussion">
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
</div>
|
|
1914
|
+
</div>
|
|
1915
|
+
<div class="tags">
|
|
1916
|
+
|
|
1917
|
+
<p class="tag_title">Returns:</p>
|
|
1918
|
+
<ul class="return">
|
|
1919
|
+
|
|
1920
|
+
<li>
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
1924
|
+
|
|
1925
|
+
|
|
1926
|
+
|
|
1927
|
+
</li>
|
|
1928
|
+
|
|
1929
|
+
</ul>
|
|
1930
|
+
|
|
1931
|
+
</div><table class="source_code">
|
|
1932
|
+
<tr>
|
|
1933
|
+
<td>
|
|
1934
|
+
<pre class="lines">
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
234
|
|
1938
|
+
235
|
|
1939
|
+
236</pre>
|
|
1940
|
+
</td>
|
|
1941
|
+
<td>
|
|
1942
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 234</span>
|
|
1943
|
+
|
|
1944
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span>
|
|
1945
|
+
<span class='id identifier rubyid_get_version'>get_version</span><span class='period'>.</span><span class='id identifier rubyid_product'>product</span>
|
|
1946
|
+
<span class='kw'>end</span></pre>
|
|
1947
|
+
</td>
|
|
1948
|
+
</tr>
|
|
1949
|
+
</table>
|
|
1950
|
+
</div>
|
|
1951
|
+
|
|
1952
|
+
<div class="method_details ">
|
|
1953
|
+
<h3 class="signature " id="wait_for_target-instance_method">
|
|
1954
|
+
|
|
1955
|
+
#<strong>wait_for_target</strong>(predicate:, timeout: nil) ⇒ <tt>!Promise<!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>></tt>
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
</h3><div class="docstring">
|
|
1962
|
+
<div class="discussion">
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
</div>
|
|
1966
|
+
</div>
|
|
1967
|
+
<div class="tags">
|
|
1968
|
+
<p class="tag_title">Parameters:</p>
|
|
1969
|
+
<ul class="param">
|
|
1970
|
+
|
|
1971
|
+
<li>
|
|
1972
|
+
|
|
1973
|
+
<span class='name'>predicate</span>
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
<span class='type'>(<tt>function(!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>):boolean</tt>)</span>
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
</li>
|
|
1981
|
+
|
|
1982
|
+
<li>
|
|
1983
|
+
|
|
1984
|
+
<span class='name'>options</span>
|
|
1985
|
+
|
|
1986
|
+
|
|
1987
|
+
<span class='type'>(<tt>{timeout?: number}=</tt>)</span>
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
</li>
|
|
1992
|
+
|
|
1993
|
+
</ul>
|
|
1994
|
+
|
|
1995
|
+
<p class="tag_title">Returns:</p>
|
|
1996
|
+
<ul class="return">
|
|
1997
|
+
|
|
1998
|
+
<li>
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
<span class='type'>(<tt>!Promise<!<span class='object_link'><a href="Target.html" title="Puppeteer::Target (class)">Target</a></span>></tt>)</span>
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
|
|
2005
|
+
</li>
|
|
2006
|
+
|
|
2007
|
+
</ul>
|
|
2008
|
+
|
|
2009
|
+
</div><table class="source_code">
|
|
2010
|
+
<tr>
|
|
2011
|
+
<td>
|
|
2012
|
+
<pre class="lines">
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
197
|
|
2016
|
+
198
|
|
2017
|
+
199
|
|
2018
|
+
200
|
|
2019
|
+
201
|
|
2020
|
+
202
|
|
2021
|
+
203
|
|
2022
|
+
204
|
|
2023
|
+
205
|
|
2024
|
+
206
|
|
2025
|
+
207
|
|
2026
|
+
208
|
|
2027
|
+
209
|
|
2028
|
+
210
|
|
2029
|
+
211
|
|
2030
|
+
212
|
|
2031
|
+
213
|
|
2032
|
+
214
|
|
2033
|
+
215
|
|
2034
|
+
216
|
|
2035
|
+
217
|
|
2036
|
+
218
|
|
2037
|
+
219
|
|
2038
|
+
220
|
|
2039
|
+
221
|
|
2040
|
+
222
|
|
2041
|
+
223
|
|
2042
|
+
224
|
|
2043
|
+
225
|
|
2044
|
+
226</pre>
|
|
2045
|
+
</td>
|
|
2046
|
+
<td>
|
|
2047
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 197</span>
|
|
2048
|
+
|
|
2049
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_wait_for_target'>wait_for_target</span><span class='lparen'>(</span><span class='label'>predicate:</span><span class='comma'>,</span> <span class='label'>timeout:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
2050
|
+
<span class='id identifier rubyid_timeout_in_sec'>timeout_in_sec</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_timeout'>timeout</span> <span class='op'>||</span> <span class='int'>30000</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>/</span> <span class='float'>1000.0</span>
|
|
2051
|
+
<span class='id identifier rubyid_existing_target'>existing_target</span> <span class='op'>=</span> <span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_target'>target</span><span class='op'>|</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
2052
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_existing_target'>existing_target</span> <span class='kw'>if</span> <span class='id identifier rubyid_existing_target'>existing_target</span>
|
|
2053
|
+
|
|
2054
|
+
<span class='id identifier rubyid_event_listening_ids'>event_listening_ids</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
2055
|
+
<span class='id identifier rubyid_target_promise'>target_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>
|
|
2056
|
+
<span class='id identifier rubyid_event_listening_ids'>event_listening_ids</span> <span class='op'><<</span> <span class='id identifier rubyid_add_event_listener'>add_event_listener</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.Browser.TargetCreated</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_target'>target</span><span class='op'>|</span>
|
|
2057
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
|
2058
|
+
<span class='id identifier rubyid_target_promise'>target_promise</span><span class='period'>.</span><span class='id identifier rubyid_fulfill'>fulfill</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
|
2059
|
+
<span class='kw'>end</span>
|
|
2060
|
+
<span class='kw'>end</span>
|
|
2061
|
+
<span class='id identifier rubyid_event_listening_ids'>event_listening_ids</span> <span class='op'><<</span> <span class='id identifier rubyid_add_event_listener'>add_event_listener</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Events.Browser.TargetChanged</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_target'>target</span><span class='op'>|</span>
|
|
2062
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
|
2063
|
+
<span class='id identifier rubyid_target_promise'>target_promise</span><span class='period'>.</span><span class='id identifier rubyid_fulfill'>fulfill</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
|
2064
|
+
<span class='kw'>end</span>
|
|
2065
|
+
<span class='kw'>end</span>
|
|
2066
|
+
|
|
2067
|
+
<span class='kw'>begin</span>
|
|
2068
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_timeout_in_sec'>timeout_in_sec</span> <span class='op'>></span> <span class='int'>0</span>
|
|
2069
|
+
<span class='const'>Timeout</span><span class='period'>.</span><span class='id identifier rubyid_timeout'>timeout</span><span class='lparen'>(</span><span class='id identifier rubyid_timeout_in_sec'>timeout_in_sec</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
2070
|
+
<span class='id identifier rubyid_target_promise'>target_promise</span><span class='period'>.</span><span class='id identifier rubyid_value!'>value!</span>
|
|
2071
|
+
<span class='kw'>end</span>
|
|
2072
|
+
<span class='kw'>else</span>
|
|
2073
|
+
<span class='id identifier rubyid_target_promise'>target_promise</span><span class='period'>.</span><span class='id identifier rubyid_value!'>value!</span>
|
|
2074
|
+
<span class='kw'>end</span>
|
|
2075
|
+
<span class='kw'>ensure</span>
|
|
2076
|
+
<span class='id identifier rubyid_remove_event_listener'>remove_event_listener</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_event_listening_ids'>event_listening_ids</span><span class='rparen'>)</span>
|
|
2077
|
+
<span class='kw'>end</span>
|
|
2078
|
+
<span class='kw'>end</span></pre>
|
|
2079
|
+
</td>
|
|
2080
|
+
</tr>
|
|
2081
|
+
</table>
|
|
2082
|
+
</div>
|
|
2083
|
+
|
|
2084
|
+
<div class="method_details ">
|
|
2085
|
+
<h3 class="signature " id="websocket_endpoint-instance_method">
|
|
2086
|
+
|
|
2087
|
+
#<strong>websocket_endpoint</strong> ⇒ <tt>String</tt>
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
</h3><div class="docstring">
|
|
2094
|
+
<div class="discussion">
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
</div>
|
|
2098
|
+
</div>
|
|
2099
|
+
<div class="tags">
|
|
2100
|
+
|
|
2101
|
+
<p class="tag_title">Returns:</p>
|
|
2102
|
+
<ul class="return">
|
|
2103
|
+
|
|
2104
|
+
<li>
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
</li>
|
|
2112
|
+
|
|
2113
|
+
</ul>
|
|
2114
|
+
|
|
2115
|
+
</div><table class="source_code">
|
|
2116
|
+
<tr>
|
|
2117
|
+
<td>
|
|
2118
|
+
<pre class="lines">
|
|
2119
|
+
|
|
2120
|
+
|
|
2121
|
+
161
|
|
2122
|
+
162
|
|
2123
|
+
163</pre>
|
|
2124
|
+
</td>
|
|
2125
|
+
<td>
|
|
2126
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/browser.rb', line 161</span>
|
|
2127
|
+
|
|
2128
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_websocket_endpoint'>websocket_endpoint</span>
|
|
2129
|
+
<span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span>
|
|
2130
|
+
<span class='kw'>end</span></pre>
|
|
2131
|
+
</td>
|
|
2132
|
+
</tr>
|
|
2133
|
+
</table>
|
|
2134
|
+
</div>
|
|
2135
|
+
|
|
2136
|
+
</div>
|
|
2137
|
+
|
|
2138
|
+
</div>
|
|
2139
|
+
|
|
2140
|
+
<div id="footer">
|
|
2141
|
+
Generated on Fri Jun 12 12:38:33 2020 by
|
|
2142
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
2143
|
+
0.9.24 (ruby-2.6.3).
|
|
2144
|
+
</div>
|
|
2145
|
+
|
|
2146
|
+
</div>
|
|
2147
|
+
</body>
|
|
2148
|
+
</html>
|