What is preventing Protractor from detecting Angular on a site that has been automatically initialized with Angular?

Whenever I try to utilize browser.get() in my code, I encounter the following error:

Error: Angular could not be found on the page http://localhost:5000/#/login
debug=timing&saveLogs=true&displayAll=true : angular never provided resumeBootstrap

As a workaround, I can use browser.driver.get(), but this leads to issues where I have to manually add specific waits and deal with unreliable tests.

I've done some research on this problem, but so far no solution seems to work. Here are some additional details to consider:

  • The login page is within an Angular application.
  • ng-app is specified in the <html> tag (despite Protractor defaulting to <body>, I have attempted setting rootElement to html without success)
  • The app utilizes $timeout, however replacing every occurrence of $timeout with $interval did not resolve the issue
  • directConnect: true with chromeDriver is being used, which should ideally not cause any problems
  • The versions of Angular and Protractor being utilized are Angular 1.2.28 and Protractor 2.0 respectively

Here is the complete error message for reference:

Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
Error: Angular could not be found on the page http://localhost:5000/#/login?debug=timing&saveLogs=true&displayAll=true : angular never provided resumeBootstrap
  at /Users/brandenbyers/Projects/admin-ui/node_modules/grunt-protractor-runner/node_modules/protractor/lib/protractor.js:479:17
  at [object Object].promise.ControlFlow.runInFrame_ (/Users/brandenbyers/Projects/admin-ui/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
   .
   . (repeated error lines omitted here for brevity) 
   .
From: Task: WebDriver.manage().timeouts().setScriptTimeout(11000)
  at [object Object].webdriver.WebDriver.schedule (/Users/brandenbyers/Projects/admin-ui/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:360:15)
  at [object Object].webdriver.WebDriver.Timeouts.setScriptTimeout (/Users/brandenbyers/Projects/admin-ui/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:1367:23)
    . 
    . (more callback function errors shown above)
   .  

Answer №1

The problem was that Protractor was looking for the standard window.name:

window.name = "NG_DEFER_BOOTSTRAP!"

However, the application I am testing does not follow this standard. As a result, the Protractor testForAngular function fails every time. You can find the Protractor code at: https://github.com/angular/protractor/blob/8a3412e98614bb69978869b34b5b7243619f015d/lib/clientsidescripts.js#L550-L583

One temporary solution is to comment out the customized window.name = in app.js to resolve this issue. However, we still need to explore options for either using a different variable with Protractor or dynamically commenting out this line only for tests.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

No response observed upon clicking on the li element within the personalized context menu

I created a custom context menu that pops up when you click on an li element within an unordered list. I'm trying to trigger an alert when clicking on an li item inside the context menu, but it's not working as expected. To handle this dynamic c ...

React Native: Why is useState setter not causing a re-render?

As a beginner in react and javascript, I am facing an issue with showing an ActivityIndicator while logging in a user. The setIsLoading method doesn't seem to change the state and trigger a rerender. When the handleLogin method is called on a button c ...

Real-time update of quiz results based on varying factors

In my quiz, I have set up variables that start at 0 and increase based on certain conditions. One variable should increase when a question is answered correctly, while the other should increase when a question is answered incorrectly. If you answer a quest ...

Saving data in a Spring MVC Angular JS application may involve storing null values in the database

angular js code <body data-ng-app="myApp" data-ng-controller="UserController as userBean"> <form method="post" action="register" name="myForm"> <div class="form-group col-lg-7" > <label for="username" class="control-label">First ...

Mastering AngularJS - Field Population with Blinking Placeholders

I understand that AngularJS fills in fields through their model. HTML is loaded first: <input type="text" data-ng-model="data.myValue" placeholder="example"> The JavaScript code comes next: $scope.data = {}; $scope.data.myValue = 'hello my v ...

Watching a live video stream in real-time using WebRTC with React

Here is the HTML code <video ref={videos} autoPlay ></video> <Button onClick={() => navigator.mediaDevices.getUserMedia({audio: true, video: true}).then((mediaStream) => { videos.srcObject = mediaStream; videos.onloadedmetad ...

Navigating the path for the script src dynamically with the help of Angular.js and Javascript

I could really use some assistance. I am trying to dynamically set the js/css path name using Angular.js/Javascript/Jquery. Let me explain my code below. <script src="/crm/controller/productController.js" type="text/javascript"></script> Let& ...

What is the reason behind the term "interpolation" for the double curly braces in Angular/

Even after over a year of experience with Angular/JS, I find myself struggling to truly grasp the concept of interpolation (for example, {{1+4}}). Can you explain the origin of this term in the context of Angular/JS and if it shares any similarities with ...

Querying through a database containing 1 million <string Name, int score> pairs efficiently within sub-linear time

My JSON object holds 1 million pairs. var student = {[ { name: "govi", score: "65" }, { name: "dharti", score: "80" }, { name: "Akash", score: "75" },............. up to a million ...

Updating an array within an object using JSON

Check out the structure of my JSON response: "_id" : 537, "quizzes" : [ { "wk" : 1, "score" : [ 10 ] }, { "wk" : 2, "score" : [ 8 ...

jquery unclean data, in need of the jquery ui popup dialog

I have been experimenting with this library to determine if a form is dirty. By default, it triggers the standard browser confirmation asking whether you are certain about navigating away from the page. The jquery dirtyforms website includes a section sugg ...

The component <FormControl /> does not support the variant prop

It's perplexing to me why <FormControl /> doesn't seem to accept the prop variant. Even though the documentation suggests that this prop is available. import React from "react"; import { render } from "react-dom"; import FormControl from " ...

The jqueryMobile Dialog persistently opens during pageshow, despite having the cookie already set

My jQuery mobile dialog keeps opening every time the page is refreshed, despite having a cookie set to open it only once. I can't figure out why it's loading without any triggers. Any assistance would be greatly appreciated. JAVASCRIPT function ...

Leverage variables in Ajax to retrieve the data of an HTML element

Seeking assistance in converting multiple lines into a single for loop. var optie1 = ""; if($('#form #optie1_check').is(':checked')) { optie1 = $('#form #optie1_naam').val(); } var optie2 = ""; if($('#form #optie2_ch ...

Error: The server selection process has encountered an unexpected issue

Embarking on my journey with MongoDB and the MERN stack, I turned to these tutorials for guidance: https://medium.com/@beaucarnes/learn-the-mern-stack-by-building-an-exercise-tracker-mern-tutorial-59c13c1237a1 https://www.youtube.com/watch?v=7CqJlxBYj-M ...

What is the best way to configure my Express API endpoint so that it can generate customized responses based on the parameters in the URL?

Currently working on a react-admin project where I need to establish a connection with an express server using a data provider. Despite my efforts, I have been unable to implement sorting and pagination functionality. It seems like modifications are requi ...

Guide on including a sum (integer) property in the JSON output of my API

Currently, I am working on an API using Express.js. In one of my functions named getAll, my goal is to not only return an array of records but also include the total number of records in the response. The code snippet below showcases how I have been handli ...

How to create a responsive image that appears over a button when hovering in Bootstrap?

My goal is to display an image over a button when hovering. I've tried adding the .img-responsive class in Bootstrap while including the image in the HTML, but it's not working as expected with my current method of loading images. The buttons the ...

Ionic directive ng-disabled not functioning as expected

Upon running the Ionic application, I noticed that the radio button is not being disabled even with the use of ng-hide.<input type="radio" ng-disabled="true"> ...

I am encountering a problem while performing JavaScript validations

In jQuery or using the element's ID, I can validate a textbox. For example: var field = document.getElementById('tbxSearchField').value if (field == "") {alert("please enter text");} The HTML code is as follows: <input class="input" id ...