Sander Lepik Sander Lepik - 1 month ago 72
AngularJS Question

Protractor doesn't recognize element although it is visible

I have trouble with Protractor ignoreSynchronization.

I was not able to log in without using browser.ignoreSynchronization = true. After login ignoreSynchronization was not needed any more.

Here is the login code:

browser.driver.get('xxx');

browser.ignoreSynchronization = true;

$('#input-idCode').sendKeys(idCode);
$('#input-phoneno').sendKeys(mobileNum);
$('.mobile-id').click();

browser.wait(EC.presenceOf(nextButton), 15000);
browser.ignoreSynchronization = false;


In the next case, I am also testing Angular website, but the same solution did not work any more.
After logging in I am redirected to main page and get error message:
Failed: Timed out waiting for Protractor to synchronize with the page after 60 seconds. although the element I want to interact with is visible.

What could be the problem? I don't want to run tests with ignoreSynchronization = true.

Answer

Timed out waiting for Protractor to synchronize with the page after 50001ms

The problem I had: An HTTP request is pending or fails. Open up your dev console and check the "Network" tab when the page loads with Protractor (it may happen with Protractor and not in a manual test). If you find something failing, make sure you are issuing the request correctly. For example, if you're trying to access an HTTP endpoint through HTTPS, it's definitely possible that the request would fail and Protractor would time out.

After error 403 was fixed my code worked.