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

What is the correct way to shut down a Node.js Express server?

Upon receiving a callback from the /auth/github/callback URL, I am faced with the task of closing the server. Utilizing the standard HTTP API, the server can be closed using the server.close([callback]) API function. However, when working with a node-expre ...

Error encountered during XML parsing: root element not found. Location: Firefox Console

While I am using ASP.NET MVC, I keep encountering this error specifically in Firefox. Can anyone help me understand why this error message is popping up? What could be causing it? I am unable to pinpoint the source of this error. Does anyone have any insig ...

Is there a way to make the submit button navigate to the next tab, updating both the URL and the tab's content as well?

I am encountering an issue with my tabs for Step1 and Step2. After pressing the submit button in Step1, the URL updates but the component remains on tab1. How can I resolve this so that the user is directed to the Step2 tab once they click the submit butto ...

Utilize the scope for promise .then() functions when calling a service

I've just started using AngularJS and I have a question about handling promises in controllers. In my controller, I'm calling a service that communicates with a webservice and returns a promise. I want to apply the data from the promise's s ...

Dividing the logic from the Express router while retaining the ability to utilize Express functionalities

As I embark on my journey of developing my first app using Node.js and Express, I have noticed that my router file is starting to get overcrowded with logic. It seems like there is too much going on in there. My solution to this issue is to pass a functio ...

Default behavior in Fullcalendar 6 allows for rendering links on both days of the month and weekdays

Is there a way to customize the rendering of days and weekdays in Fullcalendar React? Currently, they are displayed as links by default (<a>{dayContent}</a>), but I'm looking to have them rendered as <div> or <span>. Any sugges ...

Leveraging React with axios instead of curl

Can a curl request be made using axios? The curl command is as follows: curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' --data 'client_id=1234&client_secret=1234&grant_type=client_credentials&scope=b ...

Activate filtering beyond the AngularJS datatable

Currently, I am experimenting with a codepen to understand how to filter data based on a clicked span element. The table is where the data is displayed and I'm looking for a way to trigger filtering outside of it. While the angularjs documentation spe ...

Efficient Rotation with AWS Proxy in Conjunction with Amazon API Gateway and Selenium

Looking to scrape websites using selenium. Successfully implemented selenium on ec2, but since ec2 is tied to a specific IP, I'm interested in incorporating Amazon API Gateway rotating proxy into my python selenium script. Came across this helpful t ...

Improving the performance of a function that generates all possible combinations of elements within an array

After coming across this function online, I decided to optimize it. For instance, if we have an input of [1, 2, 3], the corresponding output would be [[1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]] Below is the code snippet: const combinations = arr = ...

Are you struggling with perplexing TypeScript error messages caused by a hyphen in the package name?

After creating a JavaScript/TypeScript library, my goal is for it to function as: A global variable when called from either JavaScript or TypeScript Accessible via RequireJS when called from either JavaScript or TypeScript Complete unit test coverage Th ...

form_not_submitting_ajax

In the app I'm working on, I have a form that is defined in the following manner: = form_with model: project, remote: true, method: :put do |f| = f.select :selected_draw, options_for_select(project.draws.pluck(:number, :id), draw.id), {}, class: &a ...

Retrieve item from sessionStorage Cart

Greetings to the Stack Overflow community! I've often relied on Slack for valuable information and found solutions to many of my questions. However, this time, I'm facing a challenge that has me stumped. While I'm not an expert in JavaScript ...

Incorporate a `fresh Audio` element into my redux repository

I'm attempting to include a new Audio element in my redux store. This is how my reducer appears: export const songsReducer = (state = {}, action) => { switch (action.type) { case "PLAY_SONG": return { ...state ...

What is the best way to initiate a code sequence only when a specific word is detected on a page using Selenium in Python 3.8?

I've been working on a code that takes a screenshot of a webpage if it contains a specific word. My setup includes using Python 3.8 and Chrome Webdriver through Selenium. Here's what I've tried so far, but unfortunately, it doesn't see ...

What is the mechanism behind annotations functioning in TestNg without the need for a main() method?

Exploring TestNG with Java has raised a few questions for me. As a complete newcomer to TestNG, I wonder how all the test cases are executed in Java without the presence of a main() method. Any suggestions or insights on this would be greatly appreciated. ...

Retrieve information using an AJAX call

There is JSON data stored in a file that I need to read. The correct file data is printed to the console.log. What steps should I take to assign this data to variable x? Currently, when I execute the code, x ends up being undefined. function getData() { ...

Utilizing accurate server URLs (Codeigniter) for local JavaScript execution

Help Needed: Issue with Correct Path Names in Local JavaScript with CodeIgniter Backend I am facing difficulties in using the correct path names in local JavaScript while working with a backend in CodeIgniter. -user_data -application -system -assets In ...

Mastering the art of hovering over an element without accidentally clicking on it with Selenium and C#

I am facing an issue where I need to hover over a specific button for development purposes but avoid clicking on it. Whenever the button is clicked, it redirects me to another page which I do not want. How can I achieve hovering without triggering a clic ...

It appears that the setup function completes its execution before the onMount function is called in Vue 3

createApp({ setup() { let price = 0 onMounted() { // axios price = axios.response } return { price } } }).mount('#app') HTML <h6 id="app" class="mb-0"> ...