Am1
Am1

Reputation: 1

After launching the application, only the first line of the script is getting executed. After first statement none of the statements works

I am getting the below error.

Failed: Timed out waiting for asynchronous Angular tasks to finish after 100 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular While waiting for element with locator - Locator: By(css selector, *[id="password"]) Stack: ScriptTimeoutError: asynchronous script timeout: result was not received in 100 seconds

enter image description here enter image description here

I am able to open the chrome browser and able to launch the application. After launching the application, only the first line of the script is getting executed. ie. I am able to send keys to the username text box. After this my script is not getting executed.

Note: 1. If I include element(by.id('password')).sendKeys('test'); as first line after launching the application, it will work. 2. I have also tried all the locators still I am getting the same error.

I am able to locate all the elements in the page, the problem here is after browser.get(“”); statement, only first statement works. This first statement can be to locate username or password textbox. After first statement none of the statements works.

Test.e2e.js looks like the following

enter image description here

Protractor.config.js looks like the following

enter image description here

Command which I used for Execution test Spec.  I navigated to the location where my scripts are stored in my local machine.  Open the command prompt in the above location. Then I run the following command from the command-line: npm run protractor Note : I have written my scripts using Visual Studio professional 2017 (Version 15.4.5)

Upvotes: 0

Views: 114

Answers (3)

technodeath
technodeath

Reputation: 123

As already said below, you should use waitForAngularEnabled:

onPrepare() {
  browser.waitForAngularEnabled(false)
}

But there is a typo in the answer from Oleksii: onPreapare is not onPrepare

Please fix it and you'll get it.

Upvotes: 0

Rohit
Rohit

Reputation: 3702

You have to use browser.ignoreSynchronization = true; in the page class if you are testing a non-Angular based website.

Upvotes: 0

Oleksii
Oleksii

Reputation: 1643

You should add in your protractor.conf.js in the onPrepare() {} block the parameter that disable special protractor waiting that was created for Angular app.

// protractor.conf.js
...
onPreapare() {
  browser.waitForAngularEnabled(false)
}

You could take a look at that function directly in Protractor API

Upvotes: 0

Related Questions