如何让webdriver_manager.chrome使用自定义的chrome用户配置文件?
我知道对于selenium webdriver,我可以这样指定:
options = Options()
options.add_argument(f'user-data-dir={script_path}\\User Data\\profile')
driver = webdriver.Chrome(executable_path=f'{script_path}\\chromedriver.exe', options=options)但是因为我想让chromedriver自己安装正确的版本(因为我把我的程序卖给了非python用户),所以我使用了webdriver_manager模块,它看起来像这样:
driver = webdriver.Chrome(ChromeDriverManager().install())有没有办法加载自定义配置文件,以便在使用webdriver_manager时将我在网站上的登录数据保存在配置文件中?
发布于 2020-09-01 18:58:59
您可以使用以下解决方案同时使用webdriver_manager.chrome和custom chrome user profile:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = Options()
options.add_argument(f'user-data-dir={script_path}\\User Data\\profile')
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)
driver.get('https://www.google.com/')https://stackoverflow.com/questions/63685619
复制相似问题