code: def _get_site(self, url, headers, cookies, timeout, driver_args, driver_kwargs):
          
          try:
              # **TODO**: Find what exception this will throw and catch it and call
              #   self.driver.execute_script("window.stop()")
              # Then still try and get the source from the page
              self.driver.set_page_load_timeout(timeout)
  
              self.driver.get(url)
              header_data = self.get_selenium_header()
              status_code = header_data['status-code']
  
              # Set data to access from script
              self.status_code = status_code
              self.url = self.driver.current_url
  
          except TimeoutException:
              logger.warning("Page timeout: {}".format(url))
              try:
                  scraper_monitor.failed_url(url, 'Timeout')
              except (NameError, AttributeError):
                  # Happens when scraper_monitor is not being used/setup
                  pass
              except Exception:
                  logger.exception("Unknown problem with scraper_monitor sending a failed url")
  
          except Exception as e:
              raise e.with_traceback(sys.exc_info()[2])
  
          else:
              # If an exception was not thrown then check the http status code
              if status_code < 400:
                  # If the http status code is not an error
                  return self.driver.page_source
              else:
                  # If http status code is 400 or greater
                  raise SeleniumHTTPError("Status code >= 400", status_code=status_code)
docs: Try and return page content in the requested format using selenium