lib/element.rb in gridium-1.1.11 vs lib/element.rb in gridium-1.1.13
- old
+ new
@@ -119,13 +119,17 @@
element.clear
sleep @text_padding_time
end
def value
- element.attribute "value"
+ attribute "value"
end
+ def innerHTML
+ attribute "innerHTML"
+ end
+
def click
Log.debug("[GRIDIUM::Element] Clicking on #{self}")
click_retry = 2
if element.enabled?
ElementExtensions.highlight(self) if Gridium.config.highlight_verifications
@@ -407,18 +411,24 @@
# of symbols like :space and :enter correctly
#
def field_empty_afterward?(*args)
Log.debug("[GRIDIUM::Element] Checking the field after sending #{args}, to see if it's empty")
- check_again = (has_characters? *args and no_symbols? *args)
- field_is_empty_but_should_not_be = (check_again and field_empty?)
+ check_again = has_characters?(*args) && no_symbols?(*args)
+ field_is_empty_but_should_not_be = check_again && field_empty?
if field_is_empty_but_should_not_be
raise "Browser Error: tried to input #{args} but found an empty string afterward: #{value}"
end
end
def field_empty?
- value.empty?
+ if !value.nil?
+ value.empty?
+ elsif !innerHTML.nil?
+ innerHTML.empty?
+ else
+ raise "Element Error: Supported #{__method__} text attributes are nil"
+ end
end
#
# helper to check if *args to send_keys has any symbols
# if so, don't bother trying to validate the text afterward