Selenium WebDriver keeps crashing with a newSession error after around 70 seconds of running

Recently, a perplexing error surfaced in my previously functional project without any changes to the code. The sudden appearance of this issue may be attributed to a FireFox update or a dependency failure. To help troubleshoot the abrupt cessation, I added a catch block:

var prom = new Builder()
  .forBrowser('firefox')
  .build()
prom.catch((e) => {
  console.log(e)
})
let driver: WebDriver = await prom

Upon reaching the final line of the code snippet above, a FireFox window pops up, lingers for around 70 seconds (when the promise should have been fulfilled), and then throws an error leading to the catch block where it is logged to the console:

{ WebDriverError: newSession
    at Object.throwDecodedError (\path\to\node_modules\selenium-webdriver\lib\error.js:550:15)
    at parseHttpResponse (\path\to\node_modules\selenium-webdriver\lib\http.js:542:13)
    at Executor.execute (\path\to\node_modules\selenium-webdriver\lib\http.js:468:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  name: 'WebDriverError',
  remoteStacktrace: 'WebDriverError@chrome://marionette/content/error.js:178:5\nUnknownCommandError@chrome://marionette/content/error.js:472:5\ndespatch@chrome://marionette/content/server.js:290:13\nexecute@chrome://marionette/content/server.js:271:11\nonPacket/<@chrome://marionette/content/server.js:246:15\nonPacket@chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n' }

Interestingly, upon investigation using Visual Studio, the WebDriverError object supposedly has a "newSession" message property that fails to appear in the log or when stringified.

The error's construction is inadequate as "newSession" lacks sufficient detail to pinpoint the issue.

If anyone can assist me in identifying the cause of the ~70 second delay, I would greatly appreciate it.

UPDATE: I have identified the specific web request causing the delay (a POST to http://localhost:51290/session, varying ports). This request times out after 70 seconds. By replicating the timeout externally (e.g., using SoapUI) with {} as the payload, a FireFox window also appears. However, setting a generous timeout in SoapUI prompts the following JSON response:

{"value": {
   "error": "unknown error",
   "message": "newSession",
   "stacktrace": "WebDriverError@chrome://marionette/content/error.js:178:5\nUnknownCommandError@chrome://marionette/content/error.js:472:5\ndespatch@chrome://marionette/content/server.js:290:13\nexecute@chrome://marionette/content/server.js:271:11\nonPacket/<@chrome://marionette/content/server.js:246:15\nonPacket@chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n"
}}

I suspect delving into debugging on the FireFox end might shed light on the issue. Can someone provide guidance in that direction?

Answer №1

After some troubleshooting, I managed to pinpoint the problem. It turns out that my Geckodriver was not up to date. By updating the GeckoDriver, I was able to resolve the issue.

For those using OSX, here is the solution:

brew uninstall geckodriver

and then

brew install geckodriver

I hope this information proves helpful!

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

Incorporating TypeScript basics into the if statement post compiling

As I delve into the Angular2 Quickstart, I stumbled upon a peculiar issue within app.component.js after compiling app.component.ts using tsc (version 1.8.2): if (d = decorators[i]) I am unable to pinpoint where I may have gone wrong in configuring the qu ...

Exploring the Bookmarking Capabilities of Firefox

Is there a way to access the users' bookmarks using Firefox API and javascript? Appreciate any help, Bruno ...

Trouble with the filter function in the component array

I am facing an issue with creating and deleting multiple components. I have successfully created the components, but for some reason, I am unable to delete them when I click on the "delete" button. state = { data: '', todoCard: [], id ...

What is the process for retrieving a detached element?

In the game, I'm looking to provide a "start again" option for users when they lose. The .detach() method comes in handy for hiding the button initially, but I'm struggling to make it reappear. Some solutions suggest using the append() method, bu ...

Ways to develop a dynamic HTML TransferBox featuring a custom attribute

I am in need of developing a customized transferbox using HTML, JavaScript, and JQuery. The user should be able to select from a list of options and associate them with attributes. This selection process should involve transferring the selected options be ...

Do not request for this element within the array

I have a function that applies to all elements in an array, except for the currently clicked one. For example: cubesmixed = [array, with, 145, elements] cubesmixed[54].click(function() { for(var i = 0; i < 145; i++) { var randomnumber=Math.flo ...

The concept of selective importing within JavaScript

Seeking guidance on configuring conditional imports for a native library that is built for both node and electron. The challenge arises when one project requires the node implementation for testing, while another project needs the electron version. Projec ...

Automatically redirect to the destination by clicking on the href link

import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys #from webdriver_manager.chrome import ChromeDriverManager Base_Li ...

The JavaScript function is returning a value of undefined

I encountered an issue where my Javascript function is returning undefined even though it alerts the correct value within the function itself. I have a setup where I call the function in my 1st controller like this: CustomerService.setName(data.name); A ...

Move the option from one box to another in jQuery and retain its value

Hey guys, I need some assistance with a jQuery function. The first set of boxes works perfectly with the left and right buttons, but the second set is not functioning properly and doesn't display its price value. I want to fix it so that when I click ...

The function is trying to access a property that has not been defined, resulting in

Here is a sample code that illustrates the concept I'm working on. Click here to run this code. An error occurred: "Cannot read property 'myValue' of undefined" class Foo { myValue = 'test123'; boo: Boo; constructor(b ...

Is it possible to utilize a JavaScript framework within a Chrome extension?

Currently, I am developing a chrome extension that adds a toolbar to the DOM dynamically. In order to find, attach, and manipulate elements, I have been using CSS selectors in JavaScript. However, this approach has proven to be fragile as any changes made ...

Is there a way to convert the items in the products variable into the more comprehensive detailedProducts?

New to JS, looking for guidance on transforming the products variable into detailedProducts in JavaScript const products = [ { title: 'Yellow Pail', submitterAvatarUrl: 'images/avatars/daniel.jpg', productImageUrl: 'images ...

Tips for efficiently retrieving all search results from a FHIR server

When utilizing the fetchAll function on an instance of an FHIR Client (specifically HAPI FHIR server), my current goal is to gather all observations with a specific LOINC code. My understanding is that a request is made to the server prompting it to gener ...

The alarm feature is malfunctioning

I have been struggling with a simple alarm application that I created using jQuery and Javascript. The issue lies in the alarm functionality not working as expected. Below is the relevant code snippet: var today = new Date(); var h = today.getHours(); var ...

Implementing complex routing with Express.js on top of Node.js

Recently delving into the world of javascript, I have embarked on creating a RESTful API using Node.js and Express.js Here is the breakdown of my directory structure: /server.js /api/api.js /api/location/location.js My goal is to make the API modular, ...

Discover the hidden content within a div by hovering over it

Here is an example of a div: <div style="width:500px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce quis pulvinar dui. Nulla ut metus molestie, dignissim metus et, tinc ...

Leveraging MongoDB imported documents within DerbyJS

I am facing a challenge with my MongoDB collection which was not saved through my Derby app. My goal is to query that data and pull it into my Derby app. After figuring out the solution, I have written the following code snippet: get '/:year', ...

How to transform a nested string into a JSON object using JavaScript

I am trying to manipulate a nested query string in JavaScript. The string looks like this: var str = "( ( Sentence starts with any of null AND Sentence starts with any of null ) AND Sentence starts with any of null )" I want to split the string at the &a ...

Discovering elements using Selenium in a JavaScript popup box

The issue at hand is rather straightforward. I am faced with the task of clicking on an element within a popup that has been dynamically generated by JavaScript code. The challenge arises as the page is solely accessible in Internet Explorer and the elemen ...