class Object
Constants
- WAIT
Public Instance Methods
check_element_on_page(locator_type, locator_name, scenario)
click to toggle source
# File lib/lazycuke/web/web_methods.rb, line 30 def check_element_on_page(locator_type, locator_name, scenario) if scenario if !displayed(locator_type, locator_name) raise Failure, 'Element Not Present' end else begin if displayed(locator_type, locator_name) raise 'Present' end rescue Exception => e if e.message == 'Present' raise Failure, 'Element Present' end end end end
click(locator_type, locator_name)
click to toggle source
# File lib/lazycuke/web/web_methods.rb, line 22 def click(locator_type, locator_name) WAIT.until { $driver.find_element(:"#{locator_type}" => "#{locator_name}") }.click end
displayed(locator_type, locator_name)
click to toggle source
# File lib/lazycuke/web/web_methods.rb, line 26 def displayed(locator_type, locator_name) WAIT.until{ $driver.find_element(:"#{locator_type}" => "#{locator_name}") }.displayed? end
valid_locator_type?(type)
click to toggle source
# File lib/lazycuke/web/web_methods.rb, line 14 def valid_locator_type? type %w(id class css name xpath).include? type end
validate_locator(type)
click to toggle source
# File lib/lazycuke/web/web_methods.rb, line 18 def validate_locator type raise "Invalid locator type - #{type}" unless valid_locator_type? type end
visit(page)
click to toggle source
# File lib/lazycuke/web/web_methods.rb, line 10 def visit(page) $driver.get(page) end