Disabling PDF Viewer plugin in chromedriver

前端 未结 3 1527
隐瞒了意图╮
隐瞒了意图╮ 2020-12-20 03:08

I\'m trying to batch-download a lot of files within the BlackBoard environment (used a lot on universities/schools around the world). I am able to retrieve the links where t

3条回答
  •  梦毁少年i
    2020-12-20 03:45

    Can you set the plugin to be disable as a preference?

    chromeOptions = webdriver.ChromeOptions()
    prefs = {"plugins.plugins_disabled" : "Chrome PDF Viewer"}
    chromeOptions.add_experimental_option("prefs",prefs)
    chromedriver = "path/to/chromedriver.exe"
    driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=chromeOptions)
    

    See "setting Chrome preferences w/ Selenium Webdriver in Python" and "How to disable Chrome Plugins in Selenium WebDriver using Java".

提交回复
热议问题