Module: Ferrum::Page::Frames
- Included in:
- Ferrum::Page
- Defined in:
- lib/ferrum/page/frames.rb
Overview
Tracks the page's frame tree and keeps it in sync with the browser by
subscribing to the relevant Page.*, Network.*, and Runtime.* CDP
events. Exposes lookups over the tracked Frame objects and reports
when the tree has settled into an idle state.
Instance Attribute Summary collapse
-
#main_frame ⇒ Frame
readonly
The page's main frame, the top of the tree and the parent of all frames.
Instance Method Summary collapse
-
#frame_by(id: nil, name: nil, execution_id: nil) ⇒ Frame?
Find a frame by given params.
-
#frames ⇒ Array<Frame>
Returns all the frames current page have.
Instance Attribute Details
#main_frame ⇒ Frame (readonly)
The page's main frame, the top of the tree and the parent of all frames.
17 18 19 |
# File 'lib/ferrum/page/frames.rb', line 17 def main_frame @main_frame end |
Instance Method Details
#frame_by(id: nil, name: nil, execution_id: nil) ⇒ Frame?
Find a frame by given params.
62 63 64 65 66 67 68 69 70 |
# File 'lib/ferrum/page/frames.rb', line 62 def frame_by(id: nil, name: nil, execution_id: nil) if id @frames[id] elsif name frames.find { |f| f.name == name } elsif execution_id frames.find { |f| f.execution_id == execution_id } end end |
#frames ⇒ Array<Frame>
Returns all the frames current page have.
40 41 42 |
# File 'lib/ferrum/page/frames.rb', line 40 def frames @frames.values end |