Class: Capybara::Lightpanda::Frame
- Inherits:
-
Object
- Object
- Capybara::Lightpanda::Frame
- 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
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#state ⇒ Object
Returns the value of attribute state.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(id, parent_id = nil, name: nil, url: nil) ⇒ Frame
constructor
A new instance of Frame.
- #main? ⇒ Boolean
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
#id ⇒ Object (readonly)
Returns the value of attribute id.
17 18 19 |
# File 'lib/capybara/lightpanda/frame.rb', line 17 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
18 19 20 |
# File 'lib/capybara/lightpanda/frame.rb', line 18 def name @name end |
#parent_id ⇒ Object (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 |
#state ⇒ Object
Returns the value of attribute state.
18 19 20 |
# File 'lib/capybara/lightpanda/frame.rb', line 18 def state @state end |
#url ⇒ Object
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
28 29 30 |
# File 'lib/capybara/lightpanda/frame.rb', line 28 def main? @parent_id.nil? end |