Button Elements
Overview
Watir::Button
describes elements that either have a tag name of
button
or are an Input
element that have a type
attribute
value of button
.
It is accessed by calling Browser#button
.
Creating a ButtonCollection
is accomplished with Browser#buttons
.
For all of the different ways of locating a Button
element,
take a look at our Locating Elements Guide.
Selenium does not care if you click a Button that is disabled, but Selenium will automatically wait for it to become enabled, because a tester shouldn’t need to click a disabled button.
Buttons also inherit methods from standard Web Elements
Common or Special Methods
Element#text
- because it returns input value or button element text depending on whichButton
type.
Standard Setter Interface
This functionality was added in Watir 7 beta 2.
Button#set
takes a boolean argument. Watir clicks the element if the value
is true
and does nothing if the value is false
.