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 NoExecutionContextError unless context_id
  context_id
rescue NoExecutionContextError
  @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

#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