clearElement

Clear a <textarea> or text <input> element’s value. Make sure you can interact with the element before using this command. You can’t clear an input element that is disabled or in readonly mode.

Usage

1
browser.clearElement(selector);

Parameters

Param Type Details
selector String input element

Example

clearElement.js
1
2
3
4
5
6
7
8
9
10
11
12
it('should demonstrate the clearElement command', function () {
var input = $('.input')
input.setValue('test123')
console.log(input.getValue()) // returns 'test123'

input.clearElement()
// or
browser.clearElement('.input')

var value = browser.getValue('.input')
assert(value === ''); // true
})

Uses