don't remove user_data_dir if it contains the substring headless

should be able to use paths that contain the substring headless.  For example users/{username}/{headless,gui}
This commit is contained in:
Michael Oliver 2023-08-25 09:26:55 -07:00 committed by GitHub
parent cea80717c5
commit c757d579ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -301,8 +301,9 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
for arg in options.arguments: for arg in options.arguments:
if any([_ in arg for _ in ("--headless", "headless")]): if any([_ in arg for _ in ("--headless", "headless")]):
options.arguments.remove(arg) if not arg.startswith("--user-data-dir="):
options.headless = True options.arguments.remove(arg)
options.headless = True
if "lang" in arg: if "lang" in arg:
m = re.search("(?:--)?lang(?:[ =])?(.*)", arg) m = re.search("(?:--)?lang(?:[ =])?(.*)", arg)