Protractor error Angular could not be found on the page

帅比萌擦擦* 提交于 2019-12-05 01:31:08

Try putting a browser.ignoreSynchronization = true; before you do a browser.get() in your login function.

Well thanks everyone for your input. I did finally fix this problem by copying all the index.html file contents to a new file. It seems that somehow the file was corrupted in a way that protractor did not like. I know it sounds simple but I wasted 2 full days on this so hope it helps someone.

If you need to navigate to a page which does not use Angular then Add this line of code before browser.get() line there:

browser.waitForAngularEnabled(false);

Reference : https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load

Are you sure you've launched your server at http://localhost/SpectrumGMWeb/?

Protractor is feeding this URL to Selenium and trying to access your application at this address. If it is not running at this address Protractor will get no response from it and will give you the error you are getting.

If you need advice on how to get a local server up and running to serve your project, I recommend grunt-connect, for example like this (which will launch a server at http://localhost:9001)

module.exports = function(grunt) {

    grunt.initConfig({
        connect: {
            server: {
                options: {
                    port: 9001,
                    base: '', // root folder of your app files
                     keepalive: true
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.registerTask('default', ['connect:server'])
}

I received this error as well, and I fixed it by changing my package.json "scripts" variable from:

"scripts": {
    ...
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  }

to

"scripts": {
    ...
    // REMOVE "pree2e"
    "e2e": "ng e2e"
  }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!