Selenium on Sauce Labs does not successfully load the page in Firefox after clicking

An issue has arisen where a test that functions properly with selenium webdriver locally is timing out when executed remotely on saucelabs.com. Notably, the test runs smoothly for Chrome in both local and remote scenarios.

The problem seems to lie in the click action within the client code:

var someLink = await driver.findElement(By.className('some-class'));
await someLink.click()

This setback occurs despite utilizing jest as the testing framework with a 60-second timeout setting, resulting in a timeout error on the client side after one minute.

Upon reviewing the list of commands processed by Sauce Labs, it was observed that:

POST elements

With the following parameters:

{"using":"css selector","value":".some-class"}

and the corresponding response body:

[{"ELEMENT":"2"}]

This indicates that the element is successfully located. However, the subsequent click event does not seem to be triggered. While prior click events and navigation commands are executed without issue.

In examining the video playback of the session, it is evident that the link is clicked and a new page loads in Firefox. Nevertheless, the spinner icon (a rotating dot) in the top right corner continues indefinitely.

Attempts to replicate the error using Firefox have been unsuccessful - even through manual testing on Saucelabs' platform where browser and virtual machine settings can be adjusted via the web interface.

The suspicion now centers on potential synchronous code causing an unresolved blockage. However, identifying this specific issue remains challenging given the lack of tools available in the developer console to track currently running blocking scripts.

Answer №1

While a page is loading, Selenium patiently waits for the document.readyState to indicate that it is complete. At times, the loading process can encounter obstacles - such as struggling to retrieve a large file with a poor internet connection, facing difficulties reaching resources due to proxy issues, or dealing with services that are temporarily unavailable.

I encountered a similar issue with Firefox and managed to resolve it by utilizing the eager page load strategy. By employing this strategy, Selenium will monitor the document.readyState until it reaches interactive state - ensuring that while some resources may not be fully loaded, core elements of the page are ready for interaction in the usual manner.

DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability(CapabilityType.PAGE_LOAD_STRATEGY, "eager");

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

A plug-in for TinyMCE that allows users to adjust column widths within a table

We utilize TinyMCE in our content management system (CMS), and our users have expressed interest in being able to adjust the width of a column within a table. While HTML technically does not recognize columns, the Moodle editor HTMLAREA includes a plugin t ...

Tips for building an interactive jQuery data table using JSON information and AJAX requests

Currently, I am attempting to develop a dynamic data table using jQuery and JSON. My objective is to extract the keys from the JSON data and utilize them as headers in the table, while the values within those keys will be displayed as rows. Here's th ...

Assurance-driven number tally

I'm diving into JavaScript and recently started exploring promises. I've put together a code snippet that logs the value passed to the promise function as a parameter after the setTimeout function is triggered. Now, I'm wondering if there&ap ...

CSS3 transition applied to a jQuery direction-aware hover effect

I'm encountering difficulties making direction-aware hover and css transitions function correctly. Specifically, I am attempting to create a grid of elements with front and back faces, and on hover, have a css transition that flips the element to disp ...

Using Selenium to identify child elements with XPath selectors that point to their parent elements

Imagine a scenario where my HTML structure contains multiple similar div elements. body/div/... body/div/... body/div/... body/DIV/div[@class='class'] If I want to target the last one that is in uppercase, it becomes tricky. Using "//body/div/" ...

Can the repeated use of AJAX function calls at regular intervals adversely affect the speed of the application?

On a specific page of my application, I have been using an AJAX function continuously as shown below: <script type="text/javascript"> $(document).ready(function(){ setInterval(function() { $.ajax({ ...

Submitting an HTML form to trigger a PHP function through AJAX

I am currently working on a task that involves POSTing an email address entered in an HTML form to a PHP script for storage in a database. The script should also handle error messages if the user inputs an invalid email address. I want to make this process ...

When using GTM dataLayer .push, a fresh object is generated rather than simply appending it to the current dataLayer

I am in the process of setting up a dataLayer for my website, but I have encountered an issue. My understanding is that Google Tag Manager dataLayer functions in a way where you have one central dataLayer object containing all the data variables. Each tim ...

TinyMCE toolbar missing the "hr" option

I am encountering an issue while using TinyMCE as my editor. I have added the plugin as instructed, but I cannot find the "hr" button/option in the editor interface. If anyone has any insights or solutions to this problem, please share! This is how I am ...

What could be causing the issues with SSL certificates when using Node.js/Express-TypeScript?

I'm currently in the process of transitioning a project's backend from JavaScript (Node.js/Express) to TypeScript. However, I've encountered an unusual issue where FS's readFileSync is unable to access the key.pem or cert.pem files in t ...

Understanding the concept of event bubbling through the use of querySelector

I am currently working on implementing an event listener that filters out specific clicks within a container. For instance, in the code snippet below I am filtering out clicks on elements with the class UL.head. <div> <ul class="head"> < ...

The following MongoDB errors unexpectedly popped up: MongoNetworkError: connect ETIMEDOUT and MongoServerSelectionError: connect ETIMEDOUT

I've been working on a React and NextJS App for about a month now, utilizing MongoDB as my database through MongoDB Atlas. I'm currently using the free version of MongoDB Atlas. For the backend, I rely on NextJS's api folder. Everything wa ...

Utilize the power of jQuery to easily toggle visibility of an overlay

I have successfully implemented JQuery to show and hide my overlay with great success. Now, I am interested in adding animations to enhance the user experience. After reviewing the jq documentation, I found some cool animations that can be easily integrate ...

Tips for including a line within a circular canvas

My progress bar crafted with css, javascript and html looks great (left image). However, I'm facing a challenge in adding white color dividers to enhance the appearance of the progress bar as shown in the image on the right. Despite my various attemp ...

Selenium can successfully launch the browser, however, it fails to navigate to the specified

Having trouble getting Firefox to open the URL you need for your Selenium and jUnit4 tests? You may be encountering an error message like Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdr ...

Error message: testNG org.openqa.selenium.WebDriverException encountered an issue connecting to binary FirefoxBinary(C:..Mozilla Firefoxfirefox.exe) on port 7055

I urgently need assistance with a serious problem This morning, I encountered an error while running my script. It was working perfectly fine last night. When I turned on my computer and noticed that Firefox had updated to version 47.0, I ran my script on ...

Locating a record within a database that contains an objectId field linking to a separate collection

I have defined two collections in the following manner const BookSchema = new mongoose.Schema({ title: String, author: { type: mongoose.Object.Types.ObjectId, ref: "author" } }) const BookModel = mongoose.model(" ...

Encountered an error while executing findByIdAndRemove operation

Could someone please assist in identifying the issue with the mongoose findByIdAndRemove function in the delete route provided below? //DELETE Route app.delete("/blogs/:id", function(req, res){ //Delete blog Blog.findByIdAndRemove(req.params.id, funct ...

Unable to load dynamic data in Angular 2 smart table

Currently, I am utilizing Angular 6 along with smart table by visiting this link: . Everything was functioning smoothly, until the moment I attempted to switch from static to dynamic data: The following code works perfectly and displays all the content ...

Develop a function for locating a web element through XPath using JavaScriptExecutor

I have been working on developing a method in Java Script to find web elements using XPath as the locator strategy. I am seeking assistance in completing the code, the snippet of which is provided below: path = //input[@id='image'] def getElem ...