Class: Wrapybara::Form

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

Instance Method Summary collapse

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) ⇒ Form

Returns a new instance of Form.



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

def initialize(identifier, scope = default_scope, how = default_how)
  @identifier = identifier
  @how = how
  @scope = scope
  xpath = "id('#{identifier}') | id(//label[contains(normalize-space(string(.)), '#{identifier}')]/@for)"
  @element = get_element(xpath, scope)
end

Instance Method Details

#should_existObject



13
14
15
# File 'lib/wrapybara/elements/form.rb', line 13

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

#should_not_existObject



17
18
19
# File 'lib/wrapybara/elements/form.rb', line 17

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