Testability protractor error when your site redirects to another page

Have you ever had this issue when running your protractor automation tests ?

Error: Error while waiting for Protractor to sync with the page: "Cannot
read property '$$testability' of undefined"
at runWaitForAngularScript.then (/node_modules/protractor/lib/browser.
ts:653:19)
at ManagedPromise.invokeCallback_ (/node_modules/selenium-webdriver/
lib/promise.js:1366:14)
at TaskQueue.execute_ (/node_modules/selenium-webdriver/lib/promise.
js:2970:14)
at TaskQueue.executeNext_ (/node_modules/selenium-webdriver/lib/promise
.js:2953:27)
at asyncRun (/node_modules/selenium-webdriver/lib/promise.js:2813:27)
at /node_modules/selenium-webdriver/lib/promise.js:676:7
at (anonymous)
at process._tickDomainCallback (internal/process/next_tick.js:228:7)

It happens sometimes because you have a redirection when running your tests, so for example, you are redirected to a login page when you try to get your site and you are not authenticated yet.

You will need to get an about:blank page just after the action that calls this redirection.

Like this:

element.click();
browser.driver.get('about:blank');
return browser.get(browser.baseUrl);


See you guys soon !

2 thoughts on “Testability protractor error when your site redirects to another page

  1. This line of code looks like it has a typo:
    browser.driver.get(‘about:blankreturn browser.get(browser.baseUrl);

    What should it read as?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.