Class: Capybara::Lightpanda::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/lightpanda/frame.rb

Overview

Lightweight metadata view of a CDP frame, populated from Page.frameAttached / Page.frameNavigated / Page.frameStarted,StoppedLoading events. Mirrors a subset of ferrum’s Frame.

NOTE: this is purely introspection — Lightpanda’s frame loading events are not reliable enough to drive ‘wait_for_navigation` (#1801, #1832), so the gem still drives navigation waits via Page.loadEventFired with readyState polling. The frame map is useful for diagnostics, listing iframes, and resolving frame metadata (name/URL) without callFunctionOn.

Constant Summary collapse

STATES =
%i[started_loading navigated stopped_loading detached].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, parent_id = nil, name: nil, url: nil) ⇒ Frame

Returns a new instance of Frame.



20
21
22
23
24
25
26
# File 'lib/capybara/lightpanda/frame.rb', line 20

def initialize(id, parent_id = nil, name: nil, url: nil)
  @id = id
  @parent_id = parent_id
  @name = name
  @url = url
  @state = nil
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/capybara/lightpanda/frame.rb', line 17

def id
  @id
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/capybara/lightpanda/frame.rb', line 18

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



17
18
19
# File 'lib/capybara/lightpanda/frame.rb', line 17

def parent_id
  @parent_id
end

#stateObject

Returns the value of attribute state.



18
19
20
# File 'lib/capybara/lightpanda/frame.rb', line 18

def state
  @state
end

#urlObject

Returns the value of attribute url.



18
19
20
# File 'lib/capybara/lightpanda/frame.rb', line 18

def url
  @url
end

Instance Method Details

#main?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/capybara/lightpanda/frame.rb', line 28

def main?
  @parent_id.nil?
end