Merge pull request #1425 from seleniumbase/fix-intermittent-firefox-issue

Fix intermittent issue with Firefox and geckodriver
This commit is contained in:
Michael Mintz 2022-07-17 08:16:19 -04:00 committed by GitHub
commit 5c4853e9d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "3.5.7"
__version__ = "3.5.8"

View File

@ -2,6 +2,7 @@ import logging
import os
import re
import sys
import time
import urllib3
import warnings
from selenium import webdriver
@ -1518,17 +1519,21 @@ def get_local_driver(
)
except BaseException as e:
if (
"Process unexpectedly closed" in str(e)
"geckodriver unexpectedly exited" in str(e)
or "Process unexpectedly closed" in str(e)
or "Failed to read marionette port" in str(e)
or "A connection attempt failed" in str(e)
or hasattr(e, "msg") and (
"Process unexpectedly closed" in e.msg
"geckodriver unexpectedly exited" in e.msg
or "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.
# Firefox probably just auto-updated itself,
# which causes intermittent issues to occur.
# Trying again right after that often works.
time.sleep(0.1)
return webdriver.Firefox(
service=service,
options=firefox_options,
@ -1550,17 +1555,21 @@ def get_local_driver(
)
except BaseException as e:
if (
"Process unexpectedly closed" in str(e)
"geckodriver unexpectedly exited" in str(e)
or "Process unexpectedly closed" in str(e)
or "Failed to read marionette port" in str(e)
or "A connection attempt failed" in str(e)
or hasattr(e, "msg") and (
"Process unexpectedly closed" in e.msg
"geckodriver unexpectedly exited" in e.msg
or "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.
# Firefox probably just auto-updated itself,
# which causes intermittent issues to occur.
# Trying again right after that often works.
time.sleep(0.1)
return webdriver.Firefox(
service=service,
options=firefox_options,