Class: Wrapybara::TextField

Inherits:
Object
  • Object
show all
Includes:
Element, FillableField
Defined in:
lib/wrapybara/elements/text_field.rb

Instance Method Summary collapse

Methods included from FillableField

#empty?, #fill_in, #has_content?, #should_be_empty, #should_have_content, #should_not_be_empty, #should_not_have_content, #value

Methods included from Element

#click, #default_how, #default_scope, #disabled?, #element, #element_identifier, #enabled?, #exists?, #focused?, #get_element, #parent_identifier, #path, #should_be_disabled, #should_be_enabled, #should_be_focused, #should_be_visible, #should_have_attribute, #should_not_be_disabled, #should_not_be_enabled, #should_not_be_focused, #should_not_be_visible, #should_not_have_attribute, #style, #visible?, #within

Constructor Details

#initialize(identifier, scope = default_scope, how = default_how) ⇒ TextField

Returns a new instance of TextField.



6
7
8
9
10
11
12
# File 'lib/wrapybara/elements/text_field.rb', line 6

def initialize(identifier, scope = default_scope, how = default_how)
	@identifier = identifier
	@how = how
	@scope = scope
	xpath = XPath::HTML.send(:locate_field, XPath.descendant(:input)[XPath.attr(:type).equals('text')], identifier)
	@element = get_element(xpath, scope)
end

Instance Method Details

#should_existObject



14
15
16
# File 'lib/wrapybara/elements/text_field.rb', line 14

def should_exist
	super "Expected a text field #{self.element_identifier} to exist"
end

#should_not_existObject



18
19
20
# File 'lib/wrapybara/elements/text_field.rb', line 18

def should_not_exist
	super "Did not expect a text field #{self.element_identifier}' to exist"
end