Enabling JavaScript on Firefox in Ubuntu using Selenium WebDrivers

Having trouble with selenium-webdrivers on Ubuntu. Everything seems to be working well except for Firefox, which has JavaScript disabled. When visiting a website that requires JavaScript, I get the noscript error message displaying "

<noscript>Javascript is required ....
".

Is there a way to enable JS on Firefox in Ubuntu or is this a failure of Selenium where I need to modify the driver?

Code:

require 'rubygems'
require 'headless'
require 'selenium-webdriver'
@headless = Headless.new
@headless.start
@driver = Selenium::WebDriver.for :firefox
@driver.navigate.to 'URL'
... actions
@headless.destroy

The website seems to navigate using HTTP headers and Ajax.

If anyone has any ideas, I would appreciate it.

Everything works fine on my development machine (Windows 10).

Regards,

Mat

EDIT

With newer modules, you will need Firefox 65+ as it comes with its own headless module. Now everything is running smoothly and fast. Also, make sure to use the latest Geckodriver as it may not work with older versions of Firefox.

Answer №1

Check out the comment below...

If you're looking for an alternative solution, you can try installing a Firefox add-on that disables JavaScript. I successfully used this method with Firefox 45 ESR, selenium-webdriver (2.53.4), and capybara (2.8.1):

profile.add_extension(File.expand_path('../quickjava-2.1.0-fx.xpi', FILE))

Make sure to set up the extension to disable JavaScript by default.

profile['extensions.thatoneguydotnet.QuickJava.startupStatus.JavaScript'] = 2

Don't forget to disable loading the extension's first-run tab as well.

profile['extensions.thatoneguydotnet.QuickJava.curVersion'] = '2.1.0'

For more information, please visit: Disabling JavaScript when using Capybara + Selenium

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

Is it possible for the Redux state to become unsynchronized?

const SortingFunction = ({ dataState, updateState }) => { const handleClick = () => { const newState = JSON.parse(JSON.stringify(dataState)) // Make necessary updates to the new state based on the current dataState updateState(newStat ...

Recognizing JavaScript in Intellij IDEA within a script tag that does not specify the type as "text/javascript"

Using the MathJax javascript library has presented a challenge for me. Whenever I make changes to the MathJax configuration, I encounter issues because it is written in javascript but its type is labeled as "text/x-mathjax-config". This causes Intellij Ide ...

Returning Props in Dynamic Components with Vue 3

Exploring the capabilities of Vue3's Dynamic Component <component>, I am currently working with this setup: Component 1: <template> <div> <h1> Name Input: </h2> <Input :model="props.name" /> ...

Breaking circular dependencies in JavaScript is a common challenge that developers face when

Having encountered a circular dependency issue between certain JS files, I am seeking steps to resolve it. Q1: Is repositioning the require function an appropriate solution? One suggested approach to resolve this issue is to move the require() statement ...

Component's state not reflecting changes after dispatching actions in Redux, though the changes are visible in the Redux DevTools

When a menu item is clicked, I execute the following code: import React, { Component } from 'react'; import 'react-dropdown-tree-select/dist/styles.css'; import { connect } from 'react-redux'; import '../../../css/tree.c ...

Creating a new ES-6 class to extend express-js: Issues with binding getter and setter properties

I am intrigued by the idea of utilizing Express within an extended class. My goal is to create getter and setter methods for a property, but I'm facing the issue of these methods not being bound to the instances as desired. One way to work around this ...

Data retrieval error, function returned instead of expected value

Hey everyone, I'm currently working on fetching data using the GET method and I would like the data to be displayed after clicking a button, following standard CRUD operations. As a beginner in programming, I could use some help. Any assistance is gre ...

In the realm of JavaScript, "this" is a key player when referring to an object within a factory

I created some JavaScript classes and FunctionFactories for them, but I believe there are errors in my implementation. To make the code more understandable, I decided to rename certain parts of it. The main class is called the "root"-class, which has chi ...

The Angular TypeScript service encounters an undefined issue

Here is an example of my Angular TypeScript Interceptor: export module httpMock_interceptor { export class Interceptor { static $inject: string[] = ['$q']; constructor(public $q: ng.IQService) {} public request(config: any) ...

Performing conditional statements in Protractor - utilizing `if` and `

I encountered a situation where selecting 'public' causes no issues, but choosing 'private' requires a popup modal to appear upon clicking 'ok.' HTML code: <div ng-show="private" class="privateSetting"> <h5> ...

An error is occurring when trying to locate the server side URL using $.ajax

I am a beginner when it comes to working with servers and ajax, so I might provide unnecessary information or forget to mention important details. Please let me know if either of these is the case. In my project, I have a main.js and test.js file. Using e ...

Retrieve information from arrays within objects in a nested structure

I am working with structured data that looks like the example below: const arr = [{ id: 0, name: 'Biomes', icon: 'mdi-image-filter-hdr', isParent: true, children: [{ id: 1, name: 'Redwood forest& ...

What is the best approach for executing a series of ajax requests in sequence?

One of my buttons named button1 triggers a redirection to www.first.com upon clicking. This initial URL contains another redirect to www.second.com in its response. By intercepting the request with an AJAX call, I am able to redirect from www.first.com to ...

Issue with HTTP headers not being effective in $.AJAX request

Regardless of the method I attempt to use for setting headers in an AJAX call, and no matter which header I set, every time there is a header present, the AJAX call is aborted and does not go through. However, if I try to make the call without setting any ...

AngularJS restricts the display of elements to only 4 using the limitTo filter

I'm facing an issue with my filters. I have a JSON dataset that I need to display on my website, but I only want to show 4 elements that meet a certain criteria. Here's the code snippet: <div ng-repeat="place in places | limitTo: 4 | filter: ...

Update the hidden input's value by the ZIP code entered

I'm currently working on setting up arrays for specific regions and then comparing them to the zip code entered in order to designate the value of a hidden field (which signifies the region). No matter what I input, it always seems to result in "Not F ...

Ways to restrict the character count in a form input field

I need to limit characters in an input box on a form to 140, but I am struggling to figure out how to do it. Using Angular on the front end. The code for the input section where I need a text limit is in new.html <div class="form-group"> <lab ...

The exact location of the mouse is currently unknown

When I try to double click on a td, it should change the value of an input field to display the coordinates of the mouse cursor. However, instead of showing the coordinates, it just displays unidentified. How can I modify this script to fix this issue? Her ...

Tips for Embedding React into a Specific ID using Hooks on an HTML Document

I am currently diving into the world of React hooks. While I understand class components, Hooks seem to be missing a specific render section. When adding React to a webpage (without using CREATE REACT APP), how do I specify where my hook should run on the ...

CSS compatibility across different browsers

Check out my jsFiddle for an example of an onHover event that changes the image. It's working perfectly in chrome, but not quite right in firefox. Any suggestions on how to fix it? Here's the jQuery function I'm using: $(document).ready(fu ...