Protractor - Pressing and sending Keys do not work

I am writing a Protractor test, and, as part of the test, I want to clear the contents of a specific field (in a text field), and then use the sendKeys method to write some content to this text field.

Here is the code from my test:

var commentField = element(by.css('input[ng-model="comment"]'));
console.log(commentField);
commentField.clear();
commentField.sendKeys('Here is a comment'); 

The console log confirms that I really find the control, but as soon as it gets into the clear () method, the test just hangs.

Any ideas what could happen here?

+4
source share
3 answers

We use browser.ignoreSynchronization = true;if the page is not angular. Because the protractor is encoded for angular. But I see the ng selector:

var commentField = element(by.css('input[ng-model="comment"]'));

This error may be caused by other things:

, jasmine2 framework, webdriver : webdriver-manager update

+3

-

browser.ignoreSynchronization = true;

, , -.

!

+2

() .clear() , sendKeys() .

async/await .

element.clear().then(() => {
    element.sendKeys('text to send')
})
0

Source: https://habr.com/ru/post/1627037/


All Articles