class Ferrum::Frame

Attributes

id[RW]
name[RW]
page[R]
parent_id[R]
state[R]

Public Class Methods

new(id, page, parent_id = nil) click to toggle source
# File lib/ferrum/frame.rb, line 13
def initialize(id, page, parent_id = nil)
  @execution_id = nil
  @id, @page, @parent_id = id, page, parent_id
end

Public Instance Methods

execution_id() click to toggle source
# File lib/ferrum/frame.rb, line 51
def execution_id
  raise NoExecutionContextError unless @execution_id
  @execution_id
rescue NoExecutionContextError
  @page.event.reset
  @page.event.wait(@page.timeout) ? retry : raise
end
execution_id?(execution_id) click to toggle source
# File lib/ferrum/frame.rb, line 47
def execution_id?(execution_id)
  @execution_id == execution_id
end
inspect() click to toggle source
# File lib/ferrum/frame.rb, line 67
def inspect
  %(#<#{self.class} @id=#{@id.inspect} @parent_id=#{@parent_id.inspect} @name=#{@name.inspect} @state=#{@state.inspect} @execution_id=#{@execution_id.inspect}>)
end
main?() click to toggle source
# File lib/ferrum/frame.rb, line 34
def main?
  @parent_id.nil?
end
reset_execution_id() click to toggle source
# File lib/ferrum/frame.rb, line 63
def reset_execution_id
  @execution_id = nil
end
set_content(html) click to toggle source
# File lib/ferrum/frame.rb, line 38
def set_content(html)
  evaluate_async(%(
    document.open();
    document.write(arguments[0]);
    document.close();
    arguments[1](true);
  ), @page.timeout, html)
end
set_execution_id(value) click to toggle source
# File lib/ferrum/frame.rb, line 59
def set_execution_id(value)
  @execution_id ||= value
end
state=(value) click to toggle source

Can be one of:

  • started_loading

  • navigated

  • stopped_loading

# File lib/ferrum/frame.rb, line 22
def state=(value)
  @state = value
end
title() click to toggle source
# File lib/ferrum/frame.rb, line 30
def title
  evaluate("document.title")
end
url() click to toggle source
# File lib/ferrum/frame.rb, line 26
def url
  evaluate("document.location.href")
end