Change Element Values
Modify the values of text input controls (including text, textarea, and password inputs), radio buttons, and check boxes.
Command | Examples | Explanation |
---|---|---|
set < | set textbox "User Name:" to "admin" | Sets a text box (<input type="text">) with a label "User Name:" to a value "admin" |
set textbox with id lst-ib to "functional testing" | Setting a text box to a value with an ID (try this on http://google.com) | |
set textbox at xpath "//input[@id='lst-ib']" to "functional testing" | Identical to the previous command, but expressed as an XPath locator | |
set element at selector "#lst-ib" to "functional testing" | Identical to the two previous commands, but expressed as a CSS selector. | |
clear < | clear textbox "User Name:" | Erases the text value of the element at the given locator |
clear textarea "Reason for change" | ||
select radio button < | select radio button with id radioId | Ensures that the radio button with id is selected. Note that the only way to deselect a radio button is to select a different radio button in the same set. |
click radio button at selector "#radioId" | Same as above, expressed as a CSS selector. | |
check < | check checkbox "Accept Terms" | Can be used to check both a radio button and a checkbox. |
uncheck < | uncheck checkbox "Subscribe me to the newsletter" | Can be used to uncheck a checkbox. To uncheck a radio button, you must check a different radio button in the set. |