Execute tests using Selenium version 3.4.0 on outdated Firefox version 41.0

After hours of searching the internet in vain, I have yet to find a solution. My current challenge involves testing my app on older versions of Firefox (specifically v41.0) for certain reasons. To facilitate this, I am utilizing a Selenium docker image for the hub (v3.4.0) and another docker image for the Firefox node (v41.0).

I am aware that Geckodriver is not compatible with older versions of Firefox, but it seems a possible workaround is using:

{ "marionette": true }

The Firefox node successfully connects to the grid. I can access it using

docker exec -it <container-id> bash
, but issues arise when running the test.

Despite ongoing efforts, I am currently stuck. Here is the Dockerfile code for the Firefox node: [link] and here is the test code (using MochaJS).

test.it("should redirect to Google with FIREFOX 41.0", () => {

    var firefoxCap = Capabilities.firefox();
    firefoxCap.set('marionette', true);

    driver = new webdriver.Builder()
        .usingServer(CONSTANTS.SELENIUM_HUB)
        .withCapabilities(firefoxCap)
        .build();

    driver.get(CONSTANTS.GOOGLE_URL);
    driver.wait(until.titleIs(CONSTANTS.GOOGLE_TITLE));
    driver.wait(until.elementLocated(By.name(CONSTANTS.GOOGLE_SEARCH_KEY))).sendKeys(CONSTANTS.GOOGLE_SEARCH_VALUE);
    driver.findElement(By.name(CONSTANTS.GOOGLE_SEARCH_BUTTON_NAME)).click();
    driver.wait(until.titleIs(CONSTANTS.GOOGLE_SEARCH_TITLE));
    driver.wait(until.elementLocated(By.tagName(CONSTANTS.GOOGLE_RES_LINK))).click();
    driver.wait(until.titleIs(CONSTANTS.GOOGLE_TITLE));
    driver.quit();
});

Here are the logs:

~/dev/selenium-grids/src$ mocha --timeout 30000 tests.js 
Starting the tests...

  Work with REMOTE URL
    1) should redirect to Google with FIREFOX 41.0

  0 passing (6s)
  1 failing

  1) Work with REMOTE URL should redirect to Google with FIREFOX 41.0:
     WebDriverError: Missing 'marionetteProtocol' field in handshake
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'd4b3266d29f4', ip: '172.17.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-87-generic', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
(remaining stacktrace omitted)

Closing the tests

When searching for solutions to the issue - because "Google is your friend" - the responses suggest either updating Firefox or downgrading Selenium versions, neither of which are viable options for me. Can anyone provide guidance on how to resolve this? Even a temporary workaround would be greatly appreciated.

Thank you

Answer №1

When utilizing Selenium 3.4.0 together with Mozilla Firefox 41.0, it is necessary to downgrade your geckodriver to either version v0.17.0, v0.16.1, or v0.16.0.

The most recent dependencies were as follows:

geckodriver v0.18.0 now recommends using Firefox 53 and newer

geckodriver v0.16.0 is only compatible with Selenium 3.4 and above

If the absolute path of geckodriver.exe falls within your System/User Path, you must explicitly set the marionette property to false (required)

Your code snippet should resemble the following:

test.it("should redirect to Google with FIREFOX 41.0", () => {

    var firefoxCap = Capabilities.firefox();
    firefoxCap.set('marionette', false);

    driver = new webdriver.Builder()
        .usingServer(CONSTANTS.SELENIUM_HUB)
        .withCapabilities(firefoxCap)
    .build();

Java Code for launching legacy Mozilla Firefox 47.0.1 (geckodriver v0.16.1) :

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Opening_FIREFOX_legacy 
{
    public static void main(String[] args) 
    {
        System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver-v0.16.1-win64\\geckodriver.exe");
        DesiredCapabilities dc = DesiredCapabilities.firefox();
        dc.setCapability("firefox_binary", "C:\\Program Files\\Mozilla Firefox47\\firefox.exe");
        dc.setCapability("marionette", false);
        WebDriver driver = new FirefoxDriver(dc);
        driver.manage().window().maximize();
        driver.get("https://google.com");
    }
}

Python Code for launching legacy Mozilla Firefox 47.0.1 (geckodriver v0.18.0) :

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox47\firefox.exe')
caps = DesiredCapabilities().FIREFOX
caps["marionette"] = False
driver = webdriver.Firefox(capabilities=caps, firefox_binary=binary, executable_path="C:\\Utility\\BrowserDrivers\\geckodriver.exe")
driver.get('https://stackoverflow.com')

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 sequence of Javascript Execution for the event of window.location.href?

After browsing through this discussion on asynchronous JavaScript location.href call and watching a video explaining the event loop, I found no clear explanation regarding the behavior of href within window.location: The script order in the source code is ...

ng-class will not activate a custom directive

I have developed a custom AngularJS directive that should work on elements with the specified class name .collapse. However, when I apply this class using Angular's ng-class directive, the custom collapse directive does not get activated. Here is a ...

Unable to access the users property of the discord.js client

I encountered an issue with the blacklist command that I can't seem to resolve, despite trying multiple solutions. Discord.js version: 13.6.0 Node.js version: 16.13.2 Command snippet: const { MessageEmbed } = require('discord.js'); mod ...

Can AJAX Delete requests be executed without using jQuery?

Is it possible to use AJAX delete request without using jQuery? My JSON object at localhost:8000 appears like this: { "Students":[{"Name":"Kaushal","Roll_No":30,"Percentage":94.5}, {"Name":"Rohit","Roll_No":31,"Percentage":93.5}, {"Name":"Kumar ...

Shuffle the JSON data before displaying it

Just a heads up, the code you're about to see might make you cringe, but I'm doing my best with what I know. I've got a JSON file with a bunch of questions, here's what it looks like: { "questions": [ { "id": 1 ...

Is it possible to remove filters from image links but still apply filters to links within the same div?

Is there a way to use hue-rotate to change the colors of my text links without affecting my image links? I have tried removing the effect from images only, but haven't been successful. Any suggestions on how to achieve this? I created a JavaScript but ...

Configuring ESLint and Babel

Currently, I'm implementing ESLint into my project with the Airbnb style guide and Husky for pre-commit checks. Unfortunately, I encountered an issue where ESLint is flagging errors related to 'import/no-unresolved' when using path aliasing ...

Ways to programmatically compare all elements between two separate arrays

Is there a way to create a process where the first loop iterates through the elements of one array, while another loop goes through a second array and compares each element in the first array with all elements in the second array? For example: //first loo ...

Gather information from functions that are continually updated with each React refresh

**import { controls } from "../../../constants/controls"; import { useKeyPress } from "../../../hooks/useKeyPress"; import { useArena } from "./useArena"; const getDamage = (attacker, defender) => { let damage = attacker ...

In ReactJS, when you encounter TextField values that are "undefined", it is important to handle them appropriately

I'm a beginner when it comes to ReactJs and Material-UI, so please bear with me if my question seems silly. Currently, I have a file named Main.js which includes the following code snippet: handleChange = (name, event) => { if(event==null) ...

Using Selenium and Python to download audio files that require JavaScript to load

Currently, I am in the process of developing a script to streamline the task of downloading text and audio files from a specific website using Python and Selenium. The targeted website is: (yyyymmdd) import requests from time import sleep from selenium ...

Tips for incorporating material-ui icons into the column component of a data-grid component

I am currently working with the material-ui data-grid and I would like to display Edit icons from material-ui next to each row. Unfortunately, the data-grid does not provide any props specifically for this purpose. Below is the code snippet: import React ...

Controlling opacity with jQuery animate() function using a click event

I have a specific requirement for an animation. When the button is clicked, I need the element to transition from 0 opacity to full 1 opacity within 300 milliseconds. The issue I am facing is that when the button is clicked, the animation does not work a ...

Is there a way to specify the width of an element as "fill_parent"?

Initially, I must mention that this question may appear similar to mine, but it is actually different. My HTML code is as follows: .parent{ border: 1px solid gray; width: 70%; } .title{ border: 1px solid green; } .input { /* width: fill_paren ...

Encountering an empty array in PHP when making a request with $.ajax

Currently, I am utilizing a jQuery $.ajax script: var data = JSON.stringify( selected_products ); $.ajax({ type: "POST", url: "addtocart.php", data: data, dataType: 'application/json' }); This script is connected to a basic PHP ...

What is the best way to invoke a function within a controller from a .factory service?

I have been working on a code snippet where I am trying to create a generic function. This function, when given the name of a function in my controller, should be run from a factory. app.factory('myfactory', function () { return { cre ...

Download an image file using JavaScript and HTML from a specified image URL

As someone who is new to JS and HTML, I am currently working on a project involving the creation of pie charts using Google Charts through an HTML API. I've successfully generated the chart and obtained the image URL. However, when I use window.open( ...

Tips on ending the rendering process of a component within app.js

<div className='App'> <SideBar /> <Routes> <Route path='/' element={<Body />}> <Route path='/' element={<Home />} /> <Route path='setting' element={&l ...

What is the best way to incorporate modules into the client side of TypeScript projects?

I'm currently developing a TypeScript project for client-side JavaScript code. Prior to using TypeScript, I used to import a module in vanilla ES6 JavaScript like this: import * as THREE from 'https://threejs.org/build/three.module.js'; H ...

Execute a script to display an alert and redirect on Internet Explorer before an error occurs in Gatsby

I am currently operating a Gatsby site through Netlify, and I have encountered a specific error or crash that is only affecting Internet Explorer. In order to address this issue, I want to display an alert to users on IE and then redirect them to the Chrom ...