Sha256: 4908da191ea8ef3f54d67d133c3229bd11fcb83f38077511f14a71ee1e840bec
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
module WebConditions # @method text_to_be_on_page(txt) # @param txt [String] # @return [Boolean true] -- if text is found in the body of page # @return [Boolean false] -- if text is not found in the body of page def text_to_be_on_page(txt) # puts element_or_locator({:tag_name => 'body'}).text if element_or_locator({:tag_name => 'body'}).text.include?(txt) true else false end end # @method text_in_element_to_match(ele,attr) # @param ele [WebElement object] # @param ele [locator Hash] -- eg {:id => 'some_id'}] # @param txt [String] -- text that will be checked in the body of the page # @return [Boolean true] -- if text is found inside element and is exact match of the passed text in parameter # @return [Boolean false] -- if text is found inside element and is not an exact match of the passed text in parameter def text_in_element_to_match(ele, txt) if element_or_locator(ele).text == txt true else false end end # @method text_in_element_to_match(ele,attr) # @param ele [WebElement object] # @param ele [locator Hash] -- eg {:id => 'some_id'}] # @param txt [String] -- text that will be checked in the body of the page # @return [Boolean true] -- if text is found inside element and is exact match of the passed text in parameter # @return [Boolean false] -- if text is found inside element and is not an exact match of the passed text in parameter # @alias text_in_element_to_contain(txt) -- alternative name for this method, can be used as both def text_in_element_to_include(ele, txt) if element_or_locator(ele).text.include?(txt) true else false end end alias_method :text_in_element_to_contain, :text_in_element_to_include end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
web-object-0.5 | lib/web-object/conditions/text.rb |
web-object-0.4 | lib/web-object/conditions/text.rb |