Update __init__.py

Fix user_data_dir is not handled by Chrome __init__ function.
This commit is contained in:
lulucas 2022-01-12 14:46:23 +08:00 committed by GitHub
parent a4cc4a8b72
commit 9b6cc175c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -296,6 +296,11 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
"created a temporary folder in which the user-data (profile) will be stored during this\n"
"session, and added it to chrome startup arguments: %s" % arg
)
else:
a_user_data_dir = os.path.abspath(user_data_dir)
arg = "--user-data-dir=%s" % os.path.normpath(a_user_data_dir)
options.add_argument(arg)
if not language:
try: