Module: Ferrum
- Defined in:
- lib/ferrum/frame/dom.rb,
lib/ferrum.rb,
lib/ferrum/node.rb,
lib/ferrum/page.rb,
lib/ferrum/frame.rb,
lib/ferrum/mouse.rb,
lib/ferrum/dialog.rb,
lib/ferrum/target.rb,
lib/ferrum/browser.rb,
lib/ferrum/context.rb,
lib/ferrum/cookies.rb,
lib/ferrum/headers.rb,
lib/ferrum/network.rb,
lib/ferrum/version.rb,
lib/ferrum/contexts.rb,
lib/ferrum/keyboard.rb,
lib/ferrum/page/frames.rb,
lib/ferrum/browser/xvfb.rb,
lib/ferrum/frame/runtime.rb,
lib/ferrum/network/error.rb,
lib/ferrum/browser/client.rb,
lib/ferrum/browser/command.rb,
lib/ferrum/browser/process.rb,
lib/ferrum/network/request.rb,
lib/ferrum/page/screenshot.rb,
lib/ferrum/network/exchange.rb,
lib/ferrum/network/response.rb,
lib/ferrum/browser/subscriber.rb,
lib/ferrum/browser/web_socket.rb,
lib/ferrum/browser/options/base.rb,
lib/ferrum/network/auth_request.rb,
lib/ferrum/browser/options/chrome.rb,
lib/ferrum/browser/options/firefox.rb,
lib/ferrum/network/intercepted_request.rb
Overview
RemoteObjectId is from a JavaScript world, and corresponds to any JavaScript object, including JS wrappers for DOM nodes. There is a way to convert between node ids and remote object ids (DOM.requestNode and DOM.resolveNode).
NodeId is used for inspection, when backend tracks the node and sends updates to the frontend. If you somehow got NodeId over protocol, backend should have pushed to the frontend all of it’s ancestors up to the Document node via DOM.setChildNodes. After that, frontend is always kept up-to-date about anything happening to the node.
BackendNodeId is just a unique identifier for a node. Obtaining it does not send any updates, for example, the node may be destroyed without any notification. This is a way to keep a reference to the Node, when you don’t necessarily want to keep track of it. One example would be linking to the node from performance data (e.g. relayout root node). BackendNodeId may be either resolved to inspected node (DOM.pushNodesByBackendIdsToFrontend) or described in more details (DOM.describeNode).
Defined Under Namespace
Classes: Browser, BrowserError, Context, Contexts, Cookies, CyclicObject, DeadBrowserError, Dialog, Error, Frame, Headers, JavaScriptError, Keyboard, Mouse, Network, NoExecutionContextError, NoSuchPageError, NoSuchTargetError, Node, NodeIsMovingError, NodeNotFoundError, NotImplementedError, Page, ProcessTimeoutError, ScriptTimeoutError, StatusError, Target, TimeoutError
Constant Summary
collapse
- VERSION =
"0.9"
Class Method Summary
collapse
Class Method Details
.elapsed_time(start = nil) ⇒ Object
116
117
118
|
# File 'lib/ferrum.rb', line 116
def elapsed_time(start = nil)
monotonic_time - (start || @@started)
end
|
.mac? ⇒ Boolean
104
105
106
|
# File 'lib/ferrum.rb', line 104
def mac?
RbConfig::CONFIG["host_os"] =~ /darwin/
end
|
.monotonic_time ⇒ Object
120
121
122
|
# File 'lib/ferrum.rb', line 120
def monotonic_time
Concurrent.monotonic_time
end
|
.mri? ⇒ Boolean
108
109
110
|
# File 'lib/ferrum.rb', line 108
def mri?
defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
end
|
.started ⇒ Object
112
113
114
|
# File 'lib/ferrum.rb', line 112
def started
@@started ||= monotonic_time
end
|
.timeout?(start, timeout) ⇒ Boolean
124
125
126
|
# File 'lib/ferrum.rb', line 124
def timeout?(start, timeout)
elapsed_time(start) > timeout
end
|
.windows? ⇒ Boolean
100
101
102
|
# File 'lib/ferrum.rb', line 100
def windows?
RbConfig::CONFIG["host_os"] =~ /mingw|mswin|cygwin/
end
|
.with_attempts(errors:, max:, wait:) ⇒ Object
128
129
130
131
132
133
134
135
136
|
# File 'lib/ferrum.rb', line 128
def with_attempts(errors:, max:, wait:)
attempts ||= 1
yield
rescue *Array(errors)
raise if attempts >= max
attempts += 1
sleep(wait)
retry
end
|