I have found Protractor framework which is made for AngularJS web applications.
How can I use Protractor on a website which is not using AngularJS?
I wrote my first test and Protractor triggers this message:
Error: Angular could not be found on the page https://www.stratexapp.com/ : retries looking for angular exceeded
Protractor works well on non-AngularJS pages as well. The first step is to set browser. ignoreSynchronization = true; inside the beforeEach() block in the spec file, to signal Protractor not to wait for Angular components to load.
But as AngularJS evolved, Protractor also quickly became popular due to unique features like being open-source, being easy to set up, and out of the box support for all major browsers. Until its deprecation, Protractor supported automation of both Angular and non-Angular-based applications.
Protractor provides a method called maximize(), which helps the user to maximize the browser window. import { browser} from 'protractor' describe('Protractor Typescript Demo', function() { it('title verifications', function() { browser. get('https://angularjs.org/'); browser. manage().
Protractor is made specifically for Angular apps. It supports Angular-specific locator strategies, which allows you to test Angular-specific elements without any setup effort on your part.
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With