Module: Ferrum::Page::Frame
- Included in:
- Ferrum::Page
- Defined in:
- lib/ferrum/page/frame.rb
Instance Attribute Summary collapse
-
#frame_id ⇒ Object
readonly
Returns the value of attribute frame_id.
Instance Method Summary collapse
- #execution_context_id ⇒ Object
- #frame_name ⇒ Object
- #frame_title ⇒ Object
- #frame_url ⇒ Object
- #within_frame(frame) ⇒ Object
Instance Attribute Details
#frame_id ⇒ Object (readonly)
Returns the value of attribute frame_id.
6 7 8 |
# File 'lib/ferrum/page/frame.rb', line 6 def frame_id @frame_id end |
Instance Method Details
#execution_context_id ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ferrum/page/frame.rb', line 8 def execution_context_id context_id = current_execution_context_id raise NoExecutionContextError unless context_id context_id rescue NoExecutionContextError @event.reset @event.wait(timeout) ? retry : raise end |
#frame_name ⇒ Object
17 18 19 |
# File 'lib/ferrum/page/frame.rb', line 17 def frame_name evaluate("window.name") end |
#frame_title ⇒ Object
25 26 27 |
# File 'lib/ferrum/page/frame.rb', line 25 def frame_title evaluate("document.title") end |
#frame_url ⇒ Object
21 22 23 |
# File 'lib/ferrum/page/frame.rb', line 21 def frame_url evaluate("window.location.href") end |
#within_frame(frame) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ferrum/page/frame.rb', line 29 def within_frame(frame) unless frame.is_a?(Node) raise ArgumentError, "Node is expected, but #{frame.class} is given" end frame_id = frame.description["frameId"] @frame_stack << frame_id inject_extensions yield ensure @frame_stack.pop end |