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.
- 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. - 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 {
@keyword
def void startBrowser() {
//WebUI.openBrowser(’’)
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
DriverFactory.changeWebDriver(driver)
break
}
}
}
- 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.