Override desired capabilities at runtime

Hi.

I’m need to set the desired capabilities in code, before the browser open.

I have done like in :

https://docs.katalon.com/katalon-studio/docs/override-desired-capabilities-at-runtime.html

But it don’t work ; the same props work if i put them by the menu settings …

Thanks for the help

My code is :

import com.kms.katalon.core.configuration.RunConfiguration

/**

  • Setup test suite environment.
    */
    @SetUp(skipped = false)
    def setUp() {
    RunConfiguration.setWebDriverPreferencesProperty(“browser.download.manager.showWhenStarting”, false)
    RunConfiguration.setWebDriverPreferencesProperty(“browser.helperApps.neverAsk.saveToDisk”, “text/csv”)
    RunConfiguration.setWebDriverPreferencesProperty(“browser.helperApps.neverAsk.openFile”, “text/csv”)
    RunConfiguration.setWebDriverPreferencesProperty(“browser.download.folderList”, 2.0)
    RunConfiguration.setWebDriverPreferencesProperty(“intl.accept_languages”, “fr”)
    RunConfiguration.setWebDriverPreferencesProperty(“browser.download.dir”, “C:\XXX\YYY”)
    }

See if this helps:

1 Like

hi,

change the chrome browser to use external chromedriver and use it in your test instead of Katalon chromedriver
//Use Katalon chromedriver
WebUI.openBrowser('')
WebUI.navigateToUrl('http://www.google.com')
WebUI.closeBrowser()

//use external chromedriver
ChromeOptions options = new ChromeOptions();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
System.setProperty("webdriver.chrome.driver", C:\\Users\\xxxx\\Desktop\\driver\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver(capabilities);
DriverFactory.changeWebDriver(driver)

WebUI.openBrowser('')
WebUI.navigateToUrl('http://www.google.com')

WebUI.closeBrowser()
1 Like

you go to project settings :
1- desired capabilities
2- WebUI
3- you choose the browser you want to customize (my example firefox)
4- you put on value field the Binary path of the browser you want to launch with
as shown below :