I\'ve written a script in python in combination with selenium to download few document files (ending with .doc) from a webpage. The reason I do not wish to use request
Use this code while declaring the Driver object (This is for Java, Python will also have a similar way to accomplish it) This will download the file to the specified location every time.
//Create preference object
HashMap chromePrefs = new HashMap();
//Set Download path
chromePrefs.put("download.default_directory","C:\\Reports\\AutomaionDownloads");
chromePrefs.put("download.directory_upgrade", true);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
//Call the Chrome Driver
WebDriver driver = new ChromeDriver(options);