puppeteer-ruby 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- 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,139 @@
|
|
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::Devices
|
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::Devices";
|
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 (D)</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">Devices</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::Devices
|
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::Devices</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/puppeteer/devices.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Instead of Puppeteer::DEVICES[“iPhone X”], Puppeteer::DEVICES[“iPad Pro”],</p>
|
106
|
+
<ul><li>
|
107
|
+
<p>Puppeteer::Devices.iPhone_X</p>
|
108
|
+
</li><li>
|
109
|
+
<p>Puppeteer::Devices.iPad_Pro</p>
|
110
|
+
</li></ul>
|
111
|
+
|
112
|
+
<p>etc…</p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<div id="footer">
|
132
|
+
Generated on Fri Jun 12 12:38:33 2020 by
|
133
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
134
|
+
0.9.24 (ruby-2.6.3).
|
135
|
+
</div>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
</body>
|
139
|
+
</html>
|
@@ -0,0 +1,2542 @@
|
|
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::ElementHandle
|
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::ElementHandle";
|
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 (E)</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">ElementHandle</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::ElementHandle
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">Puppeteer::ElementHandle</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<dl>
|
93
|
+
<dt>Includes:</dt>
|
94
|
+
<dd><span class='object_link'><a href="IfPresent.html" title="Puppeteer::IfPresent (module)">IfPresent</a></span></dd>
|
95
|
+
</dl>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dl>
|
103
|
+
<dt>Defined in:</dt>
|
104
|
+
<dd>lib/puppeteer/element_handle.rb<span class="defines">,<br />
|
105
|
+
lib/puppeteer/element_handle/point.rb,<br /> lib/puppeteer/element_handle/box_model.rb,<br /> lib/puppeteer/element_handle/bounding_box.rb</span>
|
106
|
+
</dd>
|
107
|
+
</dl>
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<h2>Defined Under Namespace</h2>
|
112
|
+
<p class="children">
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span>, <span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span>, <span class='object_link'><a href="ElementHandle/ElementNotFoundError.html" title="Puppeteer::ElementHandle::ElementNotFoundError (class)">ElementNotFoundError</a></span>, <span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span>, <span class='object_link'><a href="ElementHandle/Point.html" title="Puppeteer::ElementHandle::Point (class)">Point</a></span>, <span class='object_link'><a href="ElementHandle/ScrollIntoViewError.html" title="Puppeteer::ElementHandle::ScrollIntoViewError (class)">ScrollIntoViewError</a></span>
|
118
|
+
|
119
|
+
|
120
|
+
</p>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<h2>Instance Attribute Summary</h2>
|
128
|
+
|
129
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></h3>
|
130
|
+
<p class="inherited"><span class='object_link'><a href="JSHandle.html#context-instance_method" title="Puppeteer::JSHandle#context (method)">#context</a></span>, <span class='object_link'><a href="JSHandle.html#remote_object-instance_method" title="Puppeteer::JSHandle#remote_object (method)">#remote_object</a></span></p>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<h2>
|
135
|
+
Instance Method Summary
|
136
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
137
|
+
</h2>
|
138
|
+
|
139
|
+
<ul class="summary">
|
140
|
+
|
141
|
+
<li class="public ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#as_element-instance_method" title="#as_element (instance method)">#<strong>as_element</strong> ⇒ Object </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
<li class="public ">
|
164
|
+
<span class="summary_signature">
|
165
|
+
|
166
|
+
<a href="#async_press-instance_method" title="#async_press (instance method)">#<strong>async_press</strong> ⇒ Future </a>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
</span>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#async_Seval-instance_method" title="#async_Seval (instance method)">#<strong>async_Seval</strong> ⇒ Object </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'>
|
203
|
+
<p>`$eval()` in JavaScript.</p>
|
204
|
+
</div></span>
|
205
|
+
|
206
|
+
</li>
|
207
|
+
|
208
|
+
|
209
|
+
<li class="public ">
|
210
|
+
<span class="summary_signature">
|
211
|
+
|
212
|
+
<a href="#async_SSeval-instance_method" title="#async_SSeval (instance method)">#<strong>async_SSeval</strong> ⇒ Object </a>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
</span>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<span class="summary_desc"><div class='inline'>
|
227
|
+
<p>`$$eval()` in JavaScript.</p>
|
228
|
+
</div></span>
|
229
|
+
|
230
|
+
</li>
|
231
|
+
|
232
|
+
|
233
|
+
<li class="public ">
|
234
|
+
<span class="summary_signature">
|
235
|
+
|
236
|
+
<a href="#async_type_text-instance_method" title="#async_type_text (instance method)">#<strong>async_type_text</strong> ⇒ Future </a>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</span>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
251
|
+
|
252
|
+
</li>
|
253
|
+
|
254
|
+
|
255
|
+
<li class="public ">
|
256
|
+
<span class="summary_signature">
|
257
|
+
|
258
|
+
<a href="#bounding_box-instance_method" title="#bounding_box (instance method)">#<strong>bounding_box</strong> ⇒ BoundingBox|nil </a>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
</span>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
<li class="public ">
|
278
|
+
<span class="summary_signature">
|
279
|
+
|
280
|
+
<a href="#box_model-instance_method" title="#box_model (instance method)">#<strong>box_model</strong> ⇒ BoxModel|nil </a>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
</span>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
295
|
+
|
296
|
+
</li>
|
297
|
+
|
298
|
+
|
299
|
+
<li class="public ">
|
300
|
+
<span class="summary_signature">
|
301
|
+
|
302
|
+
<a href="#click-instance_method" title="#click (instance method)">#<strong>click</strong>(delay: nil, button: nil, click_count: nil) ⇒ Object </a>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
</span>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
|
321
|
+
<li class="public ">
|
322
|
+
<span class="summary_signature">
|
323
|
+
|
324
|
+
<a href="#clickable_point-instance_method" title="#clickable_point (instance method)">#<strong>clickable_point</strong> ⇒ Object </a>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</span>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
339
|
+
|
340
|
+
</li>
|
341
|
+
|
342
|
+
|
343
|
+
<li class="public ">
|
344
|
+
<span class="summary_signature">
|
345
|
+
|
346
|
+
<a href="#content_frame-instance_method" title="#content_frame (instance method)">#<strong>content_frame</strong> ⇒ Object </a>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
</span>
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
361
|
+
|
362
|
+
</li>
|
363
|
+
|
364
|
+
|
365
|
+
<li class="public ">
|
366
|
+
<span class="summary_signature">
|
367
|
+
|
368
|
+
<a href="#focus-instance_method" title="#focus (instance method)">#<strong>focus</strong> ⇒ Object </a>
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
</span>
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
383
|
+
|
384
|
+
</li>
|
385
|
+
|
386
|
+
|
387
|
+
<li class="public ">
|
388
|
+
<span class="summary_signature">
|
389
|
+
|
390
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(context:, client:, remote_object:, page:, frame_manager:) ⇒ ElementHandle </a>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
</span>
|
395
|
+
|
396
|
+
|
397
|
+
<span class="note title constructor">constructor</span>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
<span class="summary_desc"><div class='inline'>
|
407
|
+
<p>A new instance of ElementHandle.</p>
|
408
|
+
</div></span>
|
409
|
+
|
410
|
+
</li>
|
411
|
+
|
412
|
+
|
413
|
+
<li class="public ">
|
414
|
+
<span class="summary_signature">
|
415
|
+
|
416
|
+
<a href="#press-instance_method" title="#press (instance method)">#<strong>press</strong>(key, delay: nil) ⇒ Object </a>
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
</span>
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
431
|
+
|
432
|
+
</li>
|
433
|
+
|
434
|
+
|
435
|
+
<li class="public ">
|
436
|
+
<span class="summary_signature">
|
437
|
+
|
438
|
+
<a href="#S-instance_method" title="#S (instance method)">#<strong>S</strong>(selector) ⇒ Object </a>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
</span>
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
<span class="summary_desc"><div class='inline'>
|
453
|
+
<p>`$()` in JavaScript.</p>
|
454
|
+
</div></span>
|
455
|
+
|
456
|
+
</li>
|
457
|
+
|
458
|
+
|
459
|
+
<li class="public ">
|
460
|
+
<span class="summary_signature">
|
461
|
+
|
462
|
+
<a href="#screenshot-instance_method" title="#screenshot (instance method)">#<strong>screenshot</strong>(options = {}) ⇒ Object </a>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
</span>
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
477
|
+
|
478
|
+
</li>
|
479
|
+
|
480
|
+
|
481
|
+
<li class="public ">
|
482
|
+
<span class="summary_signature">
|
483
|
+
|
484
|
+
<a href="#scroll_into_view_if_needed-instance_method" title="#scroll_into_view_if_needed (instance method)">#<strong>scroll_into_view_if_needed</strong> ⇒ Object </a>
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
</span>
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
499
|
+
|
500
|
+
</li>
|
501
|
+
|
502
|
+
|
503
|
+
<li class="public ">
|
504
|
+
<span class="summary_signature">
|
505
|
+
|
506
|
+
<a href="#select-instance_method" title="#select (instance method)">#<strong>select</strong>(*values) ⇒ Array<String> </a>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</span>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
521
|
+
|
522
|
+
</li>
|
523
|
+
|
524
|
+
|
525
|
+
<li class="public ">
|
526
|
+
<span class="summary_signature">
|
527
|
+
|
528
|
+
<a href="#Seval-instance_method" title="#Seval (instance method)">#<strong>Seval</strong>(selector, page_function, *args) ⇒ Object </a>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
</span>
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
<span class="summary_desc"><div class='inline'>
|
543
|
+
<p>`$eval()` in JavaScript.</p>
|
544
|
+
</div></span>
|
545
|
+
|
546
|
+
</li>
|
547
|
+
|
548
|
+
|
549
|
+
<li class="public ">
|
550
|
+
<span class="summary_signature">
|
551
|
+
|
552
|
+
<a href="#SS-instance_method" title="#SS (instance method)">#<strong>SS</strong>(selector) ⇒ Object </a>
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
</span>
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
<span class="summary_desc"><div class='inline'>
|
567
|
+
<p>`$$()` in JavaScript.</p>
|
568
|
+
</div></span>
|
569
|
+
|
570
|
+
</li>
|
571
|
+
|
572
|
+
|
573
|
+
<li class="public ">
|
574
|
+
<span class="summary_signature">
|
575
|
+
|
576
|
+
<a href="#SSeval-instance_method" title="#SSeval (instance method)">#<strong>SSeval</strong>(selector, page_function, *args) ⇒ Object </a>
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
</span>
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
<span class="summary_desc"><div class='inline'>
|
591
|
+
<p>`$$eval()` in JavaScript.</p>
|
592
|
+
</div></span>
|
593
|
+
|
594
|
+
</li>
|
595
|
+
|
596
|
+
|
597
|
+
<li class="public ">
|
598
|
+
<span class="summary_signature">
|
599
|
+
|
600
|
+
<a href="#Sx-instance_method" title="#Sx (instance method)">#<strong>Sx</strong>(expression) ⇒ Array<ElementHandle> </a>
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
</span>
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
<span class="summary_desc"><div class='inline'>
|
615
|
+
<p>`$x()` in JavaScript.</p>
|
616
|
+
</div></span>
|
617
|
+
|
618
|
+
</li>
|
619
|
+
|
620
|
+
|
621
|
+
<li class="public ">
|
622
|
+
<span class="summary_signature">
|
623
|
+
|
624
|
+
<a href="#tap-instance_method" title="#tap (instance method)">#<strong>tap</strong>(&block) ⇒ Object </a>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
</span>
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
639
|
+
|
640
|
+
</li>
|
641
|
+
|
642
|
+
|
643
|
+
<li class="public ">
|
644
|
+
<span class="summary_signature">
|
645
|
+
|
646
|
+
<a href="#type_text-instance_method" title="#type_text (instance method)">#<strong>type_text</strong>(text, delay: nil) ⇒ Object </a>
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
</span>
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
661
|
+
|
662
|
+
</li>
|
663
|
+
|
664
|
+
|
665
|
+
<li class="public ">
|
666
|
+
<span class="summary_signature">
|
667
|
+
|
668
|
+
<a href="#upload_file-instance_method" title="#upload_file (instance method)">#<strong>upload_file</strong>(*file_paths) ⇒ Object </a>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
</span>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
683
|
+
|
684
|
+
</li>
|
685
|
+
|
686
|
+
|
687
|
+
</ul>
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="IfPresent.html" title="Puppeteer::IfPresent (module)">IfPresent</a></span></h3>
|
700
|
+
<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>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
|
709
|
+
|
710
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="JSHandle.html" title="Puppeteer::JSHandle (class)">JSHandle</a></span></h3>
|
711
|
+
<p class="inherited"><span class='object_link'><a href="JSHandle.html#async_evaluate-instance_method" title="Puppeteer::JSHandle#async_evaluate (method)">#async_evaluate</a></span>, <span class='object_link'><a href="JSHandle.html#async_evaluate_handle-instance_method" title="Puppeteer::JSHandle#async_evaluate_handle (method)">#async_evaluate_handle</a></span>, <span class='object_link'><a href="JSHandle.html#create-class_method" title="Puppeteer::JSHandle.create (method)">create</a></span>, <span class='object_link'><a href="JSHandle.html#dispose-instance_method" title="Puppeteer::JSHandle#dispose (method)">#dispose</a></span>, <span class='object_link'><a href="JSHandle.html#disposed%3F-instance_method" title="Puppeteer::JSHandle#disposed? (method)">#disposed?</a></span>, <span class='object_link'><a href="JSHandle.html#evaluate-instance_method" title="Puppeteer::JSHandle#evaluate (method)">#evaluate</a></span>, <span class='object_link'><a href="JSHandle.html#evaluate_handle-instance_method" title="Puppeteer::JSHandle#evaluate_handle (method)">#evaluate_handle</a></span>, <span class='object_link'><a href="JSHandle.html#execution_context-instance_method" title="Puppeteer::JSHandle#execution_context (method)">#execution_context</a></span>, <span class='object_link'><a href="JSHandle.html#json_value-instance_method" title="Puppeteer::JSHandle#json_value (method)">#json_value</a></span>, <span class='object_link'><a href="JSHandle.html#properties-instance_method" title="Puppeteer::JSHandle#properties (method)">#properties</a></span></p>
|
712
|
+
<div id="constructor_details" class="method_details_list">
|
713
|
+
<h2>Constructor Details</h2>
|
714
|
+
|
715
|
+
<div class="method_details first">
|
716
|
+
<h3 class="signature first" id="initialize-instance_method">
|
717
|
+
|
718
|
+
#<strong>initialize</strong>(context:, client:, remote_object:, page:, frame_manager:) ⇒ <tt><span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span></tt>
|
719
|
+
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
</h3><div class="docstring">
|
725
|
+
<div class="discussion">
|
726
|
+
|
727
|
+
<p>Returns a new instance of ElementHandle.</p>
|
728
|
+
|
729
|
+
|
730
|
+
</div>
|
731
|
+
</div>
|
732
|
+
<div class="tags">
|
733
|
+
<p class="tag_title">Parameters:</p>
|
734
|
+
<ul class="param">
|
735
|
+
|
736
|
+
<li>
|
737
|
+
|
738
|
+
<span class='name'>context</span>
|
739
|
+
|
740
|
+
|
741
|
+
<span class='type'>(<tt><span class='object_link'><a href="ExecutionContext.html" title="Puppeteer::ExecutionContext (class)">Puppeteer::ExecutionContext</a></span></tt>)</span>
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
</li>
|
746
|
+
|
747
|
+
<li>
|
748
|
+
|
749
|
+
<span class='name'>client</span>
|
750
|
+
|
751
|
+
|
752
|
+
<span class='type'>(<tt><span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">Puppeteer::CDPSession</a></span></tt>)</span>
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
</li>
|
757
|
+
|
758
|
+
<li>
|
759
|
+
|
760
|
+
<span class='name'>remote_object</span>
|
761
|
+
|
762
|
+
|
763
|
+
<span class='type'>(<tt><span class='object_link'><a href="RemoteObject.html" title="Puppeteer::RemoteObject (class)">Puppeteer::RemoteObject</a></span></tt>)</span>
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
</li>
|
768
|
+
|
769
|
+
<li>
|
770
|
+
|
771
|
+
<span class='name'>page</span>
|
772
|
+
|
773
|
+
|
774
|
+
<span class='type'>(<tt><span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Puppeteer::Page</a></span></tt>)</span>
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
</li>
|
779
|
+
|
780
|
+
<li>
|
781
|
+
|
782
|
+
<span class='name'>frame_manager</span>
|
783
|
+
|
784
|
+
|
785
|
+
<span class='type'>(<tt><span class='object_link'><a href="FrameManager.html" title="Puppeteer::FrameManager (class)">Puppeteer::FrameManager</a></span></tt>)</span>
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
</li>
|
790
|
+
|
791
|
+
</ul>
|
792
|
+
|
793
|
+
|
794
|
+
</div><table class="source_code">
|
795
|
+
<tr>
|
796
|
+
<td>
|
797
|
+
<pre class="lines">
|
798
|
+
|
799
|
+
|
800
|
+
14
|
801
|
+
15
|
802
|
+
16
|
803
|
+
17
|
804
|
+
18
|
805
|
+
19</pre>
|
806
|
+
</td>
|
807
|
+
<td>
|
808
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 14</span>
|
809
|
+
|
810
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>context:</span><span class='comma'>,</span> <span class='label'>client:</span><span class='comma'>,</span> <span class='label'>remote_object:</span><span class='comma'>,</span> <span class='label'>page:</span><span class='comma'>,</span> <span class='label'>frame_manager:</span><span class='rparen'>)</span>
|
811
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='label'>context:</span> <span class='id identifier rubyid_context'>context</span><span class='comma'>,</span> <span class='label'>client:</span> <span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='label'>remote_object:</span> <span class='id identifier rubyid_remote_object'>remote_object</span><span class='rparen'>)</span>
|
812
|
+
<span class='ivar'>@page</span> <span class='op'>=</span> <span class='id identifier rubyid_page'>page</span>
|
813
|
+
<span class='ivar'>@frame_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_frame_manager'>frame_manager</span>
|
814
|
+
<span class='ivar'>@disposed</span> <span class='op'>=</span> <span class='kw'>false</span>
|
815
|
+
<span class='kw'>end</span></pre>
|
816
|
+
</td>
|
817
|
+
</tr>
|
818
|
+
</table>
|
819
|
+
</div>
|
820
|
+
|
821
|
+
</div>
|
822
|
+
|
823
|
+
|
824
|
+
<div id="instance_method_details" class="method_details_list">
|
825
|
+
<h2>Instance Method Details</h2>
|
826
|
+
|
827
|
+
|
828
|
+
<div class="method_details first">
|
829
|
+
<h3 class="signature first" id="as_element-instance_method">
|
830
|
+
|
831
|
+
#<strong>as_element</strong> ⇒ <tt>Object</tt>
|
832
|
+
|
833
|
+
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
</h3><table class="source_code">
|
838
|
+
<tr>
|
839
|
+
<td>
|
840
|
+
<pre class="lines">
|
841
|
+
|
842
|
+
|
843
|
+
21
|
844
|
+
22
|
845
|
+
23</pre>
|
846
|
+
</td>
|
847
|
+
<td>
|
848
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 21</span>
|
849
|
+
|
850
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_as_element'>as_element</span>
|
851
|
+
<span class='kw'>self</span>
|
852
|
+
<span class='kw'>end</span></pre>
|
853
|
+
</td>
|
854
|
+
</tr>
|
855
|
+
</table>
|
856
|
+
</div>
|
857
|
+
|
858
|
+
<div class="method_details ">
|
859
|
+
<h3 class="signature " id="async_press-instance_method">
|
860
|
+
|
861
|
+
#<strong>async_press</strong> ⇒ <tt>Future</tt>
|
862
|
+
|
863
|
+
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
</h3><div class="docstring">
|
868
|
+
<div class="discussion">
|
869
|
+
|
870
|
+
|
871
|
+
</div>
|
872
|
+
</div>
|
873
|
+
<div class="tags">
|
874
|
+
<p class="tag_title">Parameters:</p>
|
875
|
+
<ul class="param">
|
876
|
+
|
877
|
+
<li>
|
878
|
+
|
879
|
+
<span class='name'>key</span>
|
880
|
+
|
881
|
+
|
882
|
+
<span class='type'>(<tt>String</tt>)</span>
|
883
|
+
|
884
|
+
|
885
|
+
|
886
|
+
</li>
|
887
|
+
|
888
|
+
<li>
|
889
|
+
|
890
|
+
<span class='name'>delay</span>
|
891
|
+
|
892
|
+
|
893
|
+
<span class='type'>(<tt>number|nil</tt>)</span>
|
894
|
+
|
895
|
+
|
896
|
+
|
897
|
+
</li>
|
898
|
+
|
899
|
+
</ul>
|
900
|
+
|
901
|
+
<p class="tag_title">Returns:</p>
|
902
|
+
<ul class="return">
|
903
|
+
|
904
|
+
<li>
|
905
|
+
|
906
|
+
|
907
|
+
<span class='type'>(<tt>Future</tt>)</span>
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
</li>
|
912
|
+
|
913
|
+
</ul>
|
914
|
+
|
915
|
+
</div><table class="source_code">
|
916
|
+
<tr>
|
917
|
+
<td>
|
918
|
+
<pre class="lines">
|
919
|
+
|
920
|
+
|
921
|
+
234
|
922
|
+
235
|
923
|
+
236</pre>
|
924
|
+
</td>
|
925
|
+
<td>
|
926
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 234</span>
|
927
|
+
|
928
|
+
<span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_press'>async_press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
929
|
+
<span class='id identifier rubyid_press'>press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
|
930
|
+
<span class='kw'>end</span></pre>
|
931
|
+
</td>
|
932
|
+
</tr>
|
933
|
+
</table>
|
934
|
+
</div>
|
935
|
+
|
936
|
+
<div class="method_details ">
|
937
|
+
<h3 class="signature " id="async_Seval-instance_method">
|
938
|
+
|
939
|
+
#<strong>async_Seval</strong> ⇒ <tt>Object</tt>
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
</h3><div class="docstring">
|
946
|
+
<div class="discussion">
|
947
|
+
|
948
|
+
<p>`$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
949
|
+
|
950
|
+
|
951
|
+
</div>
|
952
|
+
</div>
|
953
|
+
<div class="tags">
|
954
|
+
<p class="tag_title">Parameters:</p>
|
955
|
+
<ul class="param">
|
956
|
+
|
957
|
+
<li>
|
958
|
+
|
959
|
+
<span class='name'>selector</span>
|
960
|
+
|
961
|
+
|
962
|
+
<span class='type'>(<tt>String</tt>)</span>
|
963
|
+
|
964
|
+
|
965
|
+
|
966
|
+
</li>
|
967
|
+
|
968
|
+
<li>
|
969
|
+
|
970
|
+
<span class='name'>page_function</span>
|
971
|
+
|
972
|
+
|
973
|
+
<span class='type'>(<tt>String</tt>)</span>
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
</li>
|
978
|
+
|
979
|
+
</ul>
|
980
|
+
|
981
|
+
<p class="tag_title">Returns:</p>
|
982
|
+
<ul class="return">
|
983
|
+
|
984
|
+
<li>
|
985
|
+
|
986
|
+
|
987
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
988
|
+
|
989
|
+
|
990
|
+
|
991
|
+
</li>
|
992
|
+
|
993
|
+
</ul>
|
994
|
+
|
995
|
+
</div><table class="source_code">
|
996
|
+
<tr>
|
997
|
+
<td>
|
998
|
+
<pre class="lines">
|
999
|
+
|
1000
|
+
|
1001
|
+
363
|
1002
|
+
364
|
1003
|
+
365</pre>
|
1004
|
+
</td>
|
1005
|
+
<td>
|
1006
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 363</span>
|
1007
|
+
|
1008
|
+
<span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_Seval'>async_Seval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1009
|
+
<span class='const'><span class='object_link'><a href="#Seval-instance_method" title="Puppeteer::ElementHandle#Seval (method)">Seval</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1010
|
+
<span class='kw'>end</span></pre>
|
1011
|
+
</td>
|
1012
|
+
</tr>
|
1013
|
+
</table>
|
1014
|
+
</div>
|
1015
|
+
|
1016
|
+
<div class="method_details ">
|
1017
|
+
<h3 class="signature " id="async_SSeval-instance_method">
|
1018
|
+
|
1019
|
+
#<strong>async_SSeval</strong> ⇒ <tt>Object</tt>
|
1020
|
+
|
1021
|
+
|
1022
|
+
|
1023
|
+
|
1024
|
+
|
1025
|
+
</h3><div class="docstring">
|
1026
|
+
<div class="discussion">
|
1027
|
+
|
1028
|
+
<p>`$$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
1029
|
+
|
1030
|
+
|
1031
|
+
</div>
|
1032
|
+
</div>
|
1033
|
+
<div class="tags">
|
1034
|
+
<p class="tag_title">Parameters:</p>
|
1035
|
+
<ul class="param">
|
1036
|
+
|
1037
|
+
<li>
|
1038
|
+
|
1039
|
+
<span class='name'>selector</span>
|
1040
|
+
|
1041
|
+
|
1042
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
</li>
|
1047
|
+
|
1048
|
+
<li>
|
1049
|
+
|
1050
|
+
<span class='name'>page_function</span>
|
1051
|
+
|
1052
|
+
|
1053
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1054
|
+
|
1055
|
+
|
1056
|
+
|
1057
|
+
</li>
|
1058
|
+
|
1059
|
+
</ul>
|
1060
|
+
|
1061
|
+
<p class="tag_title">Returns:</p>
|
1062
|
+
<ul class="return">
|
1063
|
+
|
1064
|
+
<li>
|
1065
|
+
|
1066
|
+
|
1067
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1068
|
+
|
1069
|
+
|
1070
|
+
|
1071
|
+
</li>
|
1072
|
+
|
1073
|
+
</ul>
|
1074
|
+
|
1075
|
+
</div><table class="source_code">
|
1076
|
+
<tr>
|
1077
|
+
<td>
|
1078
|
+
<pre class="lines">
|
1079
|
+
|
1080
|
+
|
1081
|
+
386
|
1082
|
+
387
|
1083
|
+
388</pre>
|
1084
|
+
</td>
|
1085
|
+
<td>
|
1086
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 386</span>
|
1087
|
+
|
1088
|
+
<span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_SSeval'>async_SSeval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1089
|
+
<span class='const'><span class='object_link'><a href="#SSeval-instance_method" title="Puppeteer::ElementHandle#SSeval (method)">SSeval</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1090
|
+
<span class='kw'>end</span></pre>
|
1091
|
+
</td>
|
1092
|
+
</tr>
|
1093
|
+
</table>
|
1094
|
+
</div>
|
1095
|
+
|
1096
|
+
<div class="method_details ">
|
1097
|
+
<h3 class="signature " id="async_type_text-instance_method">
|
1098
|
+
|
1099
|
+
#<strong>async_type_text</strong> ⇒ <tt>Future</tt>
|
1100
|
+
|
1101
|
+
|
1102
|
+
|
1103
|
+
|
1104
|
+
|
1105
|
+
</h3><div class="docstring">
|
1106
|
+
<div class="discussion">
|
1107
|
+
|
1108
|
+
|
1109
|
+
</div>
|
1110
|
+
</div>
|
1111
|
+
<div class="tags">
|
1112
|
+
<p class="tag_title">Parameters:</p>
|
1113
|
+
<ul class="param">
|
1114
|
+
|
1115
|
+
<li>
|
1116
|
+
|
1117
|
+
<span class='name'>text</span>
|
1118
|
+
|
1119
|
+
|
1120
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1121
|
+
|
1122
|
+
|
1123
|
+
|
1124
|
+
</li>
|
1125
|
+
|
1126
|
+
<li>
|
1127
|
+
|
1128
|
+
<span class='name'>delay</span>
|
1129
|
+
|
1130
|
+
|
1131
|
+
<span class='type'>(<tt>number|nil</tt>)</span>
|
1132
|
+
|
1133
|
+
|
1134
|
+
|
1135
|
+
</li>
|
1136
|
+
|
1137
|
+
</ul>
|
1138
|
+
|
1139
|
+
<p class="tag_title">Returns:</p>
|
1140
|
+
<ul class="return">
|
1141
|
+
|
1142
|
+
<li>
|
1143
|
+
|
1144
|
+
|
1145
|
+
<span class='type'>(<tt>Future</tt>)</span>
|
1146
|
+
|
1147
|
+
|
1148
|
+
|
1149
|
+
</li>
|
1150
|
+
|
1151
|
+
</ul>
|
1152
|
+
|
1153
|
+
</div><table class="source_code">
|
1154
|
+
<tr>
|
1155
|
+
<td>
|
1156
|
+
<pre class="lines">
|
1157
|
+
|
1158
|
+
|
1159
|
+
220
|
1160
|
+
221
|
1161
|
+
222</pre>
|
1162
|
+
</td>
|
1163
|
+
<td>
|
1164
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 220</span>
|
1165
|
+
|
1166
|
+
<span class='id identifier rubyid_async'>async</span> <span class='kw'>def</span> <span class='id identifier rubyid_async_type_text'>async_type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1167
|
+
<span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
|
1168
|
+
<span class='kw'>end</span></pre>
|
1169
|
+
</td>
|
1170
|
+
</tr>
|
1171
|
+
</table>
|
1172
|
+
</div>
|
1173
|
+
|
1174
|
+
<div class="method_details ">
|
1175
|
+
<h3 class="signature " id="bounding_box-instance_method">
|
1176
|
+
|
1177
|
+
#<strong>bounding_box</strong> ⇒ <tt><span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span>|nil</tt>
|
1178
|
+
|
1179
|
+
|
1180
|
+
|
1181
|
+
|
1182
|
+
|
1183
|
+
</h3><div class="docstring">
|
1184
|
+
<div class="discussion">
|
1185
|
+
|
1186
|
+
|
1187
|
+
</div>
|
1188
|
+
</div>
|
1189
|
+
<div class="tags">
|
1190
|
+
|
1191
|
+
<p class="tag_title">Returns:</p>
|
1192
|
+
<ul class="return">
|
1193
|
+
|
1194
|
+
<li>
|
1195
|
+
|
1196
|
+
|
1197
|
+
<span class='type'>(<tt><span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span>|nil</tt>)</span>
|
1198
|
+
|
1199
|
+
|
1200
|
+
|
1201
|
+
</li>
|
1202
|
+
|
1203
|
+
</ul>
|
1204
|
+
|
1205
|
+
</div><table class="source_code">
|
1206
|
+
<tr>
|
1207
|
+
<td>
|
1208
|
+
<pre class="lines">
|
1209
|
+
|
1210
|
+
|
1211
|
+
239
|
1212
|
+
240
|
1213
|
+
241
|
1214
|
+
242
|
1215
|
+
243
|
1216
|
+
244
|
1217
|
+
245
|
1218
|
+
246
|
1219
|
+
247
|
1220
|
+
248
|
1221
|
+
249
|
1222
|
+
250
|
1223
|
+
251
|
1224
|
+
252</pre>
|
1225
|
+
</td>
|
1226
|
+
<td>
|
1227
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 239</span>
|
1228
|
+
|
1229
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_bounding_box'>bounding_box</span>
|
1230
|
+
<span class='id identifier rubyid_if_present'>if_present</span><span class='lparen'>(</span><span class='id identifier rubyid_box_model'>box_model</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_result_model'>result_model</span><span class='op'>|</span>
|
1231
|
+
<span class='id identifier rubyid_quads'>quads</span> <span class='op'>=</span> <span class='id identifier rubyid_result_model'>result_model</span><span class='period'>.</span><span class='id identifier rubyid_border'>border</span>
|
1232
|
+
|
1233
|
+
<span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:x</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
|
1234
|
+
<span class='id identifier rubyid_y'>y</span> <span class='op'>=</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:y</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
|
1235
|
+
<span class='const'><span class='object_link'><a href="ElementHandle/BoundingBox.html" title="Puppeteer::ElementHandle::BoundingBox (class)">BoundingBox</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/BoundingBox.html#initialize-instance_method" title="Puppeteer::ElementHandle::BoundingBox#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
1236
|
+
<span class='label'>x:</span> <span class='id identifier rubyid_x'>x</span><span class='comma'>,</span>
|
1237
|
+
<span class='label'>y:</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span>
|
1238
|
+
<span class='label'>width:</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:x</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>-</span> <span class='id identifier rubyid_x'>x</span><span class='comma'>,</span>
|
1239
|
+
<span class='label'>height:</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:y</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>-</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span>
|
1240
|
+
<span class='rparen'>)</span>
|
1241
|
+
<span class='kw'>end</span>
|
1242
|
+
<span class='kw'>end</span></pre>
|
1243
|
+
</td>
|
1244
|
+
</tr>
|
1245
|
+
</table>
|
1246
|
+
</div>
|
1247
|
+
|
1248
|
+
<div class="method_details ">
|
1249
|
+
<h3 class="signature " id="box_model-instance_method">
|
1250
|
+
|
1251
|
+
#<strong>box_model</strong> ⇒ <tt><span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span>|nil</tt>
|
1252
|
+
|
1253
|
+
|
1254
|
+
|
1255
|
+
|
1256
|
+
|
1257
|
+
</h3><div class="docstring">
|
1258
|
+
<div class="discussion">
|
1259
|
+
|
1260
|
+
|
1261
|
+
</div>
|
1262
|
+
</div>
|
1263
|
+
<div class="tags">
|
1264
|
+
|
1265
|
+
<p class="tag_title">Returns:</p>
|
1266
|
+
<ul class="return">
|
1267
|
+
|
1268
|
+
<li>
|
1269
|
+
|
1270
|
+
|
1271
|
+
<span class='type'>(<tt><span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span>|nil</tt>)</span>
|
1272
|
+
|
1273
|
+
|
1274
|
+
|
1275
|
+
</li>
|
1276
|
+
|
1277
|
+
</ul>
|
1278
|
+
|
1279
|
+
</div><table class="source_code">
|
1280
|
+
<tr>
|
1281
|
+
<td>
|
1282
|
+
<pre class="lines">
|
1283
|
+
|
1284
|
+
|
1285
|
+
255
|
1286
|
+
256
|
1287
|
+
257
|
1288
|
+
258
|
1289
|
+
259</pre>
|
1290
|
+
</td>
|
1291
|
+
<td>
|
1292
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 255</span>
|
1293
|
+
|
1294
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_box_model'>box_model</span>
|
1295
|
+
<span class='id identifier rubyid_if_present'>if_present</span><span class='lparen'>(</span><span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_box_model'>box_model</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_result'>result</span><span class='op'>|</span>
|
1296
|
+
<span class='const'><span class='object_link'><a href="ElementHandle/BoxModel.html" title="Puppeteer::ElementHandle::BoxModel (class)">BoxModel</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/BoxModel.html#initialize-instance_method" title="Puppeteer::ElementHandle::BoxModel#initialize (method)">new</a></span></span><span class='lparen'>(</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'>model</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1297
|
+
<span class='kw'>end</span>
|
1298
|
+
<span class='kw'>end</span></pre>
|
1299
|
+
</td>
|
1300
|
+
</tr>
|
1301
|
+
</table>
|
1302
|
+
</div>
|
1303
|
+
|
1304
|
+
<div class="method_details ">
|
1305
|
+
<h3 class="signature " id="click-instance_method">
|
1306
|
+
|
1307
|
+
#<strong>click</strong>(delay: nil, button: nil, click_count: nil) ⇒ <tt>Object</tt>
|
1308
|
+
|
1309
|
+
|
1310
|
+
|
1311
|
+
|
1312
|
+
|
1313
|
+
</h3><div class="docstring">
|
1314
|
+
<div class="discussion">
|
1315
|
+
|
1316
|
+
|
1317
|
+
</div>
|
1318
|
+
</div>
|
1319
|
+
<div class="tags">
|
1320
|
+
<p class="tag_title">Parameters:</p>
|
1321
|
+
<ul class="param">
|
1322
|
+
|
1323
|
+
<li>
|
1324
|
+
|
1325
|
+
<span class='name'>delay</span>
|
1326
|
+
|
1327
|
+
|
1328
|
+
<span class='type'>(<tt>Number</tt>)</span>
|
1329
|
+
|
1330
|
+
|
1331
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1332
|
+
|
1333
|
+
|
1334
|
+
</li>
|
1335
|
+
|
1336
|
+
<li>
|
1337
|
+
|
1338
|
+
<span class='name'>button</span>
|
1339
|
+
|
1340
|
+
|
1341
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1342
|
+
|
1343
|
+
|
1344
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1345
|
+
|
1346
|
+
|
1347
|
+
—
|
1348
|
+
<div class='inline'>
|
1349
|
+
<p>“left”|“right”|“middle”</p>
|
1350
|
+
</div>
|
1351
|
+
|
1352
|
+
</li>
|
1353
|
+
|
1354
|
+
<li>
|
1355
|
+
|
1356
|
+
<span class='name'>click_count</span>
|
1357
|
+
|
1358
|
+
|
1359
|
+
<span class='type'>(<tt>Number</tt>)</span>
|
1360
|
+
|
1361
|
+
|
1362
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1363
|
+
|
1364
|
+
|
1365
|
+
</li>
|
1366
|
+
|
1367
|
+
</ul>
|
1368
|
+
|
1369
|
+
|
1370
|
+
</div><table class="source_code">
|
1371
|
+
<tr>
|
1372
|
+
<td>
|
1373
|
+
<pre class="lines">
|
1374
|
+
|
1375
|
+
|
1376
|
+
117
|
1377
|
+
118
|
1378
|
+
119
|
1379
|
+
120
|
1380
|
+
121</pre>
|
1381
|
+
</td>
|
1382
|
+
<td>
|
1383
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 117</span>
|
1384
|
+
|
1385
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_click'>click</span><span class='lparen'>(</span><span class='label'>delay:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>button:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>click_count:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1386
|
+
<span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
1387
|
+
<span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
|
1388
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_mouse'>mouse</span><span class='period'>.</span><span class='id identifier rubyid_click'>click</span><span class='lparen'>(</span><span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='comma'>,</span> <span class='label'>button:</span> <span class='id identifier rubyid_button'>button</span><span class='comma'>,</span> <span class='label'>click_count:</span> <span class='id identifier rubyid_click_count'>click_count</span><span class='rparen'>)</span>
|
1389
|
+
<span class='kw'>end</span></pre>
|
1390
|
+
</td>
|
1391
|
+
</tr>
|
1392
|
+
</table>
|
1393
|
+
</div>
|
1394
|
+
|
1395
|
+
<div class="method_details ">
|
1396
|
+
<h3 class="signature " id="clickable_point-instance_method">
|
1397
|
+
|
1398
|
+
#<strong>clickable_point</strong> ⇒ <tt>Object</tt>
|
1399
|
+
|
1400
|
+
|
1401
|
+
|
1402
|
+
|
1403
|
+
|
1404
|
+
</h3><table class="source_code">
|
1405
|
+
<tr>
|
1406
|
+
<td>
|
1407
|
+
<pre class="lines">
|
1408
|
+
|
1409
|
+
|
1410
|
+
64
|
1411
|
+
65
|
1412
|
+
66
|
1413
|
+
67
|
1414
|
+
68
|
1415
|
+
69
|
1416
|
+
70
|
1417
|
+
71
|
1418
|
+
72
|
1419
|
+
73
|
1420
|
+
74
|
1421
|
+
75
|
1422
|
+
76
|
1423
|
+
77
|
1424
|
+
78
|
1425
|
+
79
|
1426
|
+
80
|
1427
|
+
81
|
1428
|
+
82
|
1429
|
+
83
|
1430
|
+
84
|
1431
|
+
85</pre>
|
1432
|
+
</td>
|
1433
|
+
<td>
|
1434
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 64</span>
|
1435
|
+
|
1436
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
|
1437
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_content_quads'>content_quads</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span>
|
1438
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_result'>result</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'>quads</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1439
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotVisibleError#initialize (method)">new</a></span></span>
|
1440
|
+
<span class='kw'>end</span>
|
1441
|
+
|
1442
|
+
<span class='comment'># Filter out quads that have too small area to click into.
|
1443
|
+
</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span> <span class='op'>=</span> <span class='ivar'>@client</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'>Page.getLayoutMetrics</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1444
|
+
<span class='id identifier rubyid_client_width'>client_width</span> <span class='op'>=</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>clientWidth</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1445
|
+
<span class='id identifier rubyid_client_height'>client_height</span> <span class='op'>=</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>clientHeight</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1446
|
+
|
1447
|
+
<span class='id identifier rubyid_quads'>quads</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'>quads</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span>
|
1448
|
+
<span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_quad'>quad</span><span class='op'>|</span> <span class='id identifier rubyid_from_protocol_quad'>from_protocol_quad</span><span class='lparen'>(</span><span class='id identifier rubyid_quad'>quad</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span>
|
1449
|
+
<span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_quad'>quad</span><span class='op'>|</span> <span class='id identifier rubyid_intersect_quad_with_viewport'>intersect_quad_with_viewport</span><span class='lparen'>(</span><span class='id identifier rubyid_quad'>quad</span><span class='comma'>,</span> <span class='id identifier rubyid_client_width'>client_width</span><span class='comma'>,</span> <span class='id identifier rubyid_client_height'>client_height</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span>
|
1450
|
+
<span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_quad'>quad</span><span class='op'>|</span> <span class='id identifier rubyid_compute_quad_area'>compute_quad_area</span><span class='lparen'>(</span><span class='id identifier rubyid_quad'>quad</span><span class='rparen'>)</span> <span class='op'>></span> <span class='int'>1</span> <span class='rbrace'>}</span>
|
1451
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1452
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotVisibleError#initialize (method)">new</a></span></span>
|
1453
|
+
<span class='kw'>end</span>
|
1454
|
+
|
1455
|
+
<span class='comment'># Return the middle point of the first quad.
|
1456
|
+
</span> <span class='id identifier rubyid_quads'>quads</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='symbol'>:+</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='int'>4</span>
|
1457
|
+
<span class='kw'>end</span></pre>
|
1458
|
+
</td>
|
1459
|
+
</tr>
|
1460
|
+
</table>
|
1461
|
+
</div>
|
1462
|
+
|
1463
|
+
<div class="method_details ">
|
1464
|
+
<h3 class="signature " id="content_frame-instance_method">
|
1465
|
+
|
1466
|
+
#<strong>content_frame</strong> ⇒ <tt>Object</tt>
|
1467
|
+
|
1468
|
+
|
1469
|
+
|
1470
|
+
|
1471
|
+
|
1472
|
+
</h3><table class="source_code">
|
1473
|
+
<tr>
|
1474
|
+
<td>
|
1475
|
+
<pre class="lines">
|
1476
|
+
|
1477
|
+
|
1478
|
+
25
|
1479
|
+
26
|
1480
|
+
27
|
1481
|
+
28
|
1482
|
+
29
|
1483
|
+
30
|
1484
|
+
31
|
1485
|
+
32
|
1486
|
+
33</pre>
|
1487
|
+
</td>
|
1488
|
+
<td>
|
1489
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 25</span>
|
1490
|
+
|
1491
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_content_frame'>content_frame</span>
|
1492
|
+
<span class='id identifier rubyid_node_info'>node_info</span> <span class='op'>=</span> <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_node_info'>node_info</span>
|
1493
|
+
<span class='id identifier rubyid_frame_id'>frame_id</span> <span class='op'>=</span> <span class='id identifier rubyid_node_info'>node_info</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>node</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>frameId</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1494
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_frame_id'>frame_id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
1495
|
+
<span class='ivar'>@frame_manager</span><span class='period'>.</span><span class='id identifier rubyid_frame'>frame</span><span class='lparen'>(</span><span class='id identifier rubyid_frame_id'>frame_id</span><span class='rparen'>)</span>
|
1496
|
+
<span class='kw'>else</span>
|
1497
|
+
<span class='kw'>nil</span>
|
1498
|
+
<span class='kw'>end</span>
|
1499
|
+
<span class='kw'>end</span></pre>
|
1500
|
+
</td>
|
1501
|
+
</tr>
|
1502
|
+
</table>
|
1503
|
+
</div>
|
1504
|
+
|
1505
|
+
<div class="method_details ">
|
1506
|
+
<h3 class="signature " id="focus-instance_method">
|
1507
|
+
|
1508
|
+
#<strong>focus</strong> ⇒ <tt>Object</tt>
|
1509
|
+
|
1510
|
+
|
1511
|
+
|
1512
|
+
|
1513
|
+
|
1514
|
+
</h3><table class="source_code">
|
1515
|
+
<tr>
|
1516
|
+
<td>
|
1517
|
+
<pre class="lines">
|
1518
|
+
|
1519
|
+
|
1520
|
+
202
|
1521
|
+
203
|
1522
|
+
204</pre>
|
1523
|
+
</td>
|
1524
|
+
<td>
|
1525
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 202</span>
|
1526
|
+
|
1527
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_focus'>focus</span>
|
1528
|
+
<span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>element => element.focus()</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1529
|
+
<span class='kw'>end</span></pre>
|
1530
|
+
</td>
|
1531
|
+
</tr>
|
1532
|
+
</table>
|
1533
|
+
</div>
|
1534
|
+
|
1535
|
+
<div class="method_details ">
|
1536
|
+
<h3 class="signature " id="press-instance_method">
|
1537
|
+
|
1538
|
+
#<strong>press</strong>(key, delay: nil) ⇒ <tt>Object</tt>
|
1539
|
+
|
1540
|
+
|
1541
|
+
|
1542
|
+
|
1543
|
+
|
1544
|
+
</h3><div class="docstring">
|
1545
|
+
<div class="discussion">
|
1546
|
+
|
1547
|
+
|
1548
|
+
</div>
|
1549
|
+
</div>
|
1550
|
+
<div class="tags">
|
1551
|
+
<p class="tag_title">Parameters:</p>
|
1552
|
+
<ul class="param">
|
1553
|
+
|
1554
|
+
<li>
|
1555
|
+
|
1556
|
+
<span class='name'>key</span>
|
1557
|
+
|
1558
|
+
|
1559
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1560
|
+
|
1561
|
+
|
1562
|
+
|
1563
|
+
</li>
|
1564
|
+
|
1565
|
+
<li>
|
1566
|
+
|
1567
|
+
<span class='name'>delay</span>
|
1568
|
+
|
1569
|
+
|
1570
|
+
<span class='type'>(<tt>number|nil</tt>)</span>
|
1571
|
+
|
1572
|
+
|
1573
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1574
|
+
|
1575
|
+
|
1576
|
+
</li>
|
1577
|
+
|
1578
|
+
</ul>
|
1579
|
+
|
1580
|
+
|
1581
|
+
</div><table class="source_code">
|
1582
|
+
<tr>
|
1583
|
+
<td>
|
1584
|
+
<pre class="lines">
|
1585
|
+
|
1586
|
+
|
1587
|
+
226
|
1588
|
+
227
|
1589
|
+
228
|
1590
|
+
229</pre>
|
1591
|
+
</td>
|
1592
|
+
<td>
|
1593
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 226</span>
|
1594
|
+
|
1595
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_press'>press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1596
|
+
<span class='id identifier rubyid_focus'>focus</span>
|
1597
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_keyboard'>keyboard</span><span class='period'>.</span><span class='id identifier rubyid_press'>press</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
|
1598
|
+
<span class='kw'>end</span></pre>
|
1599
|
+
</td>
|
1600
|
+
</tr>
|
1601
|
+
</table>
|
1602
|
+
</div>
|
1603
|
+
|
1604
|
+
<div class="method_details ">
|
1605
|
+
<h3 class="signature " id="S-instance_method">
|
1606
|
+
|
1607
|
+
#<strong>S</strong>(selector) ⇒ <tt>Object</tt>
|
1608
|
+
|
1609
|
+
|
1610
|
+
|
1611
|
+
|
1612
|
+
|
1613
|
+
</h3><div class="docstring">
|
1614
|
+
<div class="discussion">
|
1615
|
+
|
1616
|
+
<p>`$()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
1617
|
+
|
1618
|
+
|
1619
|
+
</div>
|
1620
|
+
</div>
|
1621
|
+
<div class="tags">
|
1622
|
+
<p class="tag_title">Parameters:</p>
|
1623
|
+
<ul class="param">
|
1624
|
+
|
1625
|
+
<li>
|
1626
|
+
|
1627
|
+
<span class='name'>selector</span>
|
1628
|
+
|
1629
|
+
|
1630
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1631
|
+
|
1632
|
+
|
1633
|
+
|
1634
|
+
</li>
|
1635
|
+
|
1636
|
+
</ul>
|
1637
|
+
|
1638
|
+
|
1639
|
+
</div><table class="source_code">
|
1640
|
+
<tr>
|
1641
|
+
<td>
|
1642
|
+
<pre class="lines">
|
1643
|
+
|
1644
|
+
|
1645
|
+
312
|
1646
|
+
313
|
1647
|
+
314
|
1648
|
+
315
|
1649
|
+
316
|
1650
|
+
317
|
1651
|
+
318
|
1652
|
+
319
|
1653
|
+
320
|
1654
|
+
321
|
1655
|
+
322
|
1656
|
+
323
|
1657
|
+
324</pre>
|
1658
|
+
</td>
|
1659
|
+
<td>
|
1660
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 312</span>
|
1661
|
+
|
1662
|
+
<span class='kw'>def</span> <span class='const'>S</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
1663
|
+
<span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
|
1664
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(element, selector) => element.querySelector(selector)</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
1665
|
+
<span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span>
|
1666
|
+
<span class='rparen'>)</span>
|
1667
|
+
<span class='id identifier rubyid_element'>element</span> <span class='op'>=</span> <span class='id identifier rubyid_handle'>handle</span><span class='period'>.</span><span class='id identifier rubyid_as_element'>as_element</span>
|
1668
|
+
|
1669
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span>
|
1670
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_element'>element</span>
|
1671
|
+
<span class='kw'>end</span>
|
1672
|
+
<span class='id identifier rubyid_handle'>handle</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
1673
|
+
<span class='kw'>nil</span>
|
1674
|
+
<span class='kw'>end</span></pre>
|
1675
|
+
</td>
|
1676
|
+
</tr>
|
1677
|
+
</table>
|
1678
|
+
</div>
|
1679
|
+
|
1680
|
+
<div class="method_details ">
|
1681
|
+
<h3 class="signature " id="screenshot-instance_method">
|
1682
|
+
|
1683
|
+
#<strong>screenshot</strong>(options = {}) ⇒ <tt>Object</tt>
|
1684
|
+
|
1685
|
+
|
1686
|
+
|
1687
|
+
|
1688
|
+
|
1689
|
+
</h3><table class="source_code">
|
1690
|
+
<tr>
|
1691
|
+
<td>
|
1692
|
+
<pre class="lines">
|
1693
|
+
|
1694
|
+
|
1695
|
+
261
|
1696
|
+
262
|
1697
|
+
263
|
1698
|
+
264
|
1699
|
+
265
|
1700
|
+
266
|
1701
|
+
267
|
1702
|
+
268
|
1703
|
+
269
|
1704
|
+
270
|
1705
|
+
271
|
1706
|
+
272
|
1707
|
+
273
|
1708
|
+
274
|
1709
|
+
275
|
1710
|
+
276
|
1711
|
+
277
|
1712
|
+
278
|
1713
|
+
279
|
1714
|
+
280
|
1715
|
+
281
|
1716
|
+
282
|
1717
|
+
283
|
1718
|
+
284
|
1719
|
+
285
|
1720
|
+
286
|
1721
|
+
287
|
1722
|
+
288
|
1723
|
+
289
|
1724
|
+
290
|
1725
|
+
291
|
1726
|
+
292
|
1727
|
+
293
|
1728
|
+
294
|
1729
|
+
295
|
1730
|
+
296
|
1731
|
+
297
|
1732
|
+
298
|
1733
|
+
299
|
1734
|
+
300
|
1735
|
+
301
|
1736
|
+
302
|
1737
|
+
303
|
1738
|
+
304
|
1739
|
+
305
|
1740
|
+
306
|
1741
|
+
307
|
1742
|
+
308</pre>
|
1743
|
+
</td>
|
1744
|
+
<td>
|
1745
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 261</span>
|
1746
|
+
|
1747
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_screenshot'>screenshot</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1748
|
+
<span class='id identifier rubyid_needs_viewport_reset'>needs_viewport_reset</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1749
|
+
|
1750
|
+
<span class='id identifier rubyid_box'>box</span> <span class='op'>=</span> <span class='id identifier rubyid_bounding_box'>bounding_box</span>
|
1751
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_box'>box</span>
|
1752
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotVisibleError#initialize (method)">new</a></span></span>
|
1753
|
+
<span class='kw'>end</span>
|
1754
|
+
|
1755
|
+
<span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>=</span> <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_viewport'>viewport</span>
|
1756
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span> <span class='op'>></span> <span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span> <span class='op'>||</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span> <span class='op'>></span> <span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='rparen'>)</span>
|
1757
|
+
<span class='id identifier rubyid_new_viewport'>new_viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span>
|
1758
|
+
<span class='label'>width:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span>
|
1759
|
+
<span class='label'>height:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_viewport'>viewport</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='comma'>,</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span>
|
1760
|
+
<span class='rparen'>)</span>
|
1761
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_new_viewport'>new_viewport</span>
|
1762
|
+
|
1763
|
+
<span class='id identifier rubyid_needs_viewport_reset'>needs_viewport_reset</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1764
|
+
<span class='kw'>end</span>
|
1765
|
+
<span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
1766
|
+
|
1767
|
+
<span class='id identifier rubyid_box'>box</span> <span class='op'>=</span> <span class='id identifier rubyid_bounding_box'>bounding_box</span>
|
1768
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_box'>box</span>
|
1769
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html" title="Puppeteer::ElementHandle::ElementNotVisibleError (class)">ElementNotVisibleError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotVisibleError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotVisibleError#initialize (method)">new</a></span></span>
|
1770
|
+
<span class='kw'>end</span>
|
1771
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span> <span class='op'>==</span> <span class='int'>0</span>
|
1772
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Node has 0 width.</span><span class='tstring_end'>'</span></span>
|
1773
|
+
<span class='kw'>end</span>
|
1774
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span> <span class='op'>==</span> <span class='int'>0</span>
|
1775
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Node has 0 height.</span><span class='tstring_end'>'</span></span>
|
1776
|
+
<span class='kw'>end</span>
|
1777
|
+
|
1778
|
+
<span class='id identifier rubyid_layout_metrics'>layout_metrics</span> <span class='op'>=</span> <span class='ivar'>@client</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'>Page.getLayoutMetrics</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1779
|
+
<span class='id identifier rubyid_page_x'>page_x</span> <span class='op'>=</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pageX</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1780
|
+
<span class='id identifier rubyid_page_y'>page_y</span> <span class='op'>=</span> <span class='id identifier rubyid_layout_metrics'>layout_metrics</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>layoutViewport</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pageY</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1781
|
+
|
1782
|
+
<span class='id identifier rubyid_clip'>clip</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1783
|
+
<span class='label'>x:</span> <span class='id identifier rubyid_page_x'>page_x</span> <span class='op'>+</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span>
|
1784
|
+
<span class='label'>y:</span> <span class='id identifier rubyid_page_y'>page_y</span> <span class='op'>+</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='comma'>,</span>
|
1785
|
+
<span class='label'>width:</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span>
|
1786
|
+
<span class='label'>height:</span> <span class='id identifier rubyid_box'>box</span><span class='period'>.</span><span class='id identifier rubyid_height'>height</span><span class='comma'>,</span>
|
1787
|
+
<span class='rbrace'>}</span>
|
1788
|
+
|
1789
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_screenshot'>screenshot</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='label'>clip:</span> <span class='id identifier rubyid_clip'>clip</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1790
|
+
<span class='kw'>ensure</span>
|
1791
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_needs_viewport_reset'>needs_viewport_reset</span>
|
1792
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_viewport'>viewport</span> <span class='op'>=</span> <span class='id identifier rubyid_viewport'>viewport</span>
|
1793
|
+
<span class='kw'>end</span>
|
1794
|
+
<span class='kw'>end</span></pre>
|
1795
|
+
</td>
|
1796
|
+
</tr>
|
1797
|
+
</table>
|
1798
|
+
</div>
|
1799
|
+
|
1800
|
+
<div class="method_details ">
|
1801
|
+
<h3 class="signature " id="scroll_into_view_if_needed-instance_method">
|
1802
|
+
|
1803
|
+
#<strong>scroll_into_view_if_needed</strong> ⇒ <tt>Object</tt>
|
1804
|
+
|
1805
|
+
|
1806
|
+
|
1807
|
+
|
1808
|
+
|
1809
|
+
</h3><table class="source_code">
|
1810
|
+
<tr>
|
1811
|
+
<td>
|
1812
|
+
<pre class="lines">
|
1813
|
+
|
1814
|
+
|
1815
|
+
37
|
1816
|
+
38
|
1817
|
+
39
|
1818
|
+
40
|
1819
|
+
41
|
1820
|
+
42
|
1821
|
+
43
|
1822
|
+
44
|
1823
|
+
45
|
1824
|
+
46
|
1825
|
+
47
|
1826
|
+
48
|
1827
|
+
49
|
1828
|
+
50
|
1829
|
+
51
|
1830
|
+
52
|
1831
|
+
53
|
1832
|
+
54
|
1833
|
+
55
|
1834
|
+
56</pre>
|
1835
|
+
</td>
|
1836
|
+
<td>
|
1837
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 37</span>
|
1838
|
+
|
1839
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
1840
|
+
<span class='id identifier rubyid_js'>js</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
1841
|
+
<span class='tstring_content'> async(element, pageJavascriptEnabled) => {
|
1842
|
+
</span><span class='tstring_content'> if (!element.isConnected)
|
1843
|
+
</span><span class='tstring_content'> return 'Node is detached from document';
|
1844
|
+
</span><span class='tstring_content'> if (element.nodeType !== Node.ELEMENT_NODE)
|
1845
|
+
</span><span class='tstring_content'> return 'Node is not of type HTMLElement';
|
1846
|
+
</span><span class='tstring_content'>
|
1847
|
+
</span><span class='tstring_content'> element.scrollIntoViewIfNeeded({block: 'center', inline: 'center', behavior: 'instant'});
|
1848
|
+
</span><span class='tstring_content'> return false;
|
1849
|
+
</span><span class='tstring_content'> }
|
1850
|
+
</span><span class='heredoc_end'> JAVASCRIPT
|
1851
|
+
</span> <span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_js'>js</span><span class='comma'>,</span> <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_javascript_enabled'>javascript_enabled</span><span class='rparen'>)</span> <span class='comment'># returns String or false
|
1852
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_error'>error</span>
|
1853
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ScrollIntoViewError.html" title="Puppeteer::ElementHandle::ScrollIntoViewError (class)">ScrollIntoViewError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Puppeteer::ElementHandle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
|
1854
|
+
<span class='kw'>end</span>
|
1855
|
+
<span class='comment'># clickpoint is often calculated before scrolling is completed.
|
1856
|
+
</span> <span class='comment'># So, just sleep about 10 frames
|
1857
|
+
</span> <span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.16</span>
|
1858
|
+
<span class='kw'>end</span></pre>
|
1859
|
+
</td>
|
1860
|
+
</tr>
|
1861
|
+
</table>
|
1862
|
+
</div>
|
1863
|
+
|
1864
|
+
<div class="method_details ">
|
1865
|
+
<h3 class="signature " id="select-instance_method">
|
1866
|
+
|
1867
|
+
#<strong>select</strong>(*values) ⇒ <tt>Array<String></tt>
|
1868
|
+
|
1869
|
+
|
1870
|
+
|
1871
|
+
|
1872
|
+
|
1873
|
+
</h3><div class="docstring">
|
1874
|
+
<div class="discussion">
|
1875
|
+
|
1876
|
+
|
1877
|
+
</div>
|
1878
|
+
</div>
|
1879
|
+
<div class="tags">
|
1880
|
+
|
1881
|
+
<p class="tag_title">Returns:</p>
|
1882
|
+
<ul class="return">
|
1883
|
+
|
1884
|
+
<li>
|
1885
|
+
|
1886
|
+
|
1887
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
1888
|
+
|
1889
|
+
|
1890
|
+
|
1891
|
+
</li>
|
1892
|
+
|
1893
|
+
</ul>
|
1894
|
+
|
1895
|
+
</div><table class="source_code">
|
1896
|
+
<tr>
|
1897
|
+
<td>
|
1898
|
+
<pre class="lines">
|
1899
|
+
|
1900
|
+
|
1901
|
+
131
|
1902
|
+
132
|
1903
|
+
133
|
1904
|
+
134
|
1905
|
+
135
|
1906
|
+
136
|
1907
|
+
137
|
1908
|
+
138
|
1909
|
+
139
|
1910
|
+
140
|
1911
|
+
141
|
1912
|
+
142
|
1913
|
+
143
|
1914
|
+
144
|
1915
|
+
145
|
1916
|
+
146
|
1917
|
+
147
|
1918
|
+
148
|
1919
|
+
149
|
1920
|
+
150
|
1921
|
+
151
|
1922
|
+
152
|
1923
|
+
153
|
1924
|
+
154
|
1925
|
+
155
|
1926
|
+
156</pre>
|
1927
|
+
</td>
|
1928
|
+
<td>
|
1929
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 131</span>
|
1930
|
+
|
1931
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
|
1932
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_nonstring'>nonstring</span> <span class='op'>=</span> <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='op'>!</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1933
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Values must be strings. Found value \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nonstring'>nonstring</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" of type \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nonstring'>nonstring</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1934
|
+
<span class='kw'>end</span>
|
1935
|
+
|
1936
|
+
<span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
1937
|
+
<span class='tstring_content'> (element, values) => {
|
1938
|
+
</span><span class='tstring_content'> if (element.nodeName.toLowerCase() !== 'select') {
|
1939
|
+
</span><span class='tstring_content'> throw new Error('Element is not a <select> element.');
|
1940
|
+
</span><span class='tstring_content'> }
|
1941
|
+
</span><span class='tstring_content'>
|
1942
|
+
</span><span class='tstring_content'> const options = Array.from(element.options);
|
1943
|
+
</span><span class='tstring_content'> element.value = undefined;
|
1944
|
+
</span><span class='tstring_content'> for (const option of options) {
|
1945
|
+
</span><span class='tstring_content'> option.selected = values.includes(option.value);
|
1946
|
+
</span><span class='tstring_content'> if (option.selected && !element.multiple) {
|
1947
|
+
</span><span class='tstring_content'> break;
|
1948
|
+
</span><span class='tstring_content'> }
|
1949
|
+
</span><span class='tstring_content'> }
|
1950
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('input', { bubbles: true }));
|
1951
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('change', { bubbles: true }));
|
1952
|
+
</span><span class='tstring_content'> return options.filter(option => option.selected).map(option => option.value);
|
1953
|
+
</span><span class='tstring_content'> }
|
1954
|
+
</span><span class='heredoc_end'> JAVASCRIPT
|
1955
|
+
</span> <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_fn'>fn</span><span class='comma'>,</span> <span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
|
1956
|
+
<span class='kw'>end</span></pre>
|
1957
|
+
</td>
|
1958
|
+
</tr>
|
1959
|
+
</table>
|
1960
|
+
</div>
|
1961
|
+
|
1962
|
+
<div class="method_details ">
|
1963
|
+
<h3 class="signature " id="Seval-instance_method">
|
1964
|
+
|
1965
|
+
#<strong>Seval</strong>(selector, page_function, *args) ⇒ <tt>Object</tt>
|
1966
|
+
|
1967
|
+
|
1968
|
+
|
1969
|
+
|
1970
|
+
|
1971
|
+
</h3><div class="docstring">
|
1972
|
+
<div class="discussion">
|
1973
|
+
|
1974
|
+
<p>`$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
1975
|
+
|
1976
|
+
|
1977
|
+
</div>
|
1978
|
+
</div>
|
1979
|
+
<div class="tags">
|
1980
|
+
<p class="tag_title">Parameters:</p>
|
1981
|
+
<ul class="param">
|
1982
|
+
|
1983
|
+
<li>
|
1984
|
+
|
1985
|
+
<span class='name'>selector</span>
|
1986
|
+
|
1987
|
+
|
1988
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1989
|
+
|
1990
|
+
|
1991
|
+
|
1992
|
+
</li>
|
1993
|
+
|
1994
|
+
<li>
|
1995
|
+
|
1996
|
+
<span class='name'>page_function</span>
|
1997
|
+
|
1998
|
+
|
1999
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2000
|
+
|
2001
|
+
|
2002
|
+
|
2003
|
+
</li>
|
2004
|
+
|
2005
|
+
</ul>
|
2006
|
+
|
2007
|
+
<p class="tag_title">Returns:</p>
|
2008
|
+
<ul class="return">
|
2009
|
+
|
2010
|
+
<li>
|
2011
|
+
|
2012
|
+
|
2013
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
2014
|
+
|
2015
|
+
|
2016
|
+
|
2017
|
+
</li>
|
2018
|
+
|
2019
|
+
</ul>
|
2020
|
+
|
2021
|
+
</div><table class="source_code">
|
2022
|
+
<tr>
|
2023
|
+
<td>
|
2024
|
+
<pre class="lines">
|
2025
|
+
|
2026
|
+
|
2027
|
+
348
|
2028
|
+
349
|
2029
|
+
350
|
2030
|
+
351
|
2031
|
+
352
|
2032
|
+
353
|
2033
|
+
354
|
2034
|
+
355
|
2035
|
+
356
|
2036
|
+
357</pre>
|
2037
|
+
</td>
|
2038
|
+
<td>
|
2039
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 348</span>
|
2040
|
+
|
2041
|
+
<span class='kw'>def</span> <span class='const'>Seval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
2042
|
+
<span class='id identifier rubyid_element_handle'>element_handle</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#S-instance_method" title="Puppeteer::ElementHandle#S (method)">S</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
2043
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_element_handle'>element_handle</span>
|
2044
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ElementHandle/ElementNotFoundError.html" title="Puppeteer::ElementHandle::ElementNotFoundError (class)">ElementNotFoundError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ElementHandle/ElementNotFoundError.html#initialize-instance_method" title="Puppeteer::ElementHandle::ElementNotFoundError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
2045
|
+
<span class='kw'>end</span>
|
2046
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_element_handle'>element_handle</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
2047
|
+
<span class='id identifier rubyid_element_handle'>element_handle</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
2048
|
+
|
2049
|
+
<span class='id identifier rubyid_result'>result</span>
|
2050
|
+
<span class='kw'>end</span></pre>
|
2051
|
+
</td>
|
2052
|
+
</tr>
|
2053
|
+
</table>
|
2054
|
+
</div>
|
2055
|
+
|
2056
|
+
<div class="method_details ">
|
2057
|
+
<h3 class="signature " id="SS-instance_method">
|
2058
|
+
|
2059
|
+
#<strong>SS</strong>(selector) ⇒ <tt>Object</tt>
|
2060
|
+
|
2061
|
+
|
2062
|
+
|
2063
|
+
|
2064
|
+
|
2065
|
+
</h3><div class="docstring">
|
2066
|
+
<div class="discussion">
|
2067
|
+
|
2068
|
+
<p>`$$()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
2069
|
+
|
2070
|
+
|
2071
|
+
</div>
|
2072
|
+
</div>
|
2073
|
+
<div class="tags">
|
2074
|
+
<p class="tag_title">Parameters:</p>
|
2075
|
+
<ul class="param">
|
2076
|
+
|
2077
|
+
<li>
|
2078
|
+
|
2079
|
+
<span class='name'>selector</span>
|
2080
|
+
|
2081
|
+
|
2082
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2083
|
+
|
2084
|
+
|
2085
|
+
|
2086
|
+
</li>
|
2087
|
+
|
2088
|
+
</ul>
|
2089
|
+
|
2090
|
+
|
2091
|
+
</div><table class="source_code">
|
2092
|
+
<tr>
|
2093
|
+
<td>
|
2094
|
+
<pre class="lines">
|
2095
|
+
|
2096
|
+
|
2097
|
+
328
|
2098
|
+
329
|
2099
|
+
330
|
2100
|
+
331
|
2101
|
+
332
|
2102
|
+
333
|
2103
|
+
334
|
2104
|
+
335
|
2105
|
+
336</pre>
|
2106
|
+
</td>
|
2107
|
+
<td>
|
2108
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 328</span>
|
2109
|
+
|
2110
|
+
<span class='kw'>def</span> <span class='const'>SS</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
2111
|
+
<span class='id identifier rubyid_handles'>handles</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
|
2112
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(element, selector) => element.querySelectorAll(selector)</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2113
|
+
<span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span>
|
2114
|
+
<span class='rparen'>)</span>
|
2115
|
+
<span class='id identifier rubyid_properties'>properties</span> <span class='op'>=</span> <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span>
|
2116
|
+
<span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
2117
|
+
<span class='id identifier rubyid_properties'>properties</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:as_element</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
|
2118
|
+
<span class='kw'>end</span></pre>
|
2119
|
+
</td>
|
2120
|
+
</tr>
|
2121
|
+
</table>
|
2122
|
+
</div>
|
2123
|
+
|
2124
|
+
<div class="method_details ">
|
2125
|
+
<h3 class="signature " id="SSeval-instance_method">
|
2126
|
+
|
2127
|
+
#<strong>SSeval</strong>(selector, page_function, *args) ⇒ <tt>Object</tt>
|
2128
|
+
|
2129
|
+
|
2130
|
+
|
2131
|
+
|
2132
|
+
|
2133
|
+
</h3><div class="docstring">
|
2134
|
+
<div class="discussion">
|
2135
|
+
|
2136
|
+
<p>`$$eval()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
2137
|
+
|
2138
|
+
|
2139
|
+
</div>
|
2140
|
+
</div>
|
2141
|
+
<div class="tags">
|
2142
|
+
<p class="tag_title">Parameters:</p>
|
2143
|
+
<ul class="param">
|
2144
|
+
|
2145
|
+
<li>
|
2146
|
+
|
2147
|
+
<span class='name'>selector</span>
|
2148
|
+
|
2149
|
+
|
2150
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2151
|
+
|
2152
|
+
|
2153
|
+
|
2154
|
+
</li>
|
2155
|
+
|
2156
|
+
<li>
|
2157
|
+
|
2158
|
+
<span class='name'>page_function</span>
|
2159
|
+
|
2160
|
+
|
2161
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2162
|
+
|
2163
|
+
|
2164
|
+
|
2165
|
+
</li>
|
2166
|
+
|
2167
|
+
</ul>
|
2168
|
+
|
2169
|
+
<p class="tag_title">Returns:</p>
|
2170
|
+
<ul class="return">
|
2171
|
+
|
2172
|
+
<li>
|
2173
|
+
|
2174
|
+
|
2175
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
2176
|
+
|
2177
|
+
|
2178
|
+
|
2179
|
+
</li>
|
2180
|
+
|
2181
|
+
</ul>
|
2182
|
+
|
2183
|
+
</div><table class="source_code">
|
2184
|
+
<tr>
|
2185
|
+
<td>
|
2186
|
+
<pre class="lines">
|
2187
|
+
|
2188
|
+
|
2189
|
+
371
|
2190
|
+
372
|
2191
|
+
373
|
2192
|
+
374
|
2193
|
+
375
|
2194
|
+
376
|
2195
|
+
377
|
2196
|
+
378
|
2197
|
+
379
|
2198
|
+
380</pre>
|
2199
|
+
</td>
|
2200
|
+
<td>
|
2201
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 371</span>
|
2202
|
+
|
2203
|
+
<span class='kw'>def</span> <span class='const'>SSeval</span><span class='lparen'>(</span><span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
2204
|
+
<span class='id identifier rubyid_handles'>handles</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span>
|
2205
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(element, selector) => Array.from(element.querySelectorAll(selector))</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2206
|
+
<span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span>
|
2207
|
+
<span class='rparen'>)</span>
|
2208
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_page_function'>page_function</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
2209
|
+
<span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
2210
|
+
|
2211
|
+
<span class='id identifier rubyid_result'>result</span>
|
2212
|
+
<span class='kw'>end</span></pre>
|
2213
|
+
</td>
|
2214
|
+
</tr>
|
2215
|
+
</table>
|
2216
|
+
</div>
|
2217
|
+
|
2218
|
+
<div class="method_details ">
|
2219
|
+
<h3 class="signature " id="Sx-instance_method">
|
2220
|
+
|
2221
|
+
#<strong>Sx</strong>(expression) ⇒ <tt>Array<<span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span>></tt>
|
2222
|
+
|
2223
|
+
|
2224
|
+
|
2225
|
+
|
2226
|
+
|
2227
|
+
</h3><div class="docstring">
|
2228
|
+
<div class="discussion">
|
2229
|
+
|
2230
|
+
<p>`$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.</p>
|
2231
|
+
|
2232
|
+
|
2233
|
+
</div>
|
2234
|
+
</div>
|
2235
|
+
<div class="tags">
|
2236
|
+
<p class="tag_title">Parameters:</p>
|
2237
|
+
<ul class="param">
|
2238
|
+
|
2239
|
+
<li>
|
2240
|
+
|
2241
|
+
<span class='name'>expression</span>
|
2242
|
+
|
2243
|
+
|
2244
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2245
|
+
|
2246
|
+
|
2247
|
+
|
2248
|
+
</li>
|
2249
|
+
|
2250
|
+
</ul>
|
2251
|
+
|
2252
|
+
<p class="tag_title">Returns:</p>
|
2253
|
+
<ul class="return">
|
2254
|
+
|
2255
|
+
<li>
|
2256
|
+
|
2257
|
+
|
2258
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="" title="Puppeteer::ElementHandle (class)">ElementHandle</a></span>></tt>)</span>
|
2259
|
+
|
2260
|
+
|
2261
|
+
|
2262
|
+
</li>
|
2263
|
+
|
2264
|
+
</ul>
|
2265
|
+
|
2266
|
+
</div><table class="source_code">
|
2267
|
+
<tr>
|
2268
|
+
<td>
|
2269
|
+
<pre class="lines">
|
2270
|
+
|
2271
|
+
|
2272
|
+
393
|
2273
|
+
394
|
2274
|
+
395
|
2275
|
+
396
|
2276
|
+
397
|
2277
|
+
398
|
2278
|
+
399
|
2279
|
+
400
|
2280
|
+
401
|
2281
|
+
402
|
2282
|
+
403
|
2283
|
+
404
|
2284
|
+
405
|
2285
|
+
406
|
2286
|
+
407
|
2287
|
+
408
|
2288
|
+
409</pre>
|
2289
|
+
</td>
|
2290
|
+
<td>
|
2291
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 393</span>
|
2292
|
+
|
2293
|
+
<span class='kw'>def</span> <span class='const'>Sx</span><span class='lparen'>(</span><span class='id identifier rubyid_expression'>expression</span><span class='rparen'>)</span>
|
2294
|
+
<span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
2295
|
+
<span class='tstring_content'> (element, expression) => {
|
2296
|
+
</span><span class='tstring_content'> const document = element.ownerDocument || element;
|
2297
|
+
</span><span class='tstring_content'> const iterator = document.evaluate(expression, element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
|
2298
|
+
</span><span class='tstring_content'> const array = [];
|
2299
|
+
</span><span class='tstring_content'> let item;
|
2300
|
+
</span><span class='tstring_content'> while ((item = iterator.iterateNext()))
|
2301
|
+
</span><span class='tstring_content'> array.push(item);
|
2302
|
+
</span><span class='tstring_content'> return array;
|
2303
|
+
</span><span class='tstring_content'> }
|
2304
|
+
</span><span class='heredoc_end'> JAVASCRIPT
|
2305
|
+
</span> <span class='id identifier rubyid_handles'>handles</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate_handle'>evaluate_handle</span><span class='lparen'>(</span><span class='id identifier rubyid_fn'>fn</span><span class='comma'>,</span> <span class='id identifier rubyid_expression'>expression</span><span class='rparen'>)</span>
|
2306
|
+
<span class='id identifier rubyid_properties'>properties</span> <span class='op'>=</span> <span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span>
|
2307
|
+
<span class='id identifier rubyid_handles'>handles</span><span class='period'>.</span><span class='id identifier rubyid_dispose'>dispose</span>
|
2308
|
+
<span class='id identifier rubyid_properties'>properties</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:as_element</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
|
2309
|
+
<span class='kw'>end</span></pre>
|
2310
|
+
</td>
|
2311
|
+
</tr>
|
2312
|
+
</table>
|
2313
|
+
</div>
|
2314
|
+
|
2315
|
+
<div class="method_details ">
|
2316
|
+
<h3 class="signature " id="tap-instance_method">
|
2317
|
+
|
2318
|
+
#<strong>tap</strong>(&block) ⇒ <tt>Object</tt>
|
2319
|
+
|
2320
|
+
|
2321
|
+
|
2322
|
+
|
2323
|
+
|
2324
|
+
</h3><table class="source_code">
|
2325
|
+
<tr>
|
2326
|
+
<td>
|
2327
|
+
<pre class="lines">
|
2328
|
+
|
2329
|
+
|
2330
|
+
190
|
2331
|
+
191
|
2332
|
+
192
|
2333
|
+
193
|
2334
|
+
194
|
2335
|
+
195
|
2336
|
+
196</pre>
|
2337
|
+
</td>
|
2338
|
+
<td>
|
2339
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 190</span>
|
2340
|
+
|
2341
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2342
|
+
<span class='kw'>return</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
|
2343
|
+
|
2344
|
+
<span class='id identifier rubyid_scroll_into_view_if_needed'>scroll_into_view_if_needed</span>
|
2345
|
+
<span class='id identifier rubyid_point'>point</span> <span class='op'>=</span> <span class='id identifier rubyid_clickable_point'>clickable_point</span>
|
2346
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_touchscreen'>touchscreen</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_point'>point</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='rparen'>)</span>
|
2347
|
+
<span class='kw'>end</span></pre>
|
2348
|
+
</td>
|
2349
|
+
</tr>
|
2350
|
+
</table>
|
2351
|
+
</div>
|
2352
|
+
|
2353
|
+
<div class="method_details ">
|
2354
|
+
<h3 class="signature " id="type_text-instance_method">
|
2355
|
+
|
2356
|
+
#<strong>type_text</strong>(text, delay: nil) ⇒ <tt>Object</tt>
|
2357
|
+
|
2358
|
+
|
2359
|
+
|
2360
|
+
|
2361
|
+
|
2362
|
+
</h3><div class="docstring">
|
2363
|
+
<div class="discussion">
|
2364
|
+
|
2365
|
+
|
2366
|
+
</div>
|
2367
|
+
</div>
|
2368
|
+
<div class="tags">
|
2369
|
+
<p class="tag_title">Parameters:</p>
|
2370
|
+
<ul class="param">
|
2371
|
+
|
2372
|
+
<li>
|
2373
|
+
|
2374
|
+
<span class='name'>text</span>
|
2375
|
+
|
2376
|
+
|
2377
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2378
|
+
|
2379
|
+
|
2380
|
+
|
2381
|
+
</li>
|
2382
|
+
|
2383
|
+
<li>
|
2384
|
+
|
2385
|
+
<span class='name'>delay</span>
|
2386
|
+
|
2387
|
+
|
2388
|
+
<span class='type'>(<tt>number|nil</tt>)</span>
|
2389
|
+
|
2390
|
+
|
2391
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2392
|
+
|
2393
|
+
|
2394
|
+
</li>
|
2395
|
+
|
2396
|
+
</ul>
|
2397
|
+
|
2398
|
+
|
2399
|
+
</div><table class="source_code">
|
2400
|
+
<tr>
|
2401
|
+
<td>
|
2402
|
+
<pre class="lines">
|
2403
|
+
|
2404
|
+
|
2405
|
+
212
|
2406
|
+
213
|
2407
|
+
214
|
2408
|
+
215</pre>
|
2409
|
+
</td>
|
2410
|
+
<td>
|
2411
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 212</span>
|
2412
|
+
|
2413
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2414
|
+
<span class='id identifier rubyid_focus'>focus</span>
|
2415
|
+
<span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_keyboard'>keyboard</span><span class='period'>.</span><span class='id identifier rubyid_type_text'>type_text</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='label'>delay:</span> <span class='id identifier rubyid_delay'>delay</span><span class='rparen'>)</span>
|
2416
|
+
<span class='kw'>end</span></pre>
|
2417
|
+
</td>
|
2418
|
+
</tr>
|
2419
|
+
</table>
|
2420
|
+
</div>
|
2421
|
+
|
2422
|
+
<div class="method_details ">
|
2423
|
+
<h3 class="signature " id="upload_file-instance_method">
|
2424
|
+
|
2425
|
+
#<strong>upload_file</strong>(*file_paths) ⇒ <tt>Object</tt>
|
2426
|
+
|
2427
|
+
|
2428
|
+
|
2429
|
+
|
2430
|
+
|
2431
|
+
</h3><div class="docstring">
|
2432
|
+
<div class="discussion">
|
2433
|
+
|
2434
|
+
|
2435
|
+
</div>
|
2436
|
+
</div>
|
2437
|
+
<div class="tags">
|
2438
|
+
<p class="tag_title">Parameters:</p>
|
2439
|
+
<ul class="param">
|
2440
|
+
|
2441
|
+
<li>
|
2442
|
+
|
2443
|
+
<span class='name'>file_paths</span>
|
2444
|
+
|
2445
|
+
|
2446
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
2447
|
+
|
2448
|
+
|
2449
|
+
|
2450
|
+
</li>
|
2451
|
+
|
2452
|
+
</ul>
|
2453
|
+
|
2454
|
+
|
2455
|
+
</div><table class="source_code">
|
2456
|
+
<tr>
|
2457
|
+
<td>
|
2458
|
+
<pre class="lines">
|
2459
|
+
|
2460
|
+
|
2461
|
+
159
|
2462
|
+
160
|
2463
|
+
161
|
2464
|
+
162
|
2465
|
+
163
|
2466
|
+
164
|
2467
|
+
165
|
2468
|
+
166
|
2469
|
+
167
|
2470
|
+
168
|
2471
|
+
169
|
2472
|
+
170
|
2473
|
+
171
|
2474
|
+
172
|
2475
|
+
173
|
2476
|
+
174
|
2477
|
+
175
|
2478
|
+
176
|
2479
|
+
177
|
2480
|
+
178
|
2481
|
+
179
|
2482
|
+
180
|
2483
|
+
181
|
2484
|
+
182
|
2485
|
+
183
|
2486
|
+
184
|
2487
|
+
185
|
2488
|
+
186
|
2489
|
+
187
|
2490
|
+
188</pre>
|
2491
|
+
</td>
|
2492
|
+
<td>
|
2493
|
+
<pre class="code"><span class="info file"># File 'lib/puppeteer/element_handle.rb', line 159</span>
|
2494
|
+
|
2495
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_upload_file'>upload_file</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_file_paths'>file_paths</span><span class='rparen'>)</span>
|
2496
|
+
<span class='id identifier rubyid_is_multiple'>is_multiple</span> <span class='op'>=</span> <span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>el => el.multiple</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2497
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_is_multiple'>is_multiple</span> <span class='op'>&&</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>>=</span> <span class='int'>2</span>
|
2498
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Multiple file uploads only work with <input type=file multiple></span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2499
|
+
<span class='kw'>end</span>
|
2500
|
+
|
2501
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_error_path'>error_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_file_path'>file_path</span><span class='op'>|</span> <span class='op'>!</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
2502
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgmentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error_path'>error_path</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not exist or is not readable</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2503
|
+
<span class='kw'>end</span>
|
2504
|
+
|
2505
|
+
<span class='id identifier rubyid_backend_node_id'>backend_node_id</span> <span class='op'>=</span> <span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_node_info'>node_info</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>backendNodeId</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
2506
|
+
|
2507
|
+
<span class='comment'># The zero-length array is a special case, it seems that DOM.setFileInputFiles does
|
2508
|
+
</span> <span class='comment'># not actually update the files in that case, so the solution is to eval the element
|
2509
|
+
</span> <span class='comment'># value to a new FileList directly.
|
2510
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
2511
|
+
<span class='id identifier rubyid_fn'>fn</span> <span class='op'>=</span> <span class='heredoc_beg'><<~JAVASCRIPT</span>
|
2512
|
+
<span class='tstring_content'> (element) => {
|
2513
|
+
</span><span class='tstring_content'> element.files = new DataTransfer().files;
|
2514
|
+
</span><span class='tstring_content'>
|
2515
|
+
</span><span class='tstring_content'> // Dispatch events for this case because it should behave akin to a user action.
|
2516
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('input', { bubbles: true }));
|
2517
|
+
</span><span class='tstring_content'> element.dispatchEvent(new Event('change', { bubbles: true }));
|
2518
|
+
</span><span class='tstring_content'> }
|
2519
|
+
</span><span class='heredoc_end'> JAVASCRIPT
|
2520
|
+
</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_this'>this</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
|
2521
|
+
<span class='kw'>else</span>
|
2522
|
+
<span class='ivar'>@remote_object</span><span class='period'>.</span><span class='id identifier rubyid_set_file_input_files'>set_file_input_files</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='comma'>,</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='comma'>,</span> <span class='id identifier rubyid_backend_node_id'>backend_node_id</span><span class='rparen'>)</span>
|
2523
|
+
<span class='kw'>end</span>
|
2524
|
+
<span class='kw'>end</span></pre>
|
2525
|
+
</td>
|
2526
|
+
</tr>
|
2527
|
+
</table>
|
2528
|
+
</div>
|
2529
|
+
|
2530
|
+
</div>
|
2531
|
+
|
2532
|
+
</div>
|
2533
|
+
|
2534
|
+
<div id="footer">
|
2535
|
+
Generated on Fri Jun 12 12:38:35 2020 by
|
2536
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2537
|
+
0.9.24 (ruby-2.6.3).
|
2538
|
+
</div>
|
2539
|
+
|
2540
|
+
</div>
|
2541
|
+
</body>
|
2542
|
+
</html>
|