Class: LegoTechSelenium::Driver
- Inherits:
-
Object
- Object
- LegoTechSelenium::Driver
- Defined in:
- lib/ui/driver/Driver.rb
Instance Method Summary collapse
-
#get_selenium_driver ⇒ Selenium::WebDriver
Function used to get the Selenium WebDriver.
-
#get_wait ⇒ Selenium::WebDriver::Wait
Function used to get the wait object.
-
#initialize(driver) ⇒ Driver
constructor
Pass in an instance of the driver.
-
#set_element_find_wait(wait_time) ⇒ Object
Function used to override the overall wait in order to find an element within the DOM.
-
#set_implicit_wait(implicit_wait) ⇒ Object
Set the amount of time the driver should wait when searching for elements.
-
#set_navigate_to(navigate_to) ⇒ Object
The URL to navigate to.
-
#set_page_load(page_load) ⇒ Object
Sets the amount of time to wait for a page load to complete before throwing an error.
-
#set_script_timeout(script_timeout) ⇒ Object
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.
Constructor Details
#initialize(driver) ⇒ Driver
Pass in an instance of the driver
8 9 10 11 |
# File 'lib/ui/driver/Driver.rb', line 8 def initialize(driver) @driver = driver @wait = Selenium::WebDriver::Wait.new(:timeout => 15) end |
Instance Method Details
#get_selenium_driver ⇒ Selenium::WebDriver
Function used to get the Selenium WebDriver
51 52 53 |
# File 'lib/ui/driver/Driver.rb', line 51 def get_selenium_driver @driver end |
#get_wait ⇒ Selenium::WebDriver::Wait
Function used to get the wait object
45 46 47 |
# File 'lib/ui/driver/Driver.rb', line 45 def get_wait @wait end |
#set_element_find_wait(wait_time) ⇒ Object
Function used to override the overall wait in order to find an element within the DOM
39 40 41 |
# 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) ⇒ Object
Set the amount of time the driver should wait when searching for elements.
15 16 17 |
# 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) ⇒ Object
The URL to navigate to
33 34 35 |
# 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) ⇒ Object
Sets the amount of time to wait for a page load to complete before throwing an error.
21 22 23 |
# 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) ⇒ Object
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.
27 28 29 |
# File 'lib/ui/driver/Driver.rb', line 27 def set_script_timeout(script_timeout) @driver.manage.timeouts.script_timeout = script_timeout end |