Update Chrome Capabilities at runtime

I just did this combined with your article here:

Steps:

  1. Removed the Capabilities I setup above that failed
  2. Added your CustomWebDriverFactory
  3. Added the capabilities I needed:

HashMap<String, Object> chromePrefs = new HashMap<String, Object>()
String strDownloadPath = RunConfiguration.getProjectDir() + GlobalVariable.Execution_DownloadPath
strDownloadPath = strDownloadPath.replace(‘/’, ‘\’)
chromePrefs.put(“download.default_directory”, strDownloadPath)
chromePrefs.put(“safebrowsing.enabled”, true)
ChromeOptions options = new ChromeOptions()
options.setExperimentalOption(“prefs”, chromePrefs)

  1. Updated my @BeforeTestCase with this:
WebDriver driver = CustomKeywords.'ck.CustomWebDriverFactory.createWebDriver'()
DriverFactory.changeWebDriver(driver)
//WebUI.openBrowser('')
WebUI.maximizeWindow()

Its much easier now. Thank you so much @kazurayam glad to have you in this community. Cheers!