JavaScript errors in the FireFox browser do not display when using FireFoxDriver

Below is the code I am using to detect JavaScript errors while performing Selenium tests:

public static void AssertNoJavaScriptErrorsInLog(this RemoteWebDriver driver)
{
    var errorStrings = new List<string> { "SyntaxError", "EvalError", "ReferenceError", "RangeError", "TypeError", "URIError" };

    var jsErrors = driver.Manage().Logs.GetLog(LogType.Browser).Where(x => errorStrings.Any(e => x.Message.Contains(e))).ToList();

    if (jsErrors.Any())
    {
        Assert.Fail("JavaScript error(s):" + Environment.NewLine + jsErrors.Aggregate("", (s, entry) => s + entry.Message + Environment.NewLine));
    }
}

During one of my tests, an error appears intermittently:

Assert.Fail failed. JavaScript error(s):
TypeError: doc.documentElement is null
TypeError: doc.documentElement is null

I attempted to check the FireFox browser console after the test failure, but it was empty!

Why are the JavaScript errors not visible in the browser console?

Answer №1

It appears that you may be encountering a recent selenium bug:

To address this issue, try reverting back to selenium version 2.52.


Additionally, there can be occasional compatibility challenges between selenium and firefox, resulting in various symptoms - experiment with different versions of firefox (older versions can be found here) to determine if the JavaScript error still persists.

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

Transferring a uint8clampedarray Array to C# using JavaScript via ajax after extracting getImageData from the Canvas

Currently, I am facing an issue while attempting to create a signature using client-side javaScript and then forwarding the result to the back-end (c#) via ajax. The array I am trying to transmit is of the type uint8clampedarray, but unfortunately, the Set ...

The state of the UI is not updating to reflect the selected item in React Native

I'm working on a component that needs to display all ingredients from my database, but I'm encountering issues with the state not updating as expected. Here are the variables: const image = require('../../assets/backgroundMeal.png'); ...

Send the user to a specified destination

Currently, I am working on creating a form that allows users to input a location and have the page redirect to that location after submission. However, I am facing difficulty in determining how to set the value for action="" when I do not know what the loc ...

Exploring the power of JavaScript template literals within the Document Object Model

I am curious as to why this particular template literal is not functioning correctly when I try to implement it using JavaScript DOM for styling CSS. Any assistance in helping me understand this issue would be greatly appreciated! let weatherColors = [& ...

Choosing the Right Language for AngularJS 2: TypeScript, JavaScript, or Dart?

AngularJS 2 is on the horizon, and the documentation recommends three languages: Typescript, Javascript, and Dart. As someone who primarily works with Javascript EcmaScript 5, I'm curious about the strengths and weaknesses of these three options. Cu ...

Encountering difficulties in compiling Dynamic HTML with the $compile function

I'm attempting to incorporate dynamic HTML into my code with the following lines: var el = $compile('<a ng-controller=\"tableController\" ng-click=\"open\">...ReadMore</a>')($scope); But I'm encounterin ...

What is the best way to generate dynamic components on the fly in ReactJS?

Could you please guide me on: Techniques to dynamically create react components, such as from simple objects? Is it possible to implement dynamic creation in JSX as well? Does react provide a method to retrieve a component after its creation, maybe b ...

Prisma data is not being returned as an array in getServerProps with React Next.js

My Journey with Next.js and Prisma Having recently grasped the concept of getServerProps, I embarked on a project that involved retrieving data from a PostgreSQL database using Prisma. However, despite diligently following the syntax rules outlined in the ...

Utilizing cucumber for feature-level data tables

I am facing a situation where I have multiple scenarios in the same feature file that need to share a data table. This would simplify things for users as they wouldn't have to duplicate test data across different tables within the feature. For exampl ...

Iterating over a loop to display a specific selection of elements from a list

Just starting out with coding and posting for the first time here. I apologize if this question has already been answered, but I'm not sure what exactly to search for anyway... I'm working on a for loop to render elements from an array pulled fr ...

How can I avoid having all expand-transitions occur simultaneously in Vuetify?

I am currently working on a page that includes several cards, each with its own v-expand-transition. These cards are being generated through a v-for loop. The issue I'm facing is that when I click on one v-expand-transition, all of the transitions ope ...

What is the best way to extract the URL of a dynamic link that changes with every query using the SeleniumBase module in Python?

Inspecting the HTML code: The unique sequence file can be accessed through the following links: <a href="/cgi-bin/elimdupesv2/elimdupes.cgi?id=4ROEFYUD&amp;output=unique_default.Fasta">View</a> <a href="/cgi-bin/elimdupes ...

Animating a gradient within an SVG element following along an SVG path

I successfully created an SVG egg and animated a path while adding a gradient, but I am facing an issue. The linear gradient goes from top to bottom, but I want the dark color at 0% and the light color at 100%. Essentially, I want the gradient to follow th ...

Locate the container using the Xpath that targets elements with the identical class

Working on a Selenium test script for a Java application that generates a new ID after each login session. Because of this, I am unable to locate elements using IDs. Is there a way to identify the second or third class in an XPath with the same name witho ...

Is it better to create routers on the client side using React, or should one opt to use Express router on the server

As I embark on my journey to learn React, I have been delving into books for guidance. However, one question that lingers in my mind is how to elevate my application to a more professional level. I recently came across react-router-dom and explored the i ...

Generate an Array reference using the index of elements instead of duplicating the values

When initializing b, it appears that the array data is being copied from a instead of referencing it, as originally intended: let a = [0,1]; let b = [a[0], 2]; a[0]=3; console.log(b); The resulting output is 0,2. What is the reason for the output not ...

Expanding the MatBottomSheet's Width: A Guide

The CSS provided above is specifically for increasing the height of an element, but not its width: .mat-bottom-sheet-container { min-height: 100vh; min-width: 100vw; margin-top: 80px; } Does anyone have a solution for expanding the width of MatBott ...

An issue arises with React hooks: useMemo and useEffect display a Missing dependency error when attempting to invoke a function

triggerData function is being utilized in multiple functions. However, if I place the function inside the useEffect to prevent missing dependencies, then I am unable to call the triggerData outside of the useEffect i.e., in buildData. How can I resolve the ...

Arranging null values and numbers to imitate the behavior of the tabindex HTML attribute

Currently, I am facing a rather unusual issue with JavaScript sorting. As I delved into the complex world of sorting, I found myself in need of some guidance: My goal is to replicate the functionality of the tabindex HTML attribute, which alters the order ...

Retrieving JavaScript array elements following the repeated appearance of a specific element

I have an array in JavaScript which looks like this: var myArray = ['a', 'x', 'b', 'x', 'x', 'p', 'y', 'x', 'x', 'b', 'x', 'x']; I am ...