@@ -7007,13 +7007,13 @@ def get_browser_downloads_folder(self):
70077007 # Can't change the system [Downloads Folder] on Safari or IE
70087008 return os.path.join(os.path.expanduser("~"), "downloads")
70097009 elif (
7010- self.driver.capabilities["browserName"].lower() == "chrome"
7010+ "chrome" in self.driver.capabilities
70117011 and int(self.get_chromedriver_version().split(".")[0]) < 73
70127012 and self.headless
70137013 ):
70147014 return os.path.join(os.path.expanduser("~"), "downloads")
70157015 elif (
7016- self.driver.capabilities["browserName"].lower() == "chrome"
7016+ "chrome" in self.driver.capabilities
70177017 and int(self.get_chromedriver_version().split(".")[0]) >= 110
70187018 and int(self.get_chromedriver_version().split(".")[0]) <= 112
70197019 and self.headless
@@ -7711,17 +7711,19 @@ def is_chromium(self):
77117711 """Return True if the browser is Chrome or Edge."""
77127712 self.__check_scope()
77137713 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+ ):
77167718 chromium = True
77177719 return chromium
77187720
77197721 def __fail_if_not_using_chrome(self, method):
77207722 chrome = False
7721- browser_name = self.driver.capabilities["browserName"]
7722- if browser_name.lower() == "chrome":
7723+ if "chrome" in self.driver.capabilities:
77237724 chrome = True
77247725 if not chrome:
7726+ browser_name = self.driver.capabilities["browserName"]
77257727 message = (
77267728 'Error: "%s" should only be called by tests '
77277729 'running with "--browser=chrome" / "--chrome"! '
@@ -7732,8 +7734,8 @@ def __fail_if_not_using_chrome(self, method):
77327734 raise NotUsingChromeException(message)
77337735
77347736 def __fail_if_not_using_chromium(self, method):
7735- browser_name = self.driver.capabilities["browserName"]
77367737 if not self.is_chromium():
7738+ browser_name = self.driver.capabilities["browserName"]
77377739 message = (
77387740 'Error: "%s" should only be called by tests '
77397741 'running with a Chromium browser! (Chrome or Edge) '
@@ -15578,12 +15580,12 @@ def _get_driver_name_and_version(self):
1557815580 else:
1557915581 return None
1558015582 driver = self.driver
15581- if driver.capabilities["browserName"].lower() == "chrome" :
15583+ if "chrome" in self.driver.capabilities :
1558215584 cap_dict = driver.capabilities["chrome"]
1558315585 return (
1558415586 "chromedriver", cap_dict["chromedriverVersion"].split(" ")[0]
1558515587 )
15586- elif driver.capabilities["browserName"].lower() == "msedge" :
15588+ elif "msedge" in self.driver.capabilities :
1558715589 cap_dict = driver.capabilities["msedge"]
1558815590 return (
1558915591 "msedgedriver", cap_dict["msedgedriverVersion"].split(" ")[0]
0 commit comments