Firefox: Opens in a new window instead of a new browser tab

Hello, I have a test where I click on a View Report link which will open the PDF in a Report Viewer in a new browser tab which is the expected behavior. This test works as expected in Chrome and Edge Chromium. However it fails in Firefox due to a setting in Firefox which opens the PDF in a new window instead of a new browser tab. When opening the Firefox run by the automated tests the “Open links in tabs instead of new windows” checkbox is always unticked.

As part of my research, I searched the forums and found other users have had similar issues. I tried the following:

This was the code I used:

def setFirefoxPreferencesInProfile() {
		FirefoxProfile profile = new FirefoxProfile()
		FirefoxOptions options = new FirefoxOptions()
		options.addPreference("", 3)
		WebDriver driver =  new FirefoxDriver(options)

Note: I tried both with setting a new profile and without. Both do not allow me to set the preference as it shows the same “frozen” error message.

When researching this “frozen” error, it looks like some preferences are frozen and cannot be changed as per java - Selenium cannot set preference for - Stack Overflow

Is there another way to set the setting “Open links in tabs instead of new windows” in Firefox?

I am using version 8.6.8. My Firefox version is v120.0.


1 Like

Can any one in the Katalon Support team help with this? I have a full license to KSE. @Eve_2024

try with this setting


The problem is that FirefoxProfile doesn’t allow use to modify some preferences. You can use FirefoxOptions instead. Eg:

System.setProperty("webdriver.gecko.driver", DriverFactory.getGeckoDriverPath());
FirefoxOptions ff = new FirefoxOptions()
ff.addPreference("", 3)

FirefoxDriver fd = new FirefoxDriver(ff)

DriverFactory.changeWebDriver(fd)'Object Repository/Page_User contributions - MediaWiki/a_Help'))