Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python webdriver_管理器chrome自定义配置文件_Python_Selenium_Webdriver_Selenium Chromedriver_Webdriver Manager - Fatal编程技术网

python webdriver_管理器chrome自定义配置文件

python webdriver_管理器chrome自定义配置文件,python,selenium,webdriver,selenium-chromedriver,webdriver-manager,Python,Selenium,Webdriver,Selenium Chromedriver,Webdriver Manager,如何使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',

如何使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)
driver = webdriver.Chrome(ChromeDriverManager().install())
但是,由于我想让chromedriver自己安装正确的版本(因为我向非python用户销售我的程序),所以我使用的是webdriver_manager模块,如下所示:

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)
driver = webdriver.Chrome(ChromeDriverManager().install())
是否有任何方法可以加载自定义配置文件,以便在使用webdriver\u manager时将网站上的登录数据保存在我的配置文件中?

您可以使用并同时使用以下解决方案:

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/')