My scripts can run on any machine (linux, windows, server machine). I want to validate the file was downloaded or not when I click on a link in my application. For this, I am creating a folder in my framework, whose location I am loading on runtime (because it is inside my framework).
I want to change the default download location of chrome for which I want ot set “download.default_directory” during execution before starting the chromedriver. I tried many approaches.
- assign the prefs during run time and start my own chromedriver. Later change the web driver in Driverfactory to the driver started by me.
Map<String, Object> prefs = new HashMap<String, Object>();
DesiredCapabilities capabilities = new DesiredCapabilities();
ChromeDriver driver = new ChromeDriver(capabilities);
It doesn’t set the user preference when the driver is started by WebUI.openBrowser ( checked in the logs)
- Overwrite “com.kms.katalon.core.webui.chrome.properties” file with the prefs before starting the WebUI.openBrowser(). (tried both- a. in the test case, b. in the test listener @beforeSuite).
However, it seems that the chrome settings are loaded when the test case is run and it cannot be changed.
The prefs are not set when the chromedriver is started by WebUI. However, if I run the test case again, prefs will be set because the prefs are set in the settings file.
I want to know, is there a way that I can reload the capabilities of chrome during the test case execution before launching the browser?