lib/page.rb in gridium-1.1.21 vs lib/page.rb in gridium-1.1.22
- old
+ new
@@ -20,15 +20,14 @@
def self.has_css?(css, opts = {})
timeout = opts[:timeout] || 5
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
begin
- element = Driver.driver.find_element :css, css
if opts[:visible]
- wait.until {element.displayed?}
+ wait.until {Driver.driver.find_element(:css, css).displayed?}
else
- wait.until {element.enabled?}
+ wait.until {Driver.driver.find_element(:css, css).enabled?}
end
rescue Exception => exception
Log.debug("[GRIDIUM::Page] has_css? is false because this exception was rescued: #{exception}")
return false
end
@@ -36,14 +35,13 @@
def self.has_xpath?(xpath, opts = {})
timeout = opts[:timeout] || 5
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
begin
- element = Driver.driver.find_element :xpath, xpath
if opts[:visible]
- wait.until {element.displayed?}
+ wait.until {Driver.driver.find_element(:xpath, xpath).displayed?}
else
- wait.until {element.enabled?}
+ wait.until {Driver.driver.find_element(:xpath, xpath).enabled?}
end
rescue Exception => exception
Log.debug("[GRIDIUM::Page] has_xpath? is false because this exception was rescued: #{exception}")
return false
end