How to get browser name from the RunConfiguration

Hey Guys,

I working on a cross browser testing project, where i need to close all the previously opened chrome browsers before launching the new chrome browser.
I am aware that the below code will close the all chrome process

Runtime.getRuntime().exec(“taskkill /IM chrome.exe”)

but I want to do it only when I am launching test in chrome. I don’t want to execute this when I am executing TCs on Firefox.

To put it in simple terms, I want to know the type of browser before even it gets launched.

Thanks in advance.

Hello Ashish,

you can get current driver type (or name) by executong this static method:


It returns DriverType enum member and you can use it in other if-else statement .



if(DriverFactory.getExecutedBrowser().getName() == "IE_DRIVER") {	println "IE"}else {	println "not IE"}

Note that you have to start your WebDriver first - by calling WebUI.openBrowser(url) - otherwise Katalon has no idea what you are about to run.


Hello Marek,

Thanks a lot for the answer, however my specific requirement was to know the browser type in advance even before initializing the browser i.e. driver object.

I knew the answer is hidden in RunConfiguration, so I did hit and trials and found something

Map m = RunConfiguration.getExecutionProperties()

String driverProp = m.get(“drivers”)

println driverProp

system={WebUI={browserType=FIREFOX_DRIVER, geckoDriverPath=C:\fakepath\geckodriver.exe}}, preferences={WebUI={}}}

the above code will give me the execution properties which will be used by openBrowser to init the driver and a simple contains will do the trick.

Thanks Again,

1 Like

Hi Ashish,

you should use this code to get browserType:

Map m = RunConfiguration.getExecutionProperties()String driverProp = m.get("drivers").get("system").get("WebUI").get("browserType")println  driverProp

It will return default browser type to you - if you want this one.


Thanks, Marek! This proved to be very useful to me!

Hi Marek,
Following previous query, i am getting RuntimeException. i tried both but got same error.

  1. DriverFactory.getExecutedBrowser().getName()

  2. Map m = RunConfiguration.getExecutionProperties()

String driverProp = m.get("drivers")Note: before using above code i have already used: WebDriver driver = DriverFactory.getWebDriver()Please do a favour, my requirement is to identity the current running browser is chrome or mozilla?Thanks

I like this because it returned the whole thing, and mostly the part I’m interested, the “preferences” - it prints this:
{system={WebUI={chromeDriverPath=C:\Tools\Katalon_Studio_Windows_64-7.2.10\configuration\resources\drivers\chromedriver_win32\chromedriver.exe, browserType=CHROME_DRIVER}}, preferences={WebUI={acceptInsecureCerts=true, args=[–ignore-certificate-errors]}}}

So I have a question: how do I go about programmatically setting the “preferences” BEFORE WebUI.openBrowser() ?

Yup, I know via project settings->desired capabilities however, I am in CI/CD world where we “gradlew” build Linux packages on the command line and run them in a Docker container. Basically we develop in Katalon IDE, run to make sure they work, and build the packages.

The same query above returns in the container returns “preferences” basically empty when running in the container:
{system={WebUI={chromeDriverPath=/opt/sas/viya/home/test/bin/katalon/configuration/resources/drivers/chromedriver_linux64/chromedriver, browserType=CHROME_DRIVER}}, preferences={ WebUI = {} }

Any pointers here are appreciated.

Answering to myself … but most for future people who comes in.

This should be added :
RunConfiguration.setWebDriverPreferencesProperty( “acceptInsecureCerts”, true )

RunConfiguration.setWebDriverPreferencesProperty( “args”, “[–ignore-certificate-errors]” )

evidently, right before WebUI.openBrowser
One of them should be enough but … why risk ? I’m too tired to test this again tonight.