self.option = ChromeOptions()
# self.option.add_argument("--user-data-dir=" + r"C:/Users/EDZ/AppData/Local/Google/Chrome/User Data")
self.option.add_experimental_option('excludeSwitches', ['enable-automation'])
self.option.add_experimental_option('useAutomationExtension', False)
prefs = {'profile.default_content_settings.popups': 0, 'download.default_directory': 'd:\\'}
self.option.add_experimental_option('prefs',prefs)
# self.option.add_argument("service_args = ['–-ignore-ssl-errors = true', '–-ssl-protocol = TLSv1]")
# prefs = {'permissions.default.stylesheet': 2}
#
# self.option.add_experimental_option('prefs', prefs)
self.browser = webdriver.Chrome(executable_path=self.chrome_path,chrome_options=self.option)
文件路径必须要小写,大写无效,特别是 d:\\ ,如果变成 D:\\则无效。