Reputation: 31
I did put that configuration on Chrome
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddUserProfilePreference("download.default_directory", @"C:\Downloads");
Driver.driver = new ChromeDriver(chromeOptions);
The PDF is opening in the browser in other tab, I don't have button to download.
I'm not able to clic on the element by id.
ActionsSU.moveElementToClick(By.XPath("/html/body"));
ActionsSU.moveElementToClick(By.Id("download"));
Upvotes: 1
Views: 871
Reputation: 31
I have the solution.
chromeOptions.AddUserProfilePreference("download.default_directory", @"C:\Downloads");
chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
chromeOptions.AddUserProfilePreference("download.directory_upgrade", true);
chromeOptions.AddUserProfilePreference("plugins.always_open_pdf_externally", true);
Upvotes: 2