Module: Ferrum::Page::Frame
- Included in:
- Ferrum::Page
- Defined in:
- lib/ferrum/page/frame.rb
Instance Method Summary collapse
- #execution_context_id ⇒ Object
- #frame_name ⇒ Object
- #frame_title ⇒ Object
- #frame_url ⇒ Object
- #within_frame(frame) ⇒ Object
Instance Method Details
#execution_context_id ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/ferrum/page/frame.rb', line 6 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
15 16 17 |
# File 'lib/ferrum/page/frame.rb', line 15 def frame_name evaluate("window.name") end |
#frame_title ⇒ Object
23 24 25 |
# File 'lib/ferrum/page/frame.rb', line 23 def frame_title evaluate("document.title") end |
#frame_url ⇒ Object
19 20 21 |
# File 'lib/ferrum/page/frame.rb', line 19 def frame_url evaluate("window.location.href") end |
#within_frame(frame) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ferrum/page/frame.rb', line 27 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 |