lib/element.rb in gridium-0.1.8 vs lib/element.rb in gridium-0.1.9
- old
+ new
@@ -41,22 +41,24 @@
def displayed_element
found_element = nil
#Found an issue where the element would go stale after it's found
begin
elements = @driver.find_elements(@by, @locator)
- ##there's a chance here the element is found but not displayed.
elements.each do |element|
- if element.displayed? and element.enabled?
- found_element = element;
+ if element.displayed? #removed check for element.enabled
+ found_element = element; #this will always return the last displayed element
end
end
rescue Exception => e
- Log.warn("A Crusty old element was detected.... #{self.to_s}")
- retry
+ if found_element
+ Log.warn("An element was found, but it was not displayed on the page. Gridium.config.visible_elements_only set to: #{Gridium.config.visible_elements_only} Element: #{self.to_s}")
+ else
+ Log.warn("Could not find Element: #{self.to_s}")
+ end
end
- return found_element
+ found_element
end
# ================ #
# Element Commands #
# ================ #
@@ -94,10 +96,10 @@
return false
end
end
def enabled?
- return element.enabled?
+ element.enabled?
end
def clear
element.clear
end
\ No newline at end of file