Skip to content

Commit 8a35993

Browse files
authored
Merge pull request #1254 from seleniumbase/windows-optimizations
Perform Windows and Edge optimizations
2 parents 2514147 + 5f07cc7 commit 8a35993

File tree

7 files changed

+26
-11
lines changed

7 files changed

+26
-11
lines changed

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "2.4.22"
2+
__version__ = "2.4.23"

seleniumbase/console_scripts/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ sbase install chromedriver latest
6060
sbase install chromedriver latest-1 # (Latest minus one)
6161
sbase install chromedriver -p
6262
sbase install chromedriver latest -p
63-
sbase install edgedriver 99.0.1150.39
63+
sbase install edgedriver 99.0.1150.46
6464
```
6565

6666
(Drivers: ``chromedriver``, ``geckodriver``, ``edgedriver``,

seleniumbase/console_scripts/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def show_install_usage():
135135
print(" sbase install chromedriver latest-1")
136136
print(" sbase install chromedriver -p")
137137
print(" sbase install chromedriver latest -p")
138-
print(" sbase install edgedriver 99.0.1150.39")
138+
print(" sbase install edgedriver 99.0.1150.46")
139139
print(" Output:")
140140
print(" Installs the chosen webdriver to seleniumbase/drivers/")
141141
print(" (chromedriver is required for Chrome automation)")

seleniumbase/console_scripts/sb_install.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
sbase install chromedriver latest-1 # (Latest minus one)
2020
sbase install chromedriver -p
2121
sbase install chromedriver latest -p
22-
sbase install edgedriver 99.0.1150.39
22+
sbase install edgedriver 99.0.1150.46
2323
Output:
2424
Installs the chosen webdriver to seleniumbase/drivers/
2525
(chromedriver is required for Chrome automation)
@@ -45,7 +45,7 @@
4545
LOCAL_PATH = "/usr/local/bin/" # On Mac and Linux systems
4646
DEFAULT_CHROMEDRIVER_VERSION = "2.44" # (Specify "latest" to get the latest)
4747
DEFAULT_GECKODRIVER_VERSION = "v0.30.0"
48-
DEFAULT_EDGEDRIVER_VERSION = "99.0.1150.39" # (Looks for LATEST_STABLE first)
48+
DEFAULT_EDGEDRIVER_VERSION = "99.0.1150.46" # (Looks for LATEST_STABLE first)
4949
DEFAULT_OPERADRIVER_VERSION = "v.96.0.4664.45"
5050

5151

@@ -71,7 +71,7 @@ def invalid_run_command():
7171
exp += " sbase install chromedriver latest-1\n"
7272
exp += " sbase install chromedriver -p\n"
7373
exp += " sbase install chromedriver latest -p\n"
74-
exp += " sbase install edgedriver 99.0.1150.39"
74+
exp += " sbase install edgedriver 99.0.1150.46"
7575
exp += " Output:\n"
7676
exp += " Installs the chosen webdriver to seleniumbase/drivers/\n"
7777
exp += " (chromedriver is required for Chrome automation)\n"

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def test_anything(self):
6868
logging.getLogger("urllib3").setLevel(logging.ERROR)
6969
urllib3.disable_warnings()
7070
LOGGER.setLevel(logging.WARNING)
71+
is_windows = False
72+
if sys.platform in ["win32", "win64", "x64"]:
73+
is_windows = True
7174
python3 = True
7275
if sys.version_info[0] < 3:
7376
python3 = False
@@ -9979,7 +9982,8 @@ def quit_extra_driver(self, driver=None):
99799982
"Use this method only if get_new_driver() has been called."
99809983
)
99819984
try:
9982-
driver.quit()
9985+
if not is_windows or driver.service.process:
9986+
driver.quit()
99839987
except AttributeError:
99849988
pass
99859989
except Exception:
@@ -11666,7 +11670,8 @@ def __quit_all_drivers(self):
1166611670
self._drivers_list.reverse() # Last In, First Out
1166711671
for driver in self._drivers_list:
1166811672
try:
11669-
driver.quit()
11673+
if not is_windows or driver.service.process:
11674+
driver.quit()
1167011675
except AttributeError:
1167111676
pass
1167211677
except Exception:

seleniumbase/plugins/pytest_plugin.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
from seleniumbase.config import settings
1111
from seleniumbase.fixtures import constants
1212

13+
is_windows = False
14+
if sys.platform in ["win32", "win64", "x64"]:
15+
is_windows = True
1316
pytest_plugins = ["pytester"] # Adds the "testdir" fixture
1417

1518

@@ -1349,7 +1352,8 @@ def pytest_runtest_teardown(item):
13491352
and self.driver
13501353
and "--pdb" not in sys.argv
13511354
):
1352-
self.driver.quit()
1355+
if not is_windows or self.driver.service.process:
1356+
self.driver.quit()
13531357
except Exception:
13541358
pass
13551359
try:
@@ -1402,7 +1406,8 @@ def _perform_pytest_unconfigure_():
14021406
# Close the shared browser session
14031407
if sb_config.shared_driver:
14041408
try:
1405-
sb_config.shared_driver.quit()
1409+
if not is_windows or sb_config.shared_driver.service.process:
1410+
sb_config.shared_driver.quit()
14061411
except AttributeError:
14071412
pass
14081413
except Exception:

seleniumbase/plugins/selenium_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from seleniumbase.core import proxy_helper
99
from seleniumbase.fixtures import constants
1010

11+
is_windows = False
12+
if sys.platform in ["win32", "win64", "x64"]:
13+
is_windows = True
14+
1115

1216
class SeleniumBrowser(Plugin):
1317
"""
@@ -744,7 +748,8 @@ def finalize(self, result):
744748
def afterTest(self, test):
745749
try:
746750
# If the browser window is still open, close it now.
747-
self.driver.quit()
751+
if not is_windows or self.driver.service.process:
752+
self.driver.quit()
748753
except AttributeError:
749754
pass
750755
except Exception:

0 commit comments

Comments
 (0)