Improve error-handling for Firefox tests
This commit is contained in:
parent
5cd2e4ac0d
commit
e6a5ec875e
|
@ -1511,7 +1511,11 @@ def get_local_driver(
|
|||
options=firefox_options,
|
||||
)
|
||||
except Exception as e:
|
||||
if "Process unexpectedly closed" in e.msg:
|
||||
if (
|
||||
"Process unexpectedly closed" in e.msg
|
||||
or "Failed to read marionette port" in e.msg
|
||||
or "A connection attempt failed" in e.msg
|
||||
):
|
||||
# Firefox probably just auto-updated itself.
|
||||
# Trying again right after that often works.
|
||||
return webdriver.Firefox(
|
||||
|
@ -1529,9 +1533,24 @@ def get_local_driver(
|
|||
else:
|
||||
if selenium4:
|
||||
service = FirefoxService(log_path=os.path.devnull)
|
||||
try:
|
||||
return webdriver.Firefox(
|
||||
service=service, options=firefox_options
|
||||
)
|
||||
except Exception as e:
|
||||
if (
|
||||
"Process unexpectedly closed" in e.msg
|
||||
or "Failed to read marionette port" in e.msg
|
||||
or "A connection attempt failed" in e.msg
|
||||
):
|
||||
# Firefox probably just auto-updated itself.
|
||||
# Trying again right after that often works.
|
||||
return webdriver.Firefox(
|
||||
service=service,
|
||||
options=firefox_options,
|
||||
)
|
||||
else:
|
||||
raise Exception(e.msg) # Not an obvious fix.
|
||||
else:
|
||||
return webdriver.Firefox(
|
||||
service_log_path=os.path.devnull,
|
||||
|
|
Loading…
Reference in New Issue