Opening Firefox with a Specific, non anonymous profile

You can open Firefox with a specific, non anonymous profile in Katalon Studio; though it is a bit cumbersome.

I made a Test Case like this and tried. I got success:

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
//WebUI.openBrowser('')
WebUIDriverType executedBrowser = DriverFactory.getExecutedBrowser()
switch(executedBrowser) {
    case WebUIDriverType.FIREFOX_DRIVER:          // "Firefox"        ProfilesIni profile = new ProfilesIni();
        FirefoxProfile FF = profile.getProfile("SeleniumFF");
        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
        DriverFactory.changeWebDriver(driver)
        break
}
WebUI.navigateToUrl('http://demoaut.katalon.com/')
WebUI.comment('>>> opened http://demoaut.katalon.com/ in FireFox with SeleniumFF profile')
WebUI.closeBrowser()

Perhaps the following line is interesting for you.

        DriverFactory.changeWebDriver(driver)

by this line, you can tell Katalon Studio to use the WebDriver object you created.

I did this experiment using Katalon Studio 5.4.2

2 Likes