@@ -199,22 +199,17 @@ def test_example(self):
199
199
Eg. "python my_test.py" instead of "pytest my_test.py"."""
200
200
if name == "__main__": # Test called with "python"
201
201
import subprocess
202
- from pytest import main as pytest_main
203
202
all_args = []
204
203
for arg in args:
205
204
all_args.append(arg)
206
205
for arg in sys.argv[1:]:
207
206
all_args.append(arg)
208
- multi = False
209
- for arg in all_args:
210
- if arg.startswith("-n") or arg.startswith("--numprocesses"):
211
- multi = True
212
- if multi:
213
- subprocess.call(
214
- [sys.executable, "-m", "pytest", file, "-s", *all_args]
215
- )
216
- else:
217
- pytest_main([file, "-s", *all_args])
207
+ # See: https://stackoverflow.com/a/54666289/7058266
208
+ # from pytest import main as pytest_main
209
+ # pytest_main([file, "-s", *all_args])
210
+ subprocess.call(
211
+ [sys.executable, "-m", "pytest", file, "-s", *all_args]
212
+ )
218
213
219
214
def open(self, url):
220
215
"""Navigates the current browser window to the specified page."""
@@ -7007,13 +7002,13 @@ def get_browser_downloads_folder(self):
7007
7002
# Can't change the system [Downloads Folder] on Safari or IE
7008
7003
return os.path.join(os.path.expanduser("~"), "downloads")
7009
7004
elif (
7010
- self.driver.capabilities["browserName"].lower() == "chrome"
7005
+ "chrome" in self.driver.capabilities
7011
7006
and int(self.get_chromedriver_version().split(".")[0]) < 73
7012
7007
and self.headless
7013
7008
):
7014
7009
return os.path.join(os.path.expanduser("~"), "downloads")
7015
7010
elif (
7016
- self.driver.capabilities["browserName"].lower() == "chrome"
7011
+ "chrome" in self.driver.capabilities
7017
7012
and int(self.get_chromedriver_version().split(".")[0]) >= 110
7018
7013
and int(self.get_chromedriver_version().split(".")[0]) <= 112
7019
7014
and self.headless
@@ -7711,17 +7706,19 @@ def is_chromium(self):
7711
7706
"""Return True if the browser is Chrome or Edge."""
7712
7707
self.__check_scope()
7713
7708
chromium = False
7714
- browser_name = self.driver.capabilities["browserName"]
7715
- if browser_name.lower() in ("chrome", "edge", "msedge"):
7709
+ if (
7710
+ "chrome" in self.driver.capabilities
7711
+ or "msedge" in self.driver.capabilities
7712
+ ):
7716
7713
chromium = True
7717
7714
return chromium
7718
7715
7719
7716
def __fail_if_not_using_chrome(self, method):
7720
7717
chrome = False
7721
- browser_name = self.driver.capabilities["browserName"]
7722
- if browser_name.lower() == "chrome":
7718
+ if "chrome" in self.driver.capabilities:
7723
7719
chrome = True
7724
7720
if not chrome:
7721
+ browser_name = self.driver.capabilities["browserName"]
7725
7722
message = (
7726
7723
'Error: "%s" should only be called by tests '
7727
7724
'running with "--browser=chrome" / "--chrome"! '
@@ -7732,8 +7729,8 @@ def __fail_if_not_using_chrome(self, method):
7732
7729
raise NotUsingChromeException(message)
7733
7730
7734
7731
def __fail_if_not_using_chromium(self, method):
7735
- browser_name = self.driver.capabilities["browserName"]
7736
7732
if not self.is_chromium():
7733
+ browser_name = self.driver.capabilities["browserName"]
7737
7734
message = (
7738
7735
'Error: "%s" should only be called by tests '
7739
7736
'running with a Chromium browser! (Chrome or Edge) '
@@ -13584,15 +13581,6 @@ def __disable_beforeunload_as_needed(self):
13584
13581
13585
13582
############
13586
13583
13587
- @decorators.deprecated("The Driver Manager prevents old drivers.")
13588
- def is_chromedriver_too_old(self):
13589
- """Before chromedriver 73, there was no version check, which
13590
- means it's possible to run a new Chrome with old drivers."""
13591
- self.__fail_if_not_using_chrome("is_chromedriver_too_old()")
13592
- if int(self.get_chromedriver_version().split(".")[0]) < 73:
13593
- return True # chromedriver is too old! Please upgrade!
13594
- return False
13595
-
13596
13584
@decorators.deprecated("You should use re.escape() instead.")
13597
13585
def jq_format(self, code):
13598
13586
# DEPRECATED - re.escape() already performs this action.
@@ -15578,12 +15566,12 @@ def _get_driver_name_and_version(self):
15578
15566
else:
15579
15567
return None
15580
15568
driver = self.driver
15581
- if driver.capabilities["browserName"].lower() == "chrome" :
15569
+ if "chrome" in self.driver.capabilities :
15582
15570
cap_dict = driver.capabilities["chrome"]
15583
15571
return (
15584
15572
"chromedriver", cap_dict["chromedriverVersion"].split(" ")[0]
15585
15573
)
15586
- elif driver.capabilities["browserName"].lower() == "msedge" :
15574
+ elif "msedge" in self.driver.capabilities :
15587
15575
cap_dict = driver.capabilities["msedge"]
15588
15576
return (
15589
15577
"msedgedriver", cap_dict["msedgedriverVersion"].split(" ")[0]
0 commit comments