Need detailed execution settings under Chrome so that I could download a file to a location defined as arguments. Currently, ‘Save as’ dialogue box is opens up. I want to avoid this dialogue box as well. Please suggest with detailed steps asap.
Basically, want to incorporate below code through Katalon:
System.setProperty(“webdriver.chrome.driver”, “/path/to/chromedriver”);
String downloadFilepath = “/path/to/download”;
HashMap<String,
Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put(“profile.default_content_settings.popups”, 0);
chromePrefs.put(“download.default_directory”, downloadFilepath);
ChromeOptions options = new ChromeOptions();
HashMap<String,
Object> chromeOptionsMap = new HashMap<String, Object>();
options.setExperimentalOptions(“prefs”,
chromePrefs);
options.addArguments("–test-type");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(ChromeOptions.CAPABILITY,
chromeOptionsMap);
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(cap);