Module: Ferrum::Page::Frame

Included in:
Ferrum::Page
Defined in:
lib/ferrum/page/frame.rb

Instance Method Summary collapse

Instance Method Details

#execution_context_idObject



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 NoExecutionContext unless context_id
  context_id
rescue NoExecutionContext
  @event.reset
  @event.wait(timeout) ? retry : raise
end

#frame_nameObject



15
16
17
# File 'lib/ferrum/page/frame.rb', line 15

def frame_name
  evaluate("window.name")
end

#frame_titleObject



23
24
25
# File 'lib/ferrum/page/frame.rb', line 23

def frame_title
  evaluate("document.title")
end

#frame_urlObject



19
20
21
# File 'lib/ferrum/page/frame.rb', line 19

def frame_url
  evaluate("window.location.href")
end

#switch_to_frame(handle) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ferrum/page/frame.rb', line 27

def switch_to_frame(handle)
  case handle
  when :parent
    @frame_stack.pop
  when :top
    @frame_stack = []
  else
    @frame_stack << handle
    inject_extensions
  end
end