Skip to content

Commit 96d909d

Browse files
committed
Fix IE issue preventing the browser from quitting after tests
1 parent 9a58cd5 commit 96d909d

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

seleniumbase/behave/behave_sb.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,11 @@ def _perform_behave_unconfigure_():
920920
# Close the shared browser session
921921
if sb_config.shared_driver:
922922
try:
923-
if not is_windows or sb_config.shared_driver.service.process:
923+
if (
924+
not is_windows
925+
or sb_config.browser == "ie"
926+
or sb_config.shared_driver.service.process
927+
):
924928
sb_config.shared_driver.quit()
925929
except AttributeError:
926930
pass
@@ -983,7 +987,11 @@ def _perform_behave_unconfigure_():
983987
def do_final_driver_cleanup_as_needed():
984988
try:
985989
if hasattr(sb_config, "last_driver") and sb_config.last_driver:
986-
if not is_windows or sb_config.last_driver.service.process:
990+
if (
991+
not is_windows
992+
or sb_config.browser == "ie"
993+
or sb_config.last_driver.service.process
994+
):
987995
sb_config.last_driver.quit()
988996
except Exception:
989997
pass

seleniumbase/fixtures/base_case.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10465,7 +10465,11 @@ def quit_extra_driver(self, driver=None):
1046510465
"Use this method only if get_new_driver() has been called."
1046610466
)
1046710467
try:
10468-
if not is_windows or driver.service.process:
10468+
if (
10469+
not is_windows
10470+
or self.browser == "ie"
10471+
or driver.service.process
10472+
):
1046910473
driver.quit()
1047010474
except AttributeError:
1047110475
pass
@@ -12419,7 +12423,11 @@ def __quit_all_drivers(self):
1241912423
self._drivers_list.reverse() # Last In, First Out
1242012424
for driver in self._drivers_list:
1242112425
try:
12422-
if not is_windows or driver.service.process:
12426+
if (
12427+
not is_windows
12428+
or self.browser == "ie"
12429+
or driver.service.process
12430+
):
1242312431
if not delay_driver_quit:
1242412432
driver.quit()
1242512433
else:

seleniumbase/plugins/pytest_plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,11 @@ def _perform_pytest_unconfigure_():
14631463
# Close the shared browser session
14641464
if sb_config.shared_driver:
14651465
try:
1466-
if not is_windows or sb_config.shared_driver.service.process:
1466+
if (
1467+
not is_windows
1468+
or sb_config.browser == "ie"
1469+
or sb_config.shared_driver.service.process
1470+
):
14671471
sb_config.shared_driver.quit()
14681472
except AttributeError:
14691473
pass

seleniumbase/plugins/selenium_plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,11 @@ def finalize(self, result):
779779
def afterTest(self, test):
780780
try:
781781
# If the browser window is still open, close it now.
782-
if not is_windows or self.driver.service.process:
782+
if (
783+
not is_windows
784+
or test.test.browser == "ie"
785+
or self.driver.service.process
786+
):
783787
self.driver.quit()
784788
except AttributeError:
785789
pass

0 commit comments

Comments
 (0)