Chromedriver: How to disable PDF plugin
For Chrome 57, I had to use this line instead:
options.AddUserProfilePreference("plugins.always_open_pdf_externally", true);
Additionally, if you ever need to set a plugin yourself you can find it like this:
- Navigate to chrome://settings/content (Menu > Settings, Show advanced settings..., Content settings...).
- Locate the specific preference (checkboxes only).
- Right-click and Inspect the checkbox.
- The preference name is the entire 'pref' attribute's value.
I found that this works for Selenium.WebDriver 2.53m, ChromeDriver 2.25.426923, and Chrome v55.0.2883.87 m.
var options = new ChromeOptions(); options.AddUserProfilePreference("plugins.plugins_disabled", new []{"Chrome PDF Viewer"}); driver = new ChromeDriver(options);
This work for me (if the first link is Chrome PDF Viewer )
driver.Navigate().GoToUrl("chrome://plugins/"); Thread.Sleep(4000); driver.FindElement(By.LinkText("Disable")).Click();