Class: Obxcura::Frame
- Inherits:
-
Object
- Object
- Obxcura::Frame
- Defined in:
- lib/obxcura/frame.rb,
lib/obxcura/frame/dom.rb,
lib/obxcura/frame/runtime.rb
Overview
A browsing context inside a Page. It ties together Runtime (executing JS via
the Client) and DOM (reads built on that), and reaches the transport through
its owning Page — so a Frame never touches the Client directly except via
page.client.
Obxcura drives a single main frame per page today (id == the page's target_id); there is deliberately no iframe tree.
Defined Under Namespace
Constant Summary
Constants included from Runtime
Instance Attribute Summary collapse
-
#id ⇒ String
The frame's unique id (the page's CDP target_id).
-
#page ⇒ Obxcura::Page
readonly
The page that owns this frame.
Instance Method Summary collapse
-
#initialize(id, page) ⇒ Frame
constructor
A new instance of Frame.
-
#title ⇒ String
The frame's current document title.
-
#url ⇒ String
The frame's current URL.
Methods included from DOM
#at_css, #body, #css, #current_url
Methods included from Runtime
#call_on, #evaluate, #evaluate_func, #read_string
Constructor Details
#initialize(id, page) ⇒ Frame
Returns a new instance of Frame.
26 27 28 29 |
# File 'lib/obxcura/frame.rb', line 26 def initialize(id, page) @id = id @page = page end |
Instance Attribute Details
#id ⇒ String
Returns the frame's unique id (the page's CDP target_id).
19 20 21 |
# File 'lib/obxcura/frame.rb', line 19 def id @id end |
#page ⇒ Obxcura::Page (readonly)
Returns the page that owns this frame.
22 23 24 |
# File 'lib/obxcura/frame.rb', line 22 def page @page end |
Instance Method Details
#title ⇒ String
Returns the frame's current document title.
37 38 39 |
# File 'lib/obxcura/frame.rb', line 37 def title evaluate("document.title") end |
#url ⇒ String
Returns the frame's current URL.
32 33 34 |
# File 'lib/obxcura/frame.rb', line 32 def url evaluate("window.location.href") end |