def set_chrome_pref(self): chromeOptions = webdriver.ChromeOptions() prefs = {"download.default_directory": 'des_dir'} chromeOptions.add_experimental_option("prefs", prefs) driver = webdriver.Chrome(chrome_options=chromeOptions)