Web Testing with Firefox

Applies to TestComplete 15.86, last modified on November 07, 2026

Firefox 116 and later use the WebDriver BiDi protocol for automation in TestComplete. Firefox versions 115 and earlier rely on internal Firefox APIs, which could change without notice.

WebDriver BiDi is a standards-based protocol. Some behaviors in Firefox 116 and later might differ from earlier versions. If you run into issues, contact the Support Team.

This topic describes important considerations for automated web testing in Firefox. Due to browser security restrictions, you must start Firefox with the --remote-debugging-port command-line switch when recording or playing back tests. In Firefox 154 and later, you must also use the --remote-allow-system-access switch.

Configuring Firefox 154 and Later

Configure two additional about:config settings in Firefox 154 and later. To open the page, enter about:config in the Firefox address bar and press Enter. Then search for each of the following settings and set its value to false:

  • network.lna.blocking

  • network.lna.enabled

Running the Browser

Due to browser security restrictions, when starting Firefox manually for test recording or playback in TestComplete, you must include the --remote-debugging-port command-line switch.

C:\Program Files\Mozilla Firefox>firefox --remote-debugging-port=9222

In Firefox 154 and later, you must also include the --remote-allow-system-access switch:

C:\Program Files\Mozilla Firefox>firefox --remote-debugging-port=9222 --remote-allow-system-access

You can specify any available port instead of 9222.

The --remote-debugging-port switch enables TestComplete to communicate with Firefox.

Note: TestComplete’s Run Browser operation automatically appends the required --remote-debugging-port switch and selects the first available port. If you use Run Browser, no additional configuration is required. In Firefox 154 and later, you must still change the about:config settings described in Configuring Firefox 154 and Later.

When starting Firefox from the Tested Apps list, specify firefox.exe as the executable and include the --remote-debugging-port switch in the command-line parameters. In Firefox 154 and later, also include the --remote-allow-system-access switch.

Additional Limitations

  • Only one Firefox instance can be active during test recording or playback.

  • To close browser tabs, use the following script temporarily:

    Sys.Browser("firefox").Page("http://your-page-url.org").Close();

  • Firefox must be started with the --remote-debugging-port command-line switch. In Firefox 154 and later, it must also be started with the --remote-allow-system-access switch. The --remote-debugging-port port enables TestComplete to connect to Firefox. Ensure the specified port is available and not blocked by firewall rules.

  • After the remote debugging connection is established, TestComplete uses the WebSockets protocol (localhost) for internal communication with the browser. By default, TestComplete attempts to use port 8080 and checks sequential ports if that port is unavailable.

    The WebSockets port is separate from the --remote-debugging-port specified when starting Firefox. If WebSockets are disabled or blocked, communication fails and testing is not possible.

  • To confirm a dialog box, use the script:

    Sys.Browser("firefox").Page("http://your-page-url.org").ConfirmAlertDialogOK();

  • To cancel a confirmation dialog box, use:

    Sys.Browser("firefox").Page("http://your-page-url.org").ConfirmDialogCancel();

Accessing Extended JS/HTML Properties

To retrieve specific HTML or JavaScript properties in your test, use scripting. Full object-based access is not currently available.

Use the following sample to get the number of columns in the first table on a page:

function GetNumberOfColumnsInTheFirstTable() {
 var numberOfColumns = Sys.Browser("firefox").Page("https://your-page-url.org").Eval(" \
 (function() { \
  var table = document.getElementsByTagName('table')[0]; \
  var headerRow = table.rows[0]; \
  var numberOfColumns = headerRow.cells.length; \
  return numberOfColumns; \
 })(); \
 ");
 Log.Message("numberOfColumns=" + numberOfColumns);
}

The Eval function executes the provided string as a client-side script in the context of the web page, similar to using a browser’s developer console.

See Also

Preparing Web Browsers
Classic Web Testing
Requirements for Web Testing

Highlight search results