module AutomationObject::Driver::CommonSelenium::Driver

Common Selenium/AppiumMethods

Public Instance Methods

back() click to toggle source

Go back @return [void]

# File lib/automation_object/driver/common_selenium/driver.rb, line 33
def back
  @subject.navigate.back
end
execute_script(script) click to toggle source

@param script [String] JS to run @return [Object, nil]

# File lib/automation_object/driver/common_selenium/driver.rb, line 27
def execute_script(script)
  @subject.execute_script(script)
end
forward() click to toggle source

Go forward @return [void]

# File lib/automation_object/driver/common_selenium/driver.rb, line 39
def forward
  @subject.navigate.forward
end
inner_window_height() click to toggle source

@return [Float] inner window height

# File lib/automation_object/driver/common_selenium/driver.rb, line 21
def inner_window_height
  @subject.execute_script('return window.innerHeight;').to_f
end
refresh() click to toggle source

Refresh window @return [void]

# File lib/automation_object/driver/common_selenium/driver.rb, line 45
def refresh
  @subject.navigate.refresh
end
scroll_position() click to toggle source

@return [Point] x,y scroll position

# File lib/automation_object/driver/common_selenium/driver.rb, line 11
def scroll_position
  position = Point.new

  position.x = @subject.execute_script('var doc = document.documentElement; return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);').to_f
  position.y = @subject.execute_script('var doc = document.documentElement; return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);').to_f

  position
end