@@ -7007,13 +7007,13 @@ def get_browser_downloads_folder(self):
7007
7007
# Can't change the system [Downloads Folder] on Safari or IE
7008
7008
return os.path.join(os.path.expanduser("~"), "downloads")
7009
7009
elif (
7010
- self.driver.capabilities["browserName"].lower() == "chrome"
7010
+ "chrome" in self.driver.capabilities
7011
7011
and int(self.get_chromedriver_version().split(".")[0]) < 73
7012
7012
and self.headless
7013
7013
):
7014
7014
return os.path.join(os.path.expanduser("~"), "downloads")
7015
7015
elif (
7016
- self.driver.capabilities["browserName"].lower() == "chrome"
7016
+ "chrome" in self.driver.capabilities
7017
7017
and int(self.get_chromedriver_version().split(".")[0]) >= 110
7018
7018
and int(self.get_chromedriver_version().split(".")[0]) <= 112
7019
7019
and self.headless
@@ -7711,17 +7711,19 @@ def is_chromium(self):
7711
7711
"""Return True if the browser is Chrome or Edge."""
7712
7712
self.__check_scope()
7713
7713
chromium = False
7714
- browser_name = self.driver.capabilities["browserName"]
7715
- if browser_name.lower() in ("chrome", "edge", "msedge"):
7714
+ if (
7715
+ "chrome" in self.driver.capabilities
7716
+ or "msedge" in self.driver.capabilities
7717
+ ):
7716
7718
chromium = True
7717
7719
return chromium
7718
7720
7719
7721
def __fail_if_not_using_chrome(self, method):
7720
7722
chrome = False
7721
- browser_name = self.driver.capabilities["browserName"]
7722
- if browser_name.lower() == "chrome":
7723
+ if "chrome" in self.driver.capabilities:
7723
7724
chrome = True
7724
7725
if not chrome:
7726
+ browser_name = self.driver.capabilities["browserName"]
7725
7727
message = (
7726
7728
'Error: "%s" should only be called by tests '
7727
7729
'running with "--browser=chrome" / "--chrome"! '
@@ -7732,8 +7734,8 @@ def __fail_if_not_using_chrome(self, method):
7732
7734
raise NotUsingChromeException(message)
7733
7735
7734
7736
def __fail_if_not_using_chromium(self, method):
7735
- browser_name = self.driver.capabilities["browserName"]
7736
7737
if not self.is_chromium():
7738
+ browser_name = self.driver.capabilities["browserName"]
7737
7739
message = (
7738
7740
'Error: "%s" should only be called by tests '
7739
7741
'running with a Chromium browser! (Chrome or Edge) '
@@ -15578,12 +15580,12 @@ def _get_driver_name_and_version(self):
15578
15580
else:
15579
15581
return None
15580
15582
driver = self.driver
15581
- if driver.capabilities["browserName"].lower() == "chrome" :
15583
+ if "chrome" in self.driver.capabilities :
15582
15584
cap_dict = driver.capabilities["chrome"]
15583
15585
return (
15584
15586
"chromedriver", cap_dict["chromedriverVersion"].split(" ")[0]
15585
15587
)
15586
- elif driver.capabilities["browserName"].lower() == "msedge" :
15588
+ elif "msedge" in self.driver.capabilities :
15587
15589
cap_dict = driver.capabilities["msedge"]
15588
15590
return (
15589
15591
"msedgedriver", cap_dict["msedgedriverVersion"].split(" ")[0]
0 commit comments