Configuring a Selenium Firefox profile

While performing our tests, we came across an issue with how FireFox handles events when the browser is not in focus.

We discovered that this problem can be resolved by setting up a FireFox profile with the preference "focusmanager.testmode" set to true (https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/157).

I am curious if you are aware of any other preferences/capabilities/settings that would be beneficial to include in our webdriver profile/configuration?

This could potentially save us a significant amount of time in the future by helping us identify and troubleshoot unexpected issues or behaviors. Any recommendations or advice would be greatly appreciated.

Answer №1

Firefox offers a variety of preferences that can be adjusted to enhance test stability. However, it's important to note, as highlighted by Andrew Regan, that making changes may impact your tests negatively, so it might not be the best approach.

Nevertheless, here are some preferences I use to reduce the frequency of test failures caused by unexpected browser behavior:

// Turn off default browser check
lockPref('browser.shell.checkDefaultBrowser', false);

// Disable session restore
lockPref('browser.sessionstore.resume_from_crash', false);

// Stop auto-updates
lockPref("app.update.enabled", false);
// Double-check that updates are disabled
lockPref("app.update.auto", false);
lockPref("app.update.mode", 0);
lockPref("app.update.service.enabled", false);

// Prevent closing dialogs
lockPref("browser.showQuitWarning", false);
lockPref("browser.warnOnQuit", false);
lockPref("browser.tabs.warnOnClose", false);
lockPref("browser.tabs.warnOnCloseOtherTabs", false);

// Turn off Add-ons compatibility check
clearPref("extensions.lastAppVersion");

// Hide 'know your rights' on first run
pref("browser.rights.3.shown", true);

//Disable plugin checking
lockPref("plugins.hide_infobar_for_outdated_plugin", true);
clearPref("plugins.update.url");

// Disable health reporting
lockPref("datareporting.healthreport.service.enabled", false);

// Stop all data uploads (Telemetry and FHR)
lockPref("datareporting.policy.dataSubmissionEnabled", false);

// Turn off crash reporter
lockPref("toolkit.crashreporter.enabled", false);
Components.classes["@mozilla.org/toolkit/crash-reporter;1"].getService(Components.interfaces.nsICrashReporter).submitReports = false;

// Enable Browser Console command line
pref("devtools.chrome.enabled", true);

To streamline the process of setting up preferences, you may want to consider using a Firefox autoconfig file. Example configuration: https://github.com/cliqz-oss/firefox-autoconfigs

Answer №2

After considering my previous comment, I strongly oppose the idea of having a custom set of preferences or profile settings:

  • to ensure consistency between what's tested and what an average user would experience
  • to avoid the need for browser-specific code
  • as it can complicate troubleshooting issues on platforms like this

In simpler terms, I believe Firefox (and similar browsers) should operate as a black box.

I support the resolution of Firefox bugs and perhaps even the gradual evolution of default behaviors, as long as everyone is in agreement. Testing is already complex without individuals using different workarounds.

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

I am having trouble extracting individual company names from a text file using my current code, as it only retrieves the final company name in the list. How can I

My goal is to scrape company information from a database. I have a text file containing a list of companies that I want Selenium to input into the search field on a website and then scrape the necessary data one by one. The issue I am facing is that for s ...

Exploring the wonders of Lightbox when dealing with content loaded via AJAX

Using Bootstrap 5 along with the Lightbox library from , I encountered an issue. The Lightbox feature functions properly on regular page loads, but fails to load on content loaded via AJAX. I attempted to resolve this by implementing the following code: ...

Using JQuery to handle click events on an array of checkboxes and displaying the value of the selected

I am struggling to show the label text and checkbox value from a checkbox array whenever each one is clicked (for testing purposes, assume I want it to appear in an alert). My HTML looks like this: <label class="checkbox"> <input type="checkbox" ...

Creating a text node in a JavaScript application adds HTML content

Is there a way to append an HTML formatted block to an existing div using appendChild without the HTML code itself getting appended? Any tips on how to add HTML design instead of just code with appendChild and createTextNode? Check out this Fiddle <di ...

When employing Relative Locators, the outcome may lead to an org.openqa.selenium.NoSuchElementException error message in Selenium Java, indicating difficulty in locating an element with an

Currently utilizing selenium 4 to locate elements (Username and password credentials) "Username : Admin Password : admin123" using the Relative Locators feature of selenium 4. However, encountering an issue where the code throws org.openqa.seleni ...

Preserve data on page even after refreshing in Angular

Upon opening my website, I expect to see "Finance/voucher" at the top. However, after refreshing the page, only "Finance" appears which is not what I want. I need it to always display "Finance/voucher" even after a page refresh. I have included all the r ...

Utilizing hooks in node.js functions

Is there a way to apply before and after hooks on a function? I need these hooks to trigger whenever the function is called. While Express.js middleware concept works for routes, I require similar hooks for functions on the server side. function main(){ ...

What is the best approach to concurrently update a single array from multiple functions?

In my React app, I have a form with various input fields and checkboxes. Before making an API call to submit the data, I have functions set up to check if any fields are left blank or unchecked. These check functions are triggered when the form button is ...

Ensuring that only one field is selected with mandatory values using Joi validation

Is there a way to create a validation rule utilizing Joi that ensures if valueA is empty, then valueB must have a value, and vice versa? My current approach involves using Joi for validating an array of objects with properties valueA and valueB. Below is ...

retrieve the preferred item data from the local storage

Having trouble retrieving favorite items from my list item app using Ionic 4. Although my JSON data is added to local storage, I am unable to retrieve the data properly. favourite.service.ts getAllFavoriteItems(){ return this.storage.get("object"); ...

Utilizing WebView for Initiating AJAX Calls

One common question often asked is whether it's possible to make ajax requests using a webview. In my case, the UI will consist entirely of native Android code, but I still need to interact with the backend using ajax calls. Fortunately, I am well-ver ...

Setting response query correctly in Solr using AJAX

Inspired by an example of using Solr's JSON output for AJAX, I have incorporated a drop-down menu into my project form and introduced faceting to the parameters. Parameters: function getstandardargs() { var params = [ 'wt=json' ...

Tips for showing form data upon click without refreshing the webpage

Whenever I input data into the form and click on the calculate button, the result does not appear in the salary slip box at the bottom of the form. However, if I refresh the page and then click on the calculate button, the results are displayed correctly ...

Tips for passing an array to a different function using Jquery

I need to pass an array to another function <div id="test"></div> <div id="test2"></div> <input type="button" value="chk" id="go" /> <script> $(function() { var c = 1; var i = 5; var dat ...

Exploring the possibilities with Rollbar and TypeScript

Struggling with Rollbar and TypeScript, their documentation is about as clear as AWS's. I'm in the process of creating a reusable package based on Rollbar, utilizing the latest TS version (currently 4.2.4). Let's delve into some code snipp ...

Conditional rendering with React.js in the DOM

Just starting out with React and encountering an issue with rendering using reactDom: index.js import ReactDOM from 'react-dom'; import A from 'components/A'; import B from 'components/B'; render(<A />, document.getEl ...

The jQuery code functions smoothly on computers, but experiences delays when running on an iPhone

I was working on my website and trying to add a div that sticks to the top of the browser when it scrolls out of view. I found a script that works well on desktop, but when testing it on iPhone, there is a slight delay before the div pops back up in the ri ...

Updating dropdown selection with JavaScript

I have a dropdown select menu with two options. I am using JavaScript to retrieve the selected value from the drop-down menu and display it in a text area. Here is my code: $(document).ready(function () { $('#pdSev').change(function () { ...

What is the best way to call the app.js function from an HTML page in an Express.js environment

Is there a way to trigger the function init() { // } located in app.js from an HTML page? <a href='javascript:init();'> Trigger init </a> The issue with the code above is that it searches for function init() only on the client side ...

Having trouble uploading several files with Multer functionality?

I've encountered an issue with Multer in Node.js where I can't seem to select and upload multiple files. In a previous exercise, I had no trouble uploading a single file, but now I'm struggling with enabling multiple uploads. What am I mis ...