How to set Firefox -profile in Katalon Studio 6.2.1

I’m relatively new to Katalon Studio and have a new problem running existing test cases using the Firefox browser. I’m using Katalon Studio version 6.2.1, and FFX 68. I’ve seen some articles from ~2018 that involve writing Groovy code. Seems like the solution should be a property setting to pass the correct -profile.

When I run the test cases, the Firefox that is launched from Katalon Studio is not using my default profile, rather a temporary profile. Using FFX about:support I see the Profile Folder is set to: C:\Users<my-user>\AppData\Local\Temp\rust_mozprofile.gkMxvW5NIulz When using the correct profile folder, it should be using C:\Users\my-user>\AppData\Roaming\Mozilla\Firefox\default

As a result, it does not have access to some local credentials (certificates) and can’t authenticate to my web application. I think the problem might be solvable if I can configure Firefox to use an existing profile rather than creating an anonymous profile.

I’ve tried using the Katalon Studio Preferences > General > Web Browser > Use Internal Browser , then checking Firefox, then add the following Parameters: -profile “C:\Users… rest of the path to my profile folder” This setting doesn’t seem to be honored by Katalon Studio. However, this is the documented parameter for starting Firefox from the Windows 10 command line.

This seems like it should be a very straightforward configuration parameter in the tool, not custom code in the test script. Thanks for any tips on how do configure this.

  • Chris

This issue has been fixed by my team mate (Dennis) by doing the following - this solution combines a Global Variable in a Katalon Profile with a custom keyword.

  1. Add a new variable in a profile - this is done in your Katalon project, go to Tests Explorer under Profiles > Default and set the following:
    Name = G_FFProfile
    Value = (this is the name of your firefox profile containing your certs, extensions, bookmarks, etc. that you need to run your tests)I created a new firefox profile and called it Katalon and then used Katalon for the Value above. Ensure your certs are available in the chosen profile.
  2. In Katalon Test Explorer, under Keywords, create a custom keyword (i.e. startBrowserWithProfile) and copy/paste/save the following code (taken from post by kazurayam) into the new custom keyword:

import org.openqa.selenium.WebDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxProfile
import org.openqa.selenium.firefox.internal.ProfilesIni
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.driver.WebUIDriverType
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable

public class startBrowserWithProfile {
def void startBrowser() {
WebUIDriverType executedBrowser = DriverFactory.getExecutedBrowser()
switch(executedBrowser) {
case WebUIDriverType.FIREFOX_DRIVER: // “Firefox”
ProfilesIni profile = new ProfilesIni();
FirefoxProfile FF = profile.getProfile(GlobalVariable.G_FFProfile);
FirefoxOptions options = new FirefoxOptions().setProfile(FF);
System.setProperty(‘webdriver.gecko.driver’, DriverFactory.getGeckoDriverPath())
WebDriver driver = new FirefoxDriver(options);
// let Katalon Studio to use the WebDriver created here

  1. In your Katalon script, replace the “Start Browser” keyword by selecting Add > Custom > Keyword and selecting the new custom keyword (i.e. startBrowserWithProfile) from the list.

@jonesste I tried this because I need to run Firefox without it asking to allow location permission and it is not working for me. I am getting error messages for @keyword and the
System.setProperty(‘webdriver.gecko.driver’, DriverFactory.getGeckoDriverPath())

does not like webdriver part. Do you have any recommendations?

@tgeabler be sure you have the import for DriverFactory and all those other imports and be sure the code above is copy/paste into a custom keyword (see #2 above) and be sure you wrote a Katalon manual script (see #3 above) that is using the custom keyword

@jonesste, hello :slight_smile:

I have tried as you mentioned but i got error as shown below:

Any solution please?