remove singletonlock if using headless
singletonlock file prevents reusing a profile when in headless mode
This commit is contained in:
parent
a415e40b0b
commit
b90dc33754
|
@ -294,6 +294,11 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||||
|
|
||||||
if user_data_dir:
|
if user_data_dir:
|
||||||
options.add_argument("--user-data-dir=%s" % user_data_dir)
|
options.add_argument("--user-data-dir=%s" % user_data_dir)
|
||||||
|
singleton_lock_file = f"{user_data_dir}/SingletonLock"
|
||||||
|
|
||||||
|
if headless and os.path.islink(singleton_lock_file):
|
||||||
|
logger.info("Removing SingletonLock %s in order to reuse existing headless profile" % singleton_lock_file)
|
||||||
|
os.remove(singleton_lock_file)
|
||||||
|
|
||||||
language, keep_user_data_dir = None, bool(user_data_dir)
|
language, keep_user_data_dir = None, bool(user_data_dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue