How to get browser name from the RunConfiguration

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

Output:-
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