how to use Protractor on non angularjs website?
Another approach is to set browser.ignoreSynchronization = true
before browser.get(...). Protractor wouldn't wait for Angular loaded and you could use usual element(...) syntax.
browser.ignoreSynchronization = true;browser.get('http://localhost:8000/login.html');element(by.id('username')).sendKeys('Jane');element(by.id('password')).sendKeys('1234');element(by.id('clickme')).click();
If your test needs to interact with a non-angular page, access the webdriver instance directly with browser.driver
.
Example from Protractor docs
browser.driver.get('http://localhost:8000/login.html');browser.driver.findElement(by.id('username')).sendKeys('Jane');browser.driver.findElement(by.id('password')).sendKeys('1234');browser.driver.findElement(by.id('clickme')).click();
waitForAngular should now be used instead of the deprecated ignoreSynchronization property.
The following waitForAngular guidance is taken from the Protractor docs for timeouts:
How to disable waiting for Angular
If you need to navigate to a page which does not use Angular, you can turn off waiting for Angular by setting `browser.waitForAngularEnabled(false). For example:
browser.waitForAngularEnabled(false);browser.get('/non-angular-login-page.html');element(by.id('username')).sendKeys('Jane');element(by.id('password')).sendKeys('1234');element(by.id('clickme')).click();browser.waitForAngularEnabled(true);browser.get('/page-containing-angular.html');