docs: def get_driver(self, desired_capabilities=None):
          """
          Creates a Selenium driver on the basis of the configuration file
          upon which this object was created.
  
          :param desired_capabilities: Capabilities that the caller
              desires to override. This have priority over those
              capabilities that are set by the configuration file passed
              to the builder.
          :type desired_capabilities: class:`dict`
          :returns: A driver.
          :raises ValueError: When it can't figure out how to create a
                              browser as specified by the BROWSER
                              configuration variable.
          """
          override_caps = desired_capabilities or {}
  
          desired_capabilities = \
              self.config.make_selenium_desired_capabilities()
          desired_capabilities.update(override_caps)
          browser_string = self.config.browser
  
          chromedriver_version = None
          if self.remote:
              driver = self.remote_service.build_driver(desired_capabilities)
              # There is no equivalent for BrowserStack.
              if browser_string == "CHROME" and \
                 self.remote_service.name == "saucelabs":
                  chromedriver_version = \
                      desired_capabilities.get("chromedriver-version", None)
                  if chromedriver_version is None:
                      raise ValueError(
                          "when using Chrome, you must set a "
                          "``chromedriver-version`` capability so that Selenic "
                          "can detect which version of Chromedriver will "
                          "be used.")
          else:
              if browser_string == "CHROME":
                  chromedriver_path = self.local_conf["CHROMEDRIVER_PATH"]
                  driver = webdriver.Chrome(
                      chromedriver_path,
                      chrome_options=self.local_conf.get("CHROME_OPTIONS"),
                      desired_capabilities=desired_capabilities,
                      service_log_path=self.local_conf["SERVICE_LOG_PATH"],
                      service_args=self.local_conf.get("SERVICE_ARGS"))
                  version_line = subprocess.check_output(
                      [chromedriver_path, "--version"])
                  version_str = re.match(ur"^ChromeDriver (\d+\.\d+)",
                                         version_line).group(1)
                  chromedriver_version = StrictVersion(version_str)
              elif browser_string == "FIREFOX":
                  profile = self.local_conf.get("FIREFOX_PROFILE") or \
                      FirefoxProfile()
                  binary = self.local_conf.get("FIREFOX_BINARY") or \
                      FirefoxBinary()
                  driver = webdriver.Firefox(profile, binary,
                                             capabilities=desired_capabilities)
              elif browser_string == "INTERNETEXPLORER":
                  driver = webdriver.Ie()
              elif browser_string == "OPERA":
                  driver = webdriver.Opera()
              else:
                  # SAFARI
                  # HTMLUNIT
                  # HTMLUNITWITHJS
                  # IPHONE
                  # IPAD
                  # ANDROID
                  # PHANTOMJS
                  raise ValueError("can't start a local " + browser_string)
  
              # Check that what we get is what the config wanted...
              driver_caps = NormalizedCapabilities(driver.desired_capabilities)
              browser_version = \
                  re.sub(r"\..*$", "", driver_caps["browserVersion"])
  
              if driver_caps["platformName"].upper() != self.config.platform:
                  raise ValueError("the platform you want is not the one "
                                   "you are running selenic on")
  
              if browser_version != self.config.version:
                  raise ValueError("the version installed is not the one "
                                   "you wanted")
  
          # On BrowserStack we cannot set the version of chromedriver or
          # query it. So we make the reasonable assuption that the
          # version of chromedriver is greater than 2.13. (There have
          # been at least 7 releases after 2.13 at the time of writing.)
          if (self.remote_service and
              self.remote_service.name == "browserstack") or \
             (chromedriver_version is not None and
                  chromedriver_version > StrictVersion("2.13")):
              # We patch ActionChains.
              chromedriver_element_center_patch()
              # We need to mark the driver as needing the patch.
              setattr(driver, CHROMEDRIVER_ELEMENT_CENTER_PATCH_FLAG, True)
  
          driver = self.patch(driver)
          return driver