Skip to content

Commit d01984c

Browse files
committed
Refactoring
1 parent 4a14bb3 commit d01984c

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

seleniumbase/plugins/pytest_plugin.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def pytest_addoption(parser):
6868
--start-page=URL (The starting URL for the web browser when tests begin.)
6969
--archive-logs (Archive existing log files instead of deleting them.)
7070
--archive-downloads (Archive old downloads instead of deleting them.)
71-
--sjw (Skip JavaScript Waits such as readyState=="complete" or Angular.)
7271
--time-limit=SECONDS (Safely fail any test that exceeds the time limit.)
7372
--slow (Slow down the automation. Faster than using Demo Mode.)
7473
--demo (Slow down and visually see test actions as they occur.)
@@ -1274,17 +1273,20 @@ def pytest_addoption(parser):
12741273
'\n (Your browser choice was: "%s")\n' % browser_list[0]
12751274
)
12761275
raise Exception(message)
1276+
undetectable = False
1277+
if (
1278+
"--undetected" in sys_argv
1279+
or "--undetectable" in sys_argv
1280+
or "--uc" in sys_argv
1281+
or "--uc-subprocess" in sys_argv
1282+
or "--uc_subprocess" in sys_argv
1283+
or "--uc-sub" in sys_argv
1284+
):
1285+
undetectable = True
12771286
if (
12781287
browser_changes == 1
12791288
and browser_text not in ["chrome"]
1280-
and (
1281-
"--undetected" in sys_argv
1282-
or "--undetectable" in sys_argv
1283-
or "--uc" in sys_argv
1284-
or "--uc-subprocess" in sys_argv
1285-
or "--uc_subprocess" in sys_argv
1286-
or "--uc-sub" in sys_argv
1287-
)
1289+
and undetectable
12881290
):
12891291
message = (
12901292
'\n\n Undetected-Chromedriver Mode ONLY supports Chrome!'
@@ -1716,7 +1718,10 @@ def pytest_runtest_teardown(item):
17161718
if (
17171719
hasattr(self, "driver")
17181720
and self.driver
1719-
and "--pdb" not in sys_argv
1721+
and (
1722+
"--pdb" not in sys_argv
1723+
or not python3
1724+
)
17201725
):
17211726
if not is_windows or self.driver.service.process:
17221727
self.driver.quit()

0 commit comments

Comments
 (0)