File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ def test_anything(self):
68
68
logging.getLogger("urllib3").setLevel(logging.ERROR)
69
69
urllib3.disable_warnings()
70
70
LOGGER.setLevel(logging.WARNING)
71
+ is_windows = False
72
+ if sys.platform in ["win32", "win64", "x64"]:
73
+ is_windows = True
71
74
python3 = True
72
75
if sys.version_info[0] < 3:
73
76
python3 = False
@@ -9979,7 +9982,8 @@ def quit_extra_driver(self, driver=None):
9979
9982
"Use this method only if get_new_driver() has been called."
9980
9983
)
9981
9984
try:
9982
- driver.quit()
9985
+ if not is_windows or driver.service.process:
9986
+ driver.quit()
9983
9987
except AttributeError:
9984
9988
pass
9985
9989
except Exception:
@@ -11666,7 +11670,8 @@ def __quit_all_drivers(self):
11666
11670
self._drivers_list.reverse() # Last In, First Out
11667
11671
for driver in self._drivers_list:
11668
11672
try:
11669
- driver.quit()
11673
+ if not is_windows or driver.service.process:
11674
+ driver.quit()
11670
11675
except AttributeError:
11671
11676
pass
11672
11677
except Exception:
Original file line number Diff line number Diff line change 10
10
from seleniumbase .config import settings
11
11
from seleniumbase .fixtures import constants
12
12
13
+ is_windows = False
14
+ if sys .platform in ["win32" , "win64" , "x64" ]:
15
+ is_windows = True
13
16
pytest_plugins = ["pytester" ] # Adds the "testdir" fixture
14
17
15
18
@@ -1349,7 +1352,8 @@ def pytest_runtest_teardown(item):
1349
1352
and self .driver
1350
1353
and "--pdb" not in sys .argv
1351
1354
):
1352
- self .driver .quit ()
1355
+ if not is_windows or self .driver .service .process :
1356
+ self .driver .quit ()
1353
1357
except Exception :
1354
1358
pass
1355
1359
try :
@@ -1402,7 +1406,8 @@ def _perform_pytest_unconfigure_():
1402
1406
# Close the shared browser session
1403
1407
if sb_config .shared_driver :
1404
1408
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 ()
1406
1411
except AttributeError :
1407
1412
pass
1408
1413
except Exception :
Original file line number Diff line number Diff line change 8
8
from seleniumbase .core import proxy_helper
9
9
from seleniumbase .fixtures import constants
10
10
11
+ is_windows = False
12
+ if sys .platform in ["win32" , "win64" , "x64" ]:
13
+ is_windows = True
14
+
11
15
12
16
class SeleniumBrowser (Plugin ):
13
17
"""
@@ -744,7 +748,8 @@ def finalize(self, result):
744
748
def afterTest (self , test ):
745
749
try :
746
750
# 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 ()
748
753
except AttributeError :
749
754
pass
750
755
except Exception :
You can’t perform that action at this time.
0 commit comments