I have two tests:
it(\'should filter the phone list as user types into the search box\', function() {
var results = ptor.findElements(protractor.By.re
You can combine promisses into a chain:
queryInput.clear().sendKeys('nexus');
The Documentation of clear() says the following:
[ !webdriver.promise.Promise ] clear( )
Schedules a command to clear the {@code value} of this element. This command has no effect if the underlying DOM element is neither a text INPUT element nor a TEXTAREA element.
Returns: A promise that will be resolved when the element has been cleared.
so in order to get clear to do what you want, you have to work with the promise that it returns! to do so you have to use then()
here is how it works:
queryInput.clear().then(function() {
queryInput.sendKeys('motorola');
})
so clear()
returns you a promise to clear the input and then()
tells the promise what to do as soon as the input is cleared.
Clear().then(..)
doesn't work for me.
So this is my work around:
queryInput.sendKeys(protrator.Key.chord(protrator.Key.CONTROL, 'a'));
queryInput.sendKeys('nexus')
await element.sendKeys(Key.chord(Key.CONTROL, 'a'));
await element.sendKeys(Key.DELETE);
Using PageObject pattern and async/await, I have such code that works:
async clearForm() {
await this.nameInput.clear();
await this.descriptionInput.clear();
}