module Ferrum

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).

Constants

VERSION

Public Class Methods

elapsed_time(start = nil) click to toggle source
# File lib/ferrum.rb, line 131
def elapsed_time(start = nil)
  monotonic_time - (start || @@started)
end
mac?() click to toggle source
# File lib/ferrum.rb, line 119
def mac?
  RbConfig::CONFIG["host_os"] =~ /darwin/
end
monotonic_time() click to toggle source
# File lib/ferrum.rb, line 135
def monotonic_time
  Concurrent.monotonic_time
end
mri?() click to toggle source
# File lib/ferrum.rb, line 123
def mri?
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
end
started() click to toggle source
# File lib/ferrum.rb, line 127
def started
  @@started ||= monotonic_time
end
timeout?(start, timeout) click to toggle source
# File lib/ferrum.rb, line 139
def timeout?(start, timeout)
  elapsed_time(start) > timeout
end
windows?() click to toggle source
# File lib/ferrum.rb, line 115
def windows?
  RbConfig::CONFIG["host_os"] =~ /mingw|mswin|cygwin/
end
with_attempts(errors:, max:, wait:) { || ... } click to toggle source
# File lib/ferrum.rb, line 143
def with_attempts(errors:, max:, wait:)
  attempts ||= 1
  yield
rescue *Array(errors)
  raise if attempts >= max
  attempts += 1
  sleep(wait)
  retry
end