0

I use Selenium WebDriver to print pages to PDF with Robot class. There are multiple PDF printers installed. I try to set default directory with code:

HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("download.default_directory", mydownloadDirectory);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
WebDriver driver = new ChromeDriver(options);

To set built-in PDF printer as default could be set by this code, but I don't want to disable all the extension.

options.addArguments("--disable-extensions");
plaidshirt
  • 5,189
  • 19
  • 91
  • 181
  • https://stackoverflow.com/questions/15824996/how-to-set-chrome-preferences-using-selenium-webdriver-net-binding might be that will help – Dhru 'soni Nov 05 '18 at 09:16
  • @Dhru'soni : I tried to use this: `options.AddUserProfilePreference("printing.print_preview_sticky_settings.appState", "{\"version\":2,\"isGcpPromoDismissed\":false,\"selectedDestinationId\":\"Save as PDF\");` , but doesn't solved this problem. – plaidshirt Nov 05 '18 at 14:02

0 Answers0