Class: Watir::Button

Inherits:
InputElement show all
Defined in:
lib/watir-classic/input_elements.rb

Overview

Returned by the Container#button method.

Instance Attribute Summary

Attributes inherited from Element

#container

Attributes included from Container

#page_container

Instance Method Summary collapse

Methods inherited from InputElement

#alt, #disabled?, #label, #name, #required?, #src, #type

Methods inherited from Element

#<=>, #attribute_value, #class_name, #click, #disabled?, #double_click, #enabled?, #exists?, #fire_event, #flash, #focus, #focused?, #id, #initialize, #inner_html, #inspect, #method_missing, #ole_object, #outer_html, #parent, #right_click, #send_keys, #style, #tag_name, #title, #to_s, #to_subtype, #unique_number, #visible?

Methods included from DragAndDropHelper

#drag_and_drop_by, #drag_and_drop_on

Methods included from Container

#a, #abbr, #address, #alert, #area, #article, #aside, #audio, #b, #base, #bdi, #bdo, #blockquote, #body, #br, #button, #canvas, #caption, #checkbox, #cite, #code, #col, #colgroup, #command, #data, #datalist, #dd, #del, #details, #dfn, #div, #dl, #dt, #element, #em, #embed, #fieldset, #figcaption, #figure, #file_field, #font, #footer, #form, #frame, #frameset, #h1, #h2, #h3, #h4, #h5, #h6, #head, #header, #hgroup, #hidden, #hr, #i, #img, #input, #ins, #kbd, #keygen, #label, #legend, #li, #map, #mark, #menu, #meta, #meter, #modal_dialog, #nav, #noscript, #object, #ol, #optgroup, #option, #output, #p, #param, #pre, #progress, #q, #radio, #rp, #rt, #ruby, #s, #samp, #script, #section, #select, #small, #source, #span, #strong, #style, #sub, #summary, #sup, #table, #tbody, #td, #text_field, #textarea, #tfoot, #th, #thead, #time, #title, #tr, #track, #u, #ul, #var, #video, #wbr

Methods included from Exception

message_for_unable_to_locate

Methods included from ElementExtensions

#present?, #wait_until_present, #wait_while_present, #when_present

Constructor Details

This class inherits a constructor from Watir::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Watir::Element

Instance Method Details

#__valueObject



180
# File 'lib/watir-classic/input_elements.rb', line 180

alias_method :__value, :value

#textString

Returns button contents of value attribute or inner text if there’s no value.

Returns:

  • (String)

    button contents of value attribute or inner text if there’s no value.

See Also:



184
185
186
187
# File 'lib/watir-classic/input_elements.rb', line 184

def text
  val = tag_name == "button" ? super : __value
  val.empty? ? super : val
end

#valueObject



189
190
191
# File 'lib/watir-classic/input_elements.rb', line 189

def value
  tag_name == "button" ? attribute_value("value") : text
end