Method: Celerity::Button#locate

Defined in:
lib/celerity/elements/button.rb

#locateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/celerity/elements/button.rb', line 34

def locate
  # We want the :value attribute to point to the inner text for <button> elements,
  # and to the value attribute for <input type="button"> elements.
  if (val = @conditions[:value])
    button_ident      = Identifier.new('button')
    button_ident.text = val
    input_ident       = Identifier.new('input', :type => %w[submit reset image button], :value => [val])

    locator        = ElementLocator.new(@container, self.class)
    locator.idents = [button_ident, input_ident]

    conditions = @conditions.dup
    conditions.delete(:value)
    @object = locator.find_by_conditions(conditions)
  else
    super
  end
end