puppeteer-ruby 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +30 -0
- data/.rubocop.yml +4 -5
- data/docs/Puppeteer.html +2010 -0
- data/docs/Puppeteer/AsyncAwaitBehavior.html +105 -0
- data/docs/Puppeteer/Browser.html +2150 -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 +784 -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 +1580 -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 +1603 -0
- data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +206 -0
- data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +206 -0
- data/docs/Puppeteer/ElementHandle/Point.html +481 -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 +772 -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/Frame.html +3625 -0
- data/docs/Puppeteer/FrameManager.html +2414 -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 +628 -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 +5426 -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 +951 -0
- data/docs/Puppeteer/Target.html +1384 -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 +757 -0
- data/docs/Puppeteer/WaitTask.html +211 -0
- data/docs/Puppeteer/WaitTask/TerminatedError.html +124 -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 +788 -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 +121 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +121 -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 +3747 -0
- data/docs/top-level-namespace.html +126 -0
- data/lib/puppeteer.rb +9 -7
- data/lib/puppeteer/async_await_behavior.rb +6 -0
- data/lib/puppeteer/browser.rb +21 -1
- data/lib/puppeteer/connection.rb +1 -1
- data/lib/puppeteer/dom_world.rb +15 -2
- data/lib/puppeteer/element_handle.rb +3 -2
- data/lib/puppeteer/frame.rb +4 -0
- data/lib/puppeteer/frame_manager.rb +1 -1
- data/lib/puppeteer/js_handle.rb +3 -2
- data/lib/puppeteer/launcher.rb +0 -1
- data/lib/puppeteer/lifecycle_watcher.rb +3 -3
- data/lib/puppeteer/page.rb +6 -4
- data/lib/puppeteer/version.rb +1 -1
- data/puppeteer-ruby.gemspec +4 -1
- metadata +138 -4
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
Top Level Namespace
|
|
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 = "";
|
|
19
|
+
relpath = '';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="_index.html">Index</a> »
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<span class="title">Top Level Namespace</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>Top Level Namespace
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<dl>
|
|
75
|
+
<dt>Includes:</dt>
|
|
76
|
+
<dd><span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html" title="Puppeteer::ConcurrentRubyUtils (module)">Puppeteer::ConcurrentRubyUtils</a></span></dd>
|
|
77
|
+
</dl>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<h2>Defined Under Namespace</h2>
|
|
87
|
+
<p class="children">
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
</p>
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<h2>Method Summary</h2>
|
|
111
|
+
|
|
112
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html" title="Puppeteer::ConcurrentRubyUtils (module)">Puppeteer::ConcurrentRubyUtils</a></span></h3>
|
|
113
|
+
<p class="inherited"><span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html#await-instance_method" title="Puppeteer::ConcurrentRubyUtils#await (method)">#await</a></span>, <span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html#await_all-instance_method" title="Puppeteer::ConcurrentRubyUtils#await_all (method)">#await_all</a></span>, <span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html#await_any-instance_method" title="Puppeteer::ConcurrentRubyUtils#await_any (method)">#await_any</a></span>, <span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html#future-instance_method" title="Puppeteer::ConcurrentRubyUtils#future (method)">#future</a></span>, <span class='object_link'><a href="Puppeteer/ConcurrentRubyUtils.html#resolvable_future-instance_method" title="Puppeteer::ConcurrentRubyUtils#resolvable_future (method)">#resolvable_future</a></span></p>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div id="footer">
|
|
119
|
+
Generated on Sun Apr 26 15:52:55 2020 by
|
|
120
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
|
+
0.9.24 (ruby-2.6.3).
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
</div>
|
|
125
|
+
</body>
|
|
126
|
+
</html>
|
data/lib/puppeteer.rb
CHANGED
|
@@ -55,9 +55,10 @@ class Puppeteer
|
|
|
55
55
|
|
|
56
56
|
def instance
|
|
57
57
|
@instance ||= Puppeteer.new(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
project_root: __dir__,
|
|
59
|
+
preferred_revision: '706915',
|
|
60
|
+
is_puppeteer_core: true,
|
|
61
|
+
)
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
|
|
@@ -151,10 +152,11 @@ class Puppeteer
|
|
|
151
152
|
|
|
152
153
|
private def launcher
|
|
153
154
|
@launcher ||= Puppeteer::Launcher.new(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
project_root: @project_root,
|
|
156
|
+
preferred_revision: @preferred_revision,
|
|
157
|
+
is_puppeteer_core: @is_puppeteer_core,
|
|
158
|
+
product: @product_name,
|
|
159
|
+
)
|
|
158
160
|
end
|
|
159
161
|
|
|
160
162
|
# @return {string}
|
|
@@ -11,6 +11,9 @@ module Puppeteer::AsyncAwaitBehavior
|
|
|
11
11
|
define_method(method_name) do |*args|
|
|
12
12
|
Concurrent::Promises.future do
|
|
13
13
|
original_method.bind(self).call(*args)
|
|
14
|
+
rescue => err
|
|
15
|
+
Logger.new(STDERR).warn(err)
|
|
16
|
+
raise err
|
|
14
17
|
end
|
|
15
18
|
end
|
|
16
19
|
rescue NameError
|
|
@@ -24,6 +27,9 @@ module Puppeteer::AsyncAwaitBehavior
|
|
|
24
27
|
define_singleton_method(method_name) do |*args|
|
|
25
28
|
Concurrent::Promises.future do
|
|
26
29
|
original_method.call(*args)
|
|
30
|
+
rescue => err
|
|
31
|
+
Logger.new(STDERR).warn(err)
|
|
32
|
+
raise err
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|
data/lib/puppeteer/browser.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'timeout'
|
|
|
4
4
|
class Puppeteer::Browser
|
|
5
5
|
include Puppeteer::DebugPrint
|
|
6
6
|
include Puppeteer::EventCallbackable
|
|
7
|
+
include Puppeteer::IfPresent
|
|
7
8
|
using Puppeteer::AsyncAwaitBehavior
|
|
8
9
|
|
|
9
10
|
# @param {!Puppeteer.Connection} connection
|
|
@@ -106,6 +107,10 @@ class Puppeteer::Browser
|
|
|
106
107
|
emit_event 'Events.Browser.TargetCreated', target
|
|
107
108
|
context.emit_event 'Events.BrowserContext.TargetCreated', target
|
|
108
109
|
end
|
|
110
|
+
|
|
111
|
+
if_present(pending_target_info_changed_event.delete(target_info.target_id)) do |pending_event|
|
|
112
|
+
handle_target_info_changed(pending_event)
|
|
113
|
+
end
|
|
109
114
|
end
|
|
110
115
|
|
|
111
116
|
|
|
@@ -127,7 +132,18 @@ class Puppeteer::Browser
|
|
|
127
132
|
target_info = Puppeteer::Target::TargetInfo.new(event['targetInfo'])
|
|
128
133
|
target = @targets[target_info.target_id]
|
|
129
134
|
if !target
|
|
130
|
-
|
|
135
|
+
# targetCreated is sometimes notified after targetInfoChanged.
|
|
136
|
+
# We don't raise error. Instead, keep the event as a pending change,
|
|
137
|
+
# and handle it on handle_target_created.
|
|
138
|
+
#
|
|
139
|
+
# D, [2020-04-22T00:22:26.630328 #79646] DEBUG -- : RECV << {"method"=>"Target.targetInfoChanged", "params"=>{"targetInfo"=>{"targetId"=>"8068CED48357B9557EEC85AA62165A8E", "type"=>"iframe", "title"=>"", "url"=>"", "attached"=>true, "browserContextId"=>"7895BFB24BF22CE40584808713D96E8D"}}}
|
|
140
|
+
# E, [2020-04-22T00:22:26.630448 #79646] ERROR -- : target should exist before targetInfoChanged (StandardError)
|
|
141
|
+
# D, [2020-04-22T00:22:26.630648 #79646] DEBUG -- : RECV << {"method"=>"Target.targetCreated", "params"=>{"targetInfo"=>{"targetId"=>"8068CED48357B9557EEC85AA62165A8E", "type"=>"iframe", "title"=>"", "url"=>"", "attached"=>false, "browserContextId"=>"7895BFB24BF22CE40584808713D96E8D"}}}
|
|
142
|
+
pending_target_info_changed_event[target_info.target_id] = event
|
|
143
|
+
return
|
|
144
|
+
# original implementation is:
|
|
145
|
+
#
|
|
146
|
+
# raise StandardError.new('target should exist before targetInfoChanged')
|
|
131
147
|
end
|
|
132
148
|
previous_url = target.url
|
|
133
149
|
was_initialized = target.initialized?
|
|
@@ -138,6 +154,10 @@ class Puppeteer::Browser
|
|
|
138
154
|
end
|
|
139
155
|
end
|
|
140
156
|
|
|
157
|
+
private def pending_target_info_changed_event
|
|
158
|
+
@pending_target_info_changed_event ||= {}
|
|
159
|
+
end
|
|
160
|
+
|
|
141
161
|
# @return [String]
|
|
142
162
|
def websocket_endpoint
|
|
143
163
|
@connection.url
|
data/lib/puppeteer/connection.rb
CHANGED
data/lib/puppeteer/dom_world.rb
CHANGED
|
@@ -55,7 +55,7 @@ class Puppeteer::DOMWorld
|
|
|
55
55
|
@context_promise.resolved?
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
def detach
|
|
59
59
|
@detached = true
|
|
60
60
|
@wait_tasks.each do |wait_task|
|
|
61
61
|
wait_task.terminate(Puppeteer::WaitTask::TerminatedError.new('waitForFunction failed: frame got detached.'))
|
|
@@ -93,8 +93,21 @@ class Puppeteer::DOMWorld
|
|
|
93
93
|
document.S(selector)
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
class DocumentEvaluationError < StandardError; end
|
|
97
|
+
|
|
98
|
+
private def evaluate_document
|
|
99
|
+
# sometimes execution_context.evaluate_handle('document') returns null object.
|
|
100
|
+
# D, [2020-04-24T02:17:51.023631 #220] DEBUG -- : RECV << {"id"=>20, "result"=>{"result"=>{"type"=>"object", "subtype"=>"null", "value"=>nil}}, "sessionId"=>"78E9CF1E14D81294E320E7C20E5CDE06"}
|
|
101
|
+
# retry if so.
|
|
102
|
+
5.times do
|
|
103
|
+
handle = execution_context.evaluate_handle('document')
|
|
104
|
+
return handle if handle.is_a?(Puppeteer::ElementHandle)
|
|
105
|
+
end
|
|
106
|
+
raise DocumentEvaluationError.new("'document' object cannot be evaluated as an Element")
|
|
107
|
+
end
|
|
108
|
+
|
|
96
109
|
private def document
|
|
97
|
-
@document ||=
|
|
110
|
+
@document ||= evaluate_document.as_element
|
|
98
111
|
end
|
|
99
112
|
|
|
100
113
|
# `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
|
|
@@ -410,8 +410,9 @@ class Puppeteer::ElementHandle < Puppeteer::JSHandle
|
|
|
410
410
|
# @return [Object]
|
|
411
411
|
def SSeval(selector, page_function, *args)
|
|
412
412
|
handles = evaluate_handle(
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
'(element, selector) => Array.from(element.querySelectorAll(selector))',
|
|
414
|
+
selector,
|
|
415
|
+
)
|
|
415
416
|
result = handles.evaluate(page_function, *args)
|
|
416
417
|
handles.dispose
|
|
417
418
|
|
data/lib/puppeteer/frame.rb
CHANGED
|
@@ -248,6 +248,10 @@ class Puppeteer::Frame
|
|
|
248
248
|
# TODO(lushnikov): remove this once requestInterception has loaderId exposed.
|
|
249
249
|
@navigation_url = frame_payload['url']
|
|
250
250
|
@url = frame_payload['url']
|
|
251
|
+
|
|
252
|
+
# Ensure loaderId updated.
|
|
253
|
+
# The order of [Page.lifecycleEvent name="init"] and [Page.frameNavigated] is random... for some reason...
|
|
254
|
+
@loader_id = frame_payload['loaderId']
|
|
251
255
|
end
|
|
252
256
|
|
|
253
257
|
# @param url [String]
|
|
@@ -219,7 +219,7 @@ class Puppeteer::FrameManager
|
|
|
219
219
|
|
|
220
220
|
# @param frame_payload [Hash]
|
|
221
221
|
def handle_frame_navigated(frame_payload)
|
|
222
|
-
is_main_frame = !frame_payload['
|
|
222
|
+
is_main_frame = !frame_payload['parentId']
|
|
223
223
|
frame =
|
|
224
224
|
if is_main_frame
|
|
225
225
|
@main_frame
|
data/lib/puppeteer/js_handle.rb
CHANGED
|
@@ -89,8 +89,9 @@ class Puppeteer::JSHandle
|
|
|
89
89
|
response['result'].each_with_object({}) do |prop, h|
|
|
90
90
|
next unless prop['enumerable']
|
|
91
91
|
h[prop['name']] = Puppeteer::JSHandle.create(
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
context: @context,
|
|
93
|
+
remote_object: Puppeteer::RemoteObject.new(prop['value']),
|
|
94
|
+
)
|
|
94
95
|
end
|
|
95
96
|
end
|
|
96
97
|
|
data/lib/puppeteer/launcher.rb
CHANGED
|
@@ -73,7 +73,7 @@ class Puppeteer::LifecycleWatcher
|
|
|
73
73
|
terminate(TerminatedError.new('Navigation failed because browser has disconnected!'))
|
|
74
74
|
end
|
|
75
75
|
@listener_ids['frame_manager'] = [
|
|
76
|
-
@frame_manager.add_event_listener('Events.FrameManager.LifecycleEvent') do |
|
|
76
|
+
@frame_manager.add_event_listener('Events.FrameManager.LifecycleEvent') do |_|
|
|
77
77
|
check_lifecycle_complete
|
|
78
78
|
end,
|
|
79
79
|
@frame_manager.add_event_listener('Events.FrameManager.FrameNavigatedWithinDocument', &method(:navigated_within_document)),
|
|
@@ -149,10 +149,10 @@ class Puppeteer::LifecycleWatcher
|
|
|
149
149
|
if @frame.loader_id == @initial_loader_id && !@has_same_document_navigation
|
|
150
150
|
return
|
|
151
151
|
end
|
|
152
|
-
if @has_same_document_navigation
|
|
152
|
+
if @has_same_document_navigation && @same_document_navigation_promise.pending?
|
|
153
153
|
@same_document_navigation_promise.fulfill(true)
|
|
154
154
|
end
|
|
155
|
-
if @frame.loader_id != @initial_loader_id
|
|
155
|
+
if @frame.loader_id != @initial_loader_id && @new_document_navigation_promise.pending?
|
|
156
156
|
@new_document_navigation_promise.fulfill(true)
|
|
157
157
|
end
|
|
158
158
|
end
|
data/lib/puppeteer/page.rb
CHANGED
|
@@ -48,10 +48,10 @@ class Puppeteer::Page
|
|
|
48
48
|
if event['targetInfo']['type'] != 'worker'
|
|
49
49
|
# If we don't detach from service workers, they will never die.
|
|
50
50
|
await @client.send_message('Target.detachFromTarget', sessionId: event['sessionId'])
|
|
51
|
-
|
|
51
|
+
next
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
session = Puppeteer::Connection.from_session(@client).session(event['sessionId'])
|
|
54
|
+
session = Puppeteer::Connection.from_session(@client).session(event['sessionId']) # rubocop:disable Lint/UselessAssignment
|
|
55
55
|
# const worker = new Worker(session, event.targetInfo.url, this._addConsoleMessage.bind(this), this._handleException.bind(this));
|
|
56
56
|
# this._workers.set(event.sessionId, worker);
|
|
57
57
|
# this.emit(Events.Page.WorkerCreated, worker);
|
|
@@ -59,7 +59,7 @@ class Puppeteer::Page
|
|
|
59
59
|
@client.on_event 'Target.detachedFromTarget' do |event|
|
|
60
60
|
session_id = event['sessionId']
|
|
61
61
|
worker = @workers[session_id]
|
|
62
|
-
|
|
62
|
+
next unless worker
|
|
63
63
|
|
|
64
64
|
emit_event('Events.Page.WorkerDestroyed', worker)
|
|
65
65
|
@workers.delete(session_id)
|
|
@@ -204,7 +204,9 @@ class Puppeteer::Page
|
|
|
204
204
|
end
|
|
205
205
|
if source != 'worker'
|
|
206
206
|
console_message_location = Puppeteer::ConsoleMessage::Location.new(
|
|
207
|
-
|
|
207
|
+
url: url,
|
|
208
|
+
line_number: line_number,
|
|
209
|
+
)
|
|
208
210
|
emit_event('Events.Page.Console',
|
|
209
211
|
Puppeteer::ConsoleMessage.new(level, text, [], console_message_location))
|
|
210
212
|
end
|
data/lib/puppeteer/version.rb
CHANGED
data/puppeteer-ruby.gemspec
CHANGED
|
@@ -25,5 +25,8 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.add_development_dependency 'pry-byebug'
|
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
28
|
-
spec.add_development_dependency '
|
|
28
|
+
spec.add_development_dependency 'rspec_junit_formatter' # for CircleCI.
|
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 0.82.0'
|
|
30
|
+
spec.add_development_dependency 'rubocop-rspec'
|
|
31
|
+
spec.add_development_dependency 'yard'
|
|
29
32
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: puppeteer-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- YusukeIwaki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-04-
|
|
11
|
+
date: 2020-04-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|
|
@@ -108,20 +108,62 @@ dependencies:
|
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '3.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec_junit_formatter
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: rubocop
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
114
128
|
requirements:
|
|
115
129
|
- - "~>"
|
|
116
130
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 0.
|
|
131
|
+
version: 0.82.0
|
|
118
132
|
type: :development
|
|
119
133
|
prerelease: false
|
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
135
|
requirements:
|
|
122
136
|
- - "~>"
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 0.
|
|
138
|
+
version: 0.82.0
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rubocop-rspec
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: yard
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
125
167
|
description:
|
|
126
168
|
email:
|
|
127
169
|
- q7w8e9w8q7w8e9@yahoo.co.jp
|
|
@@ -142,6 +184,98 @@ files:
|
|
|
142
184
|
- bin/console
|
|
143
185
|
- bin/setup
|
|
144
186
|
- docker-compose.yml
|
|
187
|
+
- docs/Puppeteer.html
|
|
188
|
+
- docs/Puppeteer/AsyncAwaitBehavior.html
|
|
189
|
+
- docs/Puppeteer/Browser.html
|
|
190
|
+
- docs/Puppeteer/BrowserContext.html
|
|
191
|
+
- docs/Puppeteer/BrowserFetcher.html
|
|
192
|
+
- docs/Puppeteer/BrowserRunner.html
|
|
193
|
+
- docs/Puppeteer/BrowserRunner/BrowserProcess.html
|
|
194
|
+
- docs/Puppeteer/CDPSession.html
|
|
195
|
+
- docs/Puppeteer/CDPSession/Error.html
|
|
196
|
+
- docs/Puppeteer/ConcurrentRubyUtils.html
|
|
197
|
+
- docs/Puppeteer/Connection.html
|
|
198
|
+
- docs/Puppeteer/Connection/MessageCallback.html
|
|
199
|
+
- docs/Puppeteer/Connection/ProtocolError.html
|
|
200
|
+
- docs/Puppeteer/Connection/RequestDebugPrinter.html
|
|
201
|
+
- docs/Puppeteer/Connection/ResponseDebugPrinter.html
|
|
202
|
+
- docs/Puppeteer/ConsoleMessage.html
|
|
203
|
+
- docs/Puppeteer/ConsoleMessage/Location.html
|
|
204
|
+
- docs/Puppeteer/DOMWorld.html
|
|
205
|
+
- docs/Puppeteer/DOMWorld/DetachedError.html
|
|
206
|
+
- docs/Puppeteer/DOMWorld/DocumentEvaluationError.html
|
|
207
|
+
- docs/Puppeteer/DebugPrint.html
|
|
208
|
+
- docs/Puppeteer/Device.html
|
|
209
|
+
- docs/Puppeteer/Devices.html
|
|
210
|
+
- docs/Puppeteer/ElementHandle.html
|
|
211
|
+
- docs/Puppeteer/ElementHandle/ElementNotFoundError.html
|
|
212
|
+
- docs/Puppeteer/ElementHandle/ElementNotVisibleError.html
|
|
213
|
+
- docs/Puppeteer/ElementHandle/Point.html
|
|
214
|
+
- docs/Puppeteer/ElementHandle/ScrollIntoViewError.html
|
|
215
|
+
- docs/Puppeteer/EmulationManager.html
|
|
216
|
+
- docs/Puppeteer/EventCallbackable.html
|
|
217
|
+
- docs/Puppeteer/EventCallbackable/EventListeners.html
|
|
218
|
+
- docs/Puppeteer/ExecutionContext.html
|
|
219
|
+
- docs/Puppeteer/ExecutionContext/EvaluationError.html
|
|
220
|
+
- docs/Puppeteer/ExecutionContext/JavaScriptExpression.html
|
|
221
|
+
- docs/Puppeteer/ExecutionContext/JavaScriptFunction.html
|
|
222
|
+
- docs/Puppeteer/Frame.html
|
|
223
|
+
- docs/Puppeteer/FrameManager.html
|
|
224
|
+
- docs/Puppeteer/FrameManager/NavigationError.html
|
|
225
|
+
- docs/Puppeteer/IfPresent.html
|
|
226
|
+
- docs/Puppeteer/JSHandle.html
|
|
227
|
+
- docs/Puppeteer/Keyboard.html
|
|
228
|
+
- docs/Puppeteer/Keyboard/KeyDefinition.html
|
|
229
|
+
- docs/Puppeteer/Keyboard/KeyDescription.html
|
|
230
|
+
- docs/Puppeteer/Launcher.html
|
|
231
|
+
- docs/Puppeteer/Launcher/Base.html
|
|
232
|
+
- docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html
|
|
233
|
+
- docs/Puppeteer/Launcher/BrowserOptions.html
|
|
234
|
+
- docs/Puppeteer/Launcher/Chrome.html
|
|
235
|
+
- docs/Puppeteer/Launcher/Chrome/DefaultArgs.html
|
|
236
|
+
- docs/Puppeteer/Launcher/ChromeArgOptions.html
|
|
237
|
+
- docs/Puppeteer/Launcher/LaunchOptions.html
|
|
238
|
+
- docs/Puppeteer/LifecycleWatcher.html
|
|
239
|
+
- docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html
|
|
240
|
+
- docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html
|
|
241
|
+
- docs/Puppeteer/LifecycleWatcher/TerminatedError.html
|
|
242
|
+
- docs/Puppeteer/Mouse.html
|
|
243
|
+
- docs/Puppeteer/Mouse/Button.html
|
|
244
|
+
- docs/Puppeteer/NetworkManager.html
|
|
245
|
+
- docs/Puppeteer/NetworkManager/Credentials.html
|
|
246
|
+
- docs/Puppeteer/Page.html
|
|
247
|
+
- docs/Puppeteer/Page/ScreenshotOptions.html
|
|
248
|
+
- docs/Puppeteer/Page/ScriptTag.html
|
|
249
|
+
- docs/Puppeteer/Page/StyleTag.html
|
|
250
|
+
- docs/Puppeteer/Page/TargetCrashedError.html
|
|
251
|
+
- docs/Puppeteer/RemoteObject.html
|
|
252
|
+
- docs/Puppeteer/Target.html
|
|
253
|
+
- docs/Puppeteer/Target/InitializeFailure.html
|
|
254
|
+
- docs/Puppeteer/Target/TargetInfo.html
|
|
255
|
+
- docs/Puppeteer/TimeoutError.html
|
|
256
|
+
- docs/Puppeteer/TimeoutSettings.html
|
|
257
|
+
- docs/Puppeteer/TouchScreen.html
|
|
258
|
+
- docs/Puppeteer/Viewport.html
|
|
259
|
+
- docs/Puppeteer/WaitTask.html
|
|
260
|
+
- docs/Puppeteer/WaitTask/TerminatedError.html
|
|
261
|
+
- docs/Puppeteer/WebSocket.html
|
|
262
|
+
- docs/Puppeteer/WebSocket/DriverImpl.html
|
|
263
|
+
- docs/Puppeteer/WebSocketTransport.html
|
|
264
|
+
- docs/Puppeteer/WebSocktTransportError.html
|
|
265
|
+
- docs/_index.html
|
|
266
|
+
- docs/class_list.html
|
|
267
|
+
- docs/css/common.css
|
|
268
|
+
- docs/css/full_list.css
|
|
269
|
+
- docs/css/style.css
|
|
270
|
+
- docs/file.README.html
|
|
271
|
+
- docs/file_list.html
|
|
272
|
+
- docs/frames.html
|
|
273
|
+
- docs/index.html
|
|
274
|
+
- docs/js/app.js
|
|
275
|
+
- docs/js/full_list.js
|
|
276
|
+
- docs/js/jquery.js
|
|
277
|
+
- docs/method_list.html
|
|
278
|
+
- docs/top-level-namespace.html
|
|
145
279
|
- lib/puppeteer.rb
|
|
146
280
|
- lib/puppeteer/async_await_behavior.rb
|
|
147
281
|
- lib/puppeteer/browser.rb
|