angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Elements shown after input not visible #1126

Closed vertti closed 10 years ago

vertti commented 10 years ago

I have a login form that only display's an email field. After you input an email address, it does a rest request to the backend to check if the email is already in use. If it is, it displays an extra password field, otherwise it will display the fields required to do a registration.

Now all my tests fail because when it tries to send keys to the password field, I get ElementNotVisibleError.

This is on the latest protractor 1.0.0. The same tests worked just fine on protractor 0.23.1.

Am I doing something wrong or is something broken in the synchronization code? I haven't disabled the wait for sync.

vertti commented 10 years ago

So basically if my test does this:

        this.loginEmail().sendKeys(email);
        this.loginPassword().sendKeys(password);
        this.loginButton().click();

protractor now will not wait for the first line to cause the displaying of the password field and the second line will now fail with ElementNotVisibleError. I thought I shouldn't need any wait code here and I used to work but now something seems to work differently.

juliemr commented 10 years ago

you're doing it correctly, this should work. Has your app changed, or just the version of protractor (or can you verify that it's protractor by trying again with version 0.23.1)?

What is the code for loginPassword()?

vertti commented 10 years ago

Yes, I reverted back to 0.23.1 without any other changes (well I had to revert one use of deprecated findElement) and the tests work again.

Unfortunately I started my summer vacation today so I don't have access to the code in question for the next two weeks, so I'll get back to you after I return to work.

vertti commented 10 years ago

Alright, I'm back. The code for loginPassword() is just

this.loginPassword = function () {
    return element(by.id('loginPassword'));
};
juliemr commented 10 years ago

Do your tests pass if you put in a manual browser.sleep(4000) after the login email sendkeys? Just to make sure it's actually a timing issue.

hankduan commented 10 years ago

There hasn't been any correspondence to this for over a month, and no one else experienced this issue. Closing for now, please reopen if you have additional info

bitliner commented 9 years ago

Well...I have same problem, sending keys to a input text whose type is password. Using IE9.

When the browser opens the page, it is already visible (differently from the specs of the author of this issue), not only in the page but in the screen too.

But it throws the same error.

I tried both with element(by.id('password')).sendKeys('...'); and browser.executeScript('return $("input#password]").val("...");') but no one works.

If I put a manual browser.sleep(4000) after send keys to the email input text, nothing changes.

The code is the following:

username = $('#username').sendKeys('...');
pwd = $('#password').sendKeys(...');
browser.sleep(40000);

Keep in mind the the browser.sleep() has not any effect.

If i switch the two lines that use sendKeys() (filling the password as first) neither username field is filled.

image