class LegoTechSelenium::Driver

Public Class Methods

new(driver) click to toggle source

Pass in an instance of the driver @param The driver from Selenium Webdriver class

# File lib/ui/driver/Driver.rb, line 8
def initialize(driver)
  @driver = driver
  @wait = Selenium::WebDriver::Wait.new(:timeout => 15)
end

Public Instance Methods

get_selenium_driver() click to toggle source

Function used to get the Selenium WebDriver @return [Selenium::WebDriver] Selenium webdriver

# File lib/ui/driver/Driver.rb, line 51
def get_selenium_driver
  @driver
end
get_wait() click to toggle source

Function used to get the wait object @return [Selenium::WebDriver::Wait] Wait object that does a wait for the object to appear in the DOM

# File lib/ui/driver/Driver.rb, line 45
def get_wait
  @wait
end
set_element_find_wait(wait_time) click to toggle source

Function used to override the overall wait in order to find an element within the DOM @param wait_time [Number] represents how long to wait until an error is thrown

# File lib/ui/driver/Driver.rb, line 39
def set_element_find_wait(wait_time)
  @wait = Selenium::WebDriver::Wait.new(:timeout => wait_time)
end
set_implicit_wait(implicit_wait) click to toggle source

Set the amount of time the driver should wait when searching for elements. @param implicit_wait seconds for implicit wait

# File lib/ui/driver/Driver.rb, line 15
def set_implicit_wait(implicit_wait)
  @driver.manage.timeouts.implicit_wait = implicit_wait
end
set_navigate_to(navigate_to) click to toggle source

The URL to navigate to @param navigate_to location for the browser to navigate to

# File lib/ui/driver/Driver.rb, line 33
def set_navigate_to(navigate_to)
  @driver.navigate.to(navigate_to)
end
set_page_load(page_load) click to toggle source

Sets the amount of time to wait for a page load to complete before throwing an error. @param page_load seconds to wait for page to load

# File lib/ui/driver/Driver.rb, line 21
def set_page_load(page_load)
  @driver.manage.timeouts.page_load = page_load
end
set_script_timeout(script_timeout) click to toggle source

Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. @param script_time seconds to wait for script to complete

# File lib/ui/driver/Driver.rb, line 27
def set_script_timeout(script_timeout)
  @driver.manage.timeouts.script_timeout = script_timeout
end