Class: Vapir::Firefox::TextField

Inherits:
InputElement show all
Includes:
TextField
Defined in:
lib/vapir-firefox/elements/text_field.rb

Overview

Description: Class for Text Field element.

Direct Known Subclasses

Hidden

Instance Attribute Summary

Attributes inherited from Element

#firefox_socket

Instance Method Summary collapse

Methods inherited from Element

#click, #click_no_wait, #current_style_object, element_object_style, #fire_event, #initialize, #outer_html, #visible?, #wait

Methods included from Container

#element_by_xpath, #element_object_by_xpath, #element_objects_by_xpath, #elements_by_xpath, #extra_for_contained, #innermost_by_node, #innermost_matching_visible_text, #visible_text_nodes

Constructor Details

This class inherits a constructor from Vapir::Firefox::Element

Instance Method Details

#verify_contains(containsThis) ⇒ Object

Description:

Checks if the provided text matches with the contents of text field. Text can be a string or regular expression.

Input:

- containsThis - Text to verify.

Output:

True if provided text matches with the contents of text field, false otherwise.


22
23
24
25
26
27
28
29
30
31
# File 'lib/vapir-firefox/elements/text_field.rb', line 22

def verify_contains( containsThis )
  assert_exists do
    if containsThis.kind_of? String
      return true if self.value == containsThis
    elsif containsThis.kind_of? Regexp
      return true if self.value.match(containsThis) != nil
    end
    return false
  end
end