Merge pull request #1254 from seleniumbase/windows-optimizations
Perform Windows and Edge optimizations
This commit is contained in:
commit
8a359934ce
|
@ -1,2 +1,2 @@
|
|||
# seleniumbase package
|
||||
__version__ = "2.4.22"
|
||||
__version__ = "2.4.23"
|
||||
|
|
|
@ -60,7 +60,7 @@ sbase install chromedriver latest
|
|||
sbase install chromedriver latest-1 # (Latest minus one)
|
||||
sbase install chromedriver -p
|
||||
sbase install chromedriver latest -p
|
||||
sbase install edgedriver 99.0.1150.39
|
||||
sbase install edgedriver 99.0.1150.46
|
||||
```
|
||||
|
||||
(Drivers: ``chromedriver``, ``geckodriver``, ``edgedriver``,
|
||||
|
|
|
@ -135,7 +135,7 @@ def show_install_usage():
|
|||
print(" sbase install chromedriver latest-1")
|
||||
print(" sbase install chromedriver -p")
|
||||
print(" sbase install chromedriver latest -p")
|
||||
print(" sbase install edgedriver 99.0.1150.39")
|
||||
print(" sbase install edgedriver 99.0.1150.46")
|
||||
print(" Output:")
|
||||
print(" Installs the chosen webdriver to seleniumbase/drivers/")
|
||||
print(" (chromedriver is required for Chrome automation)")
|
||||
|
|
|
@ -19,7 +19,7 @@ Example:
|
|||
sbase install chromedriver latest-1 # (Latest minus one)
|
||||
sbase install chromedriver -p
|
||||
sbase install chromedriver latest -p
|
||||
sbase install edgedriver 99.0.1150.39
|
||||
sbase install edgedriver 99.0.1150.46
|
||||
Output:
|
||||
Installs the chosen webdriver to seleniumbase/drivers/
|
||||
(chromedriver is required for Chrome automation)
|
||||
|
@ -45,7 +45,7 @@ DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
|
|||
LOCAL_PATH = "/usr/local/bin/" # On Mac and Linux systems
|
||||
DEFAULT_CHROMEDRIVER_VERSION = "2.44" # (Specify "latest" to get the latest)
|
||||
DEFAULT_GECKODRIVER_VERSION = "v0.30.0"
|
||||
DEFAULT_EDGEDRIVER_VERSION = "99.0.1150.39" # (Looks for LATEST_STABLE first)
|
||||
DEFAULT_EDGEDRIVER_VERSION = "99.0.1150.46" # (Looks for LATEST_STABLE first)
|
||||
DEFAULT_OPERADRIVER_VERSION = "v.96.0.4664.45"
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ def invalid_run_command():
|
|||
exp += " sbase install chromedriver latest-1\n"
|
||||
exp += " sbase install chromedriver -p\n"
|
||||
exp += " sbase install chromedriver latest -p\n"
|
||||
exp += " sbase install edgedriver 99.0.1150.39"
|
||||
exp += " sbase install edgedriver 99.0.1150.46"
|
||||
exp += " Output:\n"
|
||||
exp += " Installs the chosen webdriver to seleniumbase/drivers/\n"
|
||||
exp += " (chromedriver is required for Chrome automation)\n"
|
||||
|
|
|
@ -68,6 +68,9 @@ logging.getLogger("requests").setLevel(logging.ERROR)
|
|||
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
||||
urllib3.disable_warnings()
|
||||
LOGGER.setLevel(logging.WARNING)
|
||||
is_windows = False
|
||||
if sys.platform in ["win32", "win64", "x64"]:
|
||||
is_windows = True
|
||||
python3 = True
|
||||
if sys.version_info[0] < 3:
|
||||
python3 = False
|
||||
|
@ -9979,7 +9982,8 @@ class BaseCase(unittest.TestCase):
|
|||
"Use this method only if get_new_driver() has been called."
|
||||
)
|
||||
try:
|
||||
driver.quit()
|
||||
if not is_windows or driver.service.process:
|
||||
driver.quit()
|
||||
except AttributeError:
|
||||
pass
|
||||
except Exception:
|
||||
|
@ -11666,7 +11670,8 @@ class BaseCase(unittest.TestCase):
|
|||
self._drivers_list.reverse() # Last In, First Out
|
||||
for driver in self._drivers_list:
|
||||
try:
|
||||
driver.quit()
|
||||
if not is_windows or driver.service.process:
|
||||
driver.quit()
|
||||
except AttributeError:
|
||||
pass
|
||||
except Exception:
|
||||
|
|
|
@ -10,6 +10,9 @@ from seleniumbase import config as sb_config
|
|||
from seleniumbase.config import settings
|
||||
from seleniumbase.fixtures import constants
|
||||
|
||||
is_windows = False
|
||||
if sys.platform in ["win32", "win64", "x64"]:
|
||||
is_windows = True
|
||||
pytest_plugins = ["pytester"] # Adds the "testdir" fixture
|
||||
|
||||
|
||||
|
@ -1349,7 +1352,8 @@ def pytest_runtest_teardown(item):
|
|||
and self.driver
|
||||
and "--pdb" not in sys.argv
|
||||
):
|
||||
self.driver.quit()
|
||||
if not is_windows or self.driver.service.process:
|
||||
self.driver.quit()
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
|
@ -1402,7 +1406,8 @@ def _perform_pytest_unconfigure_():
|
|||
# Close the shared browser session
|
||||
if sb_config.shared_driver:
|
||||
try:
|
||||
sb_config.shared_driver.quit()
|
||||
if not is_windows or sb_config.shared_driver.service.process:
|
||||
sb_config.shared_driver.quit()
|
||||
except AttributeError:
|
||||
pass
|
||||
except Exception:
|
||||
|
|
|
@ -8,6 +8,10 @@ from seleniumbase.config import settings
|
|||
from seleniumbase.core import proxy_helper
|
||||
from seleniumbase.fixtures import constants
|
||||
|
||||
is_windows = False
|
||||
if sys.platform in ["win32", "win64", "x64"]:
|
||||
is_windows = True
|
||||
|
||||
|
||||
class SeleniumBrowser(Plugin):
|
||||
"""
|
||||
|
@ -744,7 +748,8 @@ class SeleniumBrowser(Plugin):
|
|||
def afterTest(self, test):
|
||||
try:
|
||||
# If the browser window is still open, close it now.
|
||||
self.driver.quit()
|
||||
if not is_windows or self.driver.service.process:
|
||||
self.driver.quit()
|
||||
except AttributeError:
|
||||
pass
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in New Issue