class Applitools::Selenium::FrameChain

@!visibility private

Public Class Methods

new(options = {}) click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 8
def initialize(options = {})
  @frames = []
  @frames = options[:other].to_a if options[:other].is_a? self.class
end

Public Instance Methods

clear() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 36
def clear
  @frames = []
end
current_frame() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 54
def current_frame
  @frames.last
end
current_frame_offset() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 48
def current_frame_offset
  @frames.reduce(Applitools::Location.new(0, 0)) do |result, frame|
    result.offset frame.location
  end
end
current_frame_size() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 67
def current_frame_size
  @frames.last.size
end
default_content_scroll_position() click to toggle source

Returns the default content scroll position.

@return [Applitools::Base::Point] The coordinates of the result.

# File lib/applitools/selenium/frame_chain.rb, line 61
def default_content_scroll_position
  raise NoFramesException.new 'No frames!' if @frames.empty?
  result = @frames.first.parent_scroll_position
  Applitools::Base::Point.new result.x, result.y
end
each(*args, &block) click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 13
def each(*args, &block)
  return @frames.collect unless block_given?
  @frames.each(*args, &block)
end
empty?() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 44
def empty?
  @frames.empty?
end
pop() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 28
def pop
  @frames.pop
end
push(frame) click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 23
def push(frame)
  return @frames.push(frame) if frame.is_a? Applitools::Selenium::Frame
  raise "frame must be instance of Applitools::Selenium::Frame! (passed #{frame.class})"
end
same_frame_chain?(other) click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 18
def same_frame_chain?(other)
  return false unless size == other.size
  ids == other.ids
end
shift() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 32
def shift
  @frames.shift
end
size() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 40
def size
  @frames.size
end
to_s() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 71
def to_s
  @frames.map(&:to_s).join(', ')
end

Protected Instance Methods

ids() click to toggle source
# File lib/applitools/selenium/frame_chain.rb, line 79
def ids
  map { |i| i.reference.ref }
end