How can the executable path for Firefox be specified in Nightwatch?

I've been using nightwatch to run tests on both Chrome and Firefox with great success.

While everything runs smoothly on Chrome, I'm facing an issue when trying to run tests on Firefox on my personal machine.

Currently, due to Marionette's instability, we are testing our software using Firefox ESR, which is supported by selenium without the need for a driver.

On my Linux machine, I have installed both the latest version of Firefox and Firefox ESR.

  • The regular Firefox can be found in /usr/bin/firefox
  • While Firefox ESR is located at /usr/bin/firefox-esr

In Protractor, I can specify which executable to use with the firefox_path property.

However, I haven't yet figured out how to configure nightwatch to use the /usr/bin/firefox-esr path.

Any suggestions?

If you're curious, here's my configuration:

const seleniumPath = /*computed value*/;
module.exports = {
  "src_folders": ["test/e2e"],
  "output_folder": "reports/e2e",
  "detailed_output": false,
  "selenium": {
    "start_process": true,
    "server_path": seleniumPath,
    "log_path": "",
    "host": "127.0.0.1",
    "port": 4444,
    "cli_args": {},
  },
  "test_settings": {
    "default": {
      "launch_url": launchUrl,
      "exclude": ["utils/**/*", "gulpfile.js", "nightwatch*.js"],
      "selenium_port": 4444,
      "selenium_host": "localhost",
      "silent": true,
      "screenshots": {
        "enabled": true,
        "path": "reports/e2e/screenshots",
      },
      "desiredCapabilities": {
        "browserName": "firefox",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
      },
    },
    "test_runner": {
      "type": "mocha",
      "options": {
        "ui": "bdd",
        "reporter": "spec",
      },
    },
  }

Answer №1

Give this solution a try and let me know if it works on your end

    webdriverio: {
     cli_arguments: {
      'webdriver.chrome.driver': '/path/to/chromedriver'
    }
  },

    configuration_settings: {
      default: {
        desiredCapabilities: {
          browserName: 'chrome',
          chromeOptions: {
            binary: '/path/to/chrome'
          },
          javascriptEnabled: true
        }
    }

Answer №2

I haven't had the chance to experiment with multiple Firefox installations, but I would assume that the cli_args should include a property for webdriver.firefox.binary which specifies the path.

This aligns with the other configurations in the Selenium Settings. The setting can be found in the Firefox section of the webdriver documentation, and the same capability is mentioned in the GeckoDriver documentation (even though it may not be applicable in your case).

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

Animated jQuery carousel with a timer countdown feature

Currently, I am developing a jquery slider/carousel to display various promotions. I am seeking a method to indicate the time left until the next promotion appears. Similar to the flash promo on this website: Do you have any suggestions? ...

Challenges with line height in IE when adjusting font size in textarea

I'm facing an issue with adjusting the font size in a textarea using JavaScript. While it works perfectly in Firefox, there are some problems in IE. Specifically, the line-height does not change accordingly. This results in gaps between lines when the ...

Issue with Selenium WebDriver: Loop continues even when two matching values on the same row are detected

I wrote a function that loops through a table twice to find two input values on the same row. However, it's not exiting the loop when rowNo2 and rowNo are equal. What am I missing here? Thanks for your help! WebElement table = oWebDriver. ...

issue with splice function

I have a JavaScript function that is supposed to collect all input values from text boxes and store them in an array. However, I want to remove any input value with the type "button" from the array before proceeding. Here is the code snippet: <!-- lang ...

Display only the selected index and conceal the rest

I am facing an issue where I have added a label and input in ng-repeat. The functionality works fine when the user clicks edit to show the input and hide the label. However, the problem arises when the user clicks on the new button as it displays the new i ...

Obtain an array containing only the specific values of each object

Currently, I have the following code snippet: <db.collection>.find({ id : { $exists: true } }) This query retrieves all documents containing an id property. However, I am interested in transforming this result into an array that contains only the va ...

Is there a way to eliminate unnecessary chunks from MUI in NextJS?

https://i.sstatic.net/zAkV0.png I recently created a single page and noticed that there is a significant amount of unused JavaScript in my codebase. Specifically, I am using MUI and React icons. Any suggestions on how to efficiently manage this issue? T ...

The response from the Ajax request in jQuery did not contain any content to download

I have a PHP script that generates PDF output successfully when accessed directly. Now, I want to fetch this PDF file using AJAX. In pure JavaScript, the following code snippet works well: var req = new XMLHttpRequest(); req.open("POST", "./api/pd ...

How to use jQuery to select an element by using 'this' on a button

I have a total of 5 divs, each containing 5 different texts. <div class="text"> <%= theComment.text %> </div> I am working with node.js, MongoDB, and Mongoose. In addition to the divs, I also have a button labeled EDIT with a cl ...

What could be the reason for the appearance of Next.js compile indicator in my final production build?

Upon completing the development and deployment of a Next.js website, I observed that the black compile indicator continued to appear in the bottom-right corner of my browser, similar to its presence during local development. The indicator can be viewed he ...

Is d3 Version pretending to be a superior version?

I have encountered an issue with my project that involved using d3 v5.5.0. After transferring it to a different computer and running npm install, the application now seems to be recognizing d3 as a higher version? A crucial part of my program relies on th ...

Adding styling to my project using @material-ui v5 has resulted in a CSS rule being injected, although I did not define it myself

I'm in the process of incorporating a simple menu component into my project, and I followed the instructions provided in the documentation. When viewing it in a CodeSandbox, everything appears as expected. However, within my actual project, the menu ...

Saving the POM data structure in a database

One thing I'm sure of is that in the Page Object Model, DOM objects are defined in a class file specific to a certain page in the format shown below: @FindBy(xpath = "//*[@id='page_content_inner']/div/a[1]/div") private WebElement setupBtn; ...

Properly defining a DI service in Angular 2.1.2 using ES5

I have created an Angular 2 service that utilizes the Http service and is accessed by other components. However, I am unsure if my implementation is correct: (function (app) { 'use strict'; app.LoaderService = ng.core.Component({ providers: ...

Is employing setTimeout a legitimate technique for circumventing a stack overflow issue when implementing callbacks?

Let's imagine a scenario where I deliberately create a complex sequence of callbacks: function handleInput(callback) { ... } function fetchData(url, callback) { ... } function processResponse(callback) { .... } function updateDatabase ...

Error loading content for webpack://SwaggerUIBundle/src/core/system.js in Swagger UI

When trying to utilize Swagger UI for documenting a Laravel project using the URL http://localhost:8014/api/documentation, I came across an error displayed in the browser console: Error: Unable to destructure property 'type' of 'u' as i ...

What is causing the scripts to fail when I attempt to press a button?

Clicking on the button is supposed to slowly reveal phone numbers on the page. Here are the HTML Codes: <span id="show-phone-numbers" class="btn btn-success"> <i class="fe fe-phone-call"></i> Show Phone Nu ...

Arranging an array of objects by a specific property in an Angular controller with the help of $filter

In my data set, there is an array of objects referred to as $scope.segments, which looks like this: [ { "_id": "55d1167655745c8d3679cdb5", "job_id": "55d0a6feab0332116d74b253", "status": "available", "sequence": 1, "body_original": " ...

Angular - developing a custom web element to enhance the project

Is there a way to convert a single module into a web component and integrate it within the same project? Specifically, I have 3 modules in my project and I am looking to transform only module1 into a web component and incorporate it seamlessly. Thank you! ...

Choosing elements based on their ng-model attributes using selenium-webdriver

Currently, I am utilizing Ruby along with the gem selenium-webdriver to navigate through a challenging angular form that is beyond my control. My goal is to figure out how to pinpoint elements based on their ng-model attributes. For instance, let's t ...