Encountered an issue while trying to synchronize Protractor with the page when an alert appeared during a page refresh

Upon refreshing the page, I encounter an error and receive the following alert:

Failed: Error occurs while waiting for Protractor to synchronize with the page: "both angularJS testability and angular testability are undefined. This may be due to either a non-angular page or because your test includes client-side navigation, which could disrupt Protractor's bootstrapping process. See for more information".

Here is the code snippet being used:

browser.refresh().catch(function(){
browser.switchTo().alert().then(function(alert){
        alert.accept();
});

Answer №1

This specific notification is not an Angular Alert. If this is the scenario, inform Angular that you are no longer testing an Angular Application.

browser.waitForAngularEnabled(false); 

Afterward, proceed with the remainder of your code

browser.refresh().catch(function(){
browser.switchTo().alert().then(function(alert){
        alert.accept();
});

If you wish for it to resume behaving like an Angular application (waiting for HTTPS requests, etc), you must re-enable it after accepting the alert

browser.switchTo().defaultContent();
browser.waitForAngular();
browser.waitForAngularEnabled(true);

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

Attempting to eliminate an HTML element using JavaScript

Currently, I am working on creating an image rotator in JavaScript. The CSS fade animation I have applied only seems to work during element creation, so I am forced to remove the element on each loop iteration. The main issue I am encountering is related ...

Using a remote WebDriver to disenable JavaScript in htmlunit

Encountering an issue while fetching a page with selenium from a python script via htmlunit using a remote webdriver. The error message received is as follows: WebDriverException: Message: u'TypeError: Cannot find function addEventListener in objec ...

Retrieve the names of items from an array and generate an unsorted list

var Info = [ {"Different Parts of Story" : [ {"NSP" : "Netting Systemically Potent"}, {"PNK" : "Polar Necessary Climate"} ]}, {"Physics and More" : [ {"SZK" : "Snowy Z from Crossing"}, {"ZZS" : "Zone of Software ...

Add each individual item from the array into the database sequentially

I have a collection of data entries that I need to individually insert into the database, like so: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}] In essence, I plan to use a for..of loop to iterate over this array and add them one by one. If ...

Executing a PHP script from JavaScript can be accomplished by making an AJAX

I want to connect my JavaScript script with a REST API programmed in PHP. It reminds me of the functionality of the jQuery UI autocomplete plugin, where you can input an external PHP script as a data source and utilize its output for the autocomplete fea ...

Utilizing EJS to display dynamic data from a JSON file in a visually appealing D

*Excited about learning express! Currently, I have two files - index.ejs and script.js. The script I've written successfully fetches JSON data from an api. const fetch = require("node-fetch"); const url = '...' fetch (url) .then(resp ...

Anticipated the server's HTML to have a corresponding "a" tag within it

Recently encountering an error in my React and Next.js code, but struggling to pinpoint its origin. Expected server HTML to contain a matching "a" element within the component stack. "a" "p" "a" I suspect it may be originating from this section of my c ...

React-Redux showing no errors despite non-functional Redux store

I'm currently facing an issue with integrating React-Redux into my React Native/Expo project. Despite not receiving any console error messages, the data from the Redux store is not displaying in the user interface. Below are some key files related to ...

JavaScript is struggling to interpret the JSON string

I am transmitting a JSON string from my Django view to a JavaScript file named idbop.js on the client side. In Django, I am utilizing the serializer to convert query results into JSON format. Here is an excerpt from my views.py file in Django: def index(r ...

Looking to adjust the title font size when exporting DataTable to Excel?

Would like to customize the title of an excel file exported from Datatable. I attempted to implement a solution found on a stackoverflow post, but it ended up applying the customization to the entire sheet. $("#datatable").DataTable({ ...

Encountering an internal/modules/cjs/loader.js:892 error when attempting to install the newest version of node.js on Windows 10

After recently updating my node.js to the latest version using chocolatey, I encountered a problem with my command prompt displaying the following error: internal/modules/cjs/loader.js:892 throw err; ^ Error: Cannot find module 'C:\Users&bso ...

ChromeDriver with Selenium does not actually open a new browser, but instead retrieves the page source

Environmental Setup Information: selenium==3.141.0 Google Chrome 73.0.3683.103 Driver Version -- 73.0.3683.68 -- chromedriver_linux64.zip Operating System -- Linux 16.04 Python Version -- 3.5.2 In the provided environment, my code executes successfully a ...

Identifying when the mouse cursor changes on a website

Is there a way to detect when the mouse cursor changes as it hovers over different page elements? An event similar to this would be ideal: window.onmousecursorchange = function(e) { // e would provide information about the cursor // for example, ...

What purpose does `browser.call()` serve in the context of Protractor?

As I delve into the depths of the Protractor API, a particular method caught my attention: browser.call(). This method schedules a command to execute a custom function within the context of webdriver's control flow. Although I am interested in inc ...

The JQUERY Uncaught Error: Syntax error message popped up when trying to access an unrecognized expression on the javascript: void(0)

I've encountered an issue after upgrading to jQuery 3.4.1 while using bootstrap 3. The console keeps showing this error: Uncaught Error: Syntax error, unrecognized expression: # Here is the section of code causing the error: <div class="btn-grou ...

Updating Values in Nested Forms with Angular Reactive Form

I have been grappling with a form setup that looks something like this: itemEntities: [ {customisable: [{food: {..}, quantity: 1}, {food: {..}, quantity: 5}]}, {customisable: [{food: {..}, quantity: 0}]}, ] My challenge lies in trying to u ...

I developed a compact application utilizing Node.js in tandem with Express framework

There is an issue with the GPA calculator app built using Node.js and Express. It works fine for a single user, but when multiple users try to use it simultaneously, the scores are being combined, resulting in incorrect values. I need to create an app that ...

Utilize a Vue.js filter on the v-model within an input element

Seeking assistance! I successfully created a directive that wraps the Jasny Bootstrap Plugin, specifically focusing on the input mask feature! Additionally, I have developed a custom filter using moment to format date fields! The date format received fro ...

Utilize parameterization with PageFactory to access a WebElement

Is there a method to call my web elements with parameterization, so that they can be used in any of the methods? For example, if I want to interact with table records, I am currently using: @FindBy(xpath = "//tr[@data-search = '"+SECOND_STO ...

Adding jQuery namespace to AngularJS

I'm facing a bit of an issue here. I've implemented RequireJS to manage my modules and dependencies. To prevent cluttering the global namespace, I've set up the following configuration to avoid declaring $ or jQuery globally: require.confi ...