lib/element.rb in gridium-0.1.6 vs lib/element.rb in gridium-0.1.7

- old
+ new

@@ -37,17 +37,24 @@ @element = e end def displayed_element found_element = nil - 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; + #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; + end end + rescue Exception => e + Log.warn("A Crusty old element was detected.... #{self.to_s}") + retry end + return found_element end # ================ # # Element Commands # @@ -245,9 +252,10 @@ begin if @element.enabled? return false end rescue Exception => e + Log.warn("Stale element detected.... #{self.to_s}") return true end end end \ No newline at end of file