0

I have a chrome selenium driver on a linux server which is executed every hour by cron. The error I have occurs only on the subsequent runs, that is, during the first run it works fine, but during the 2nd or any other sub-sequential one it fails.

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.0-38-generic x86_64)

I run it this way:

def create_ch_driver():
  chrome_options = webdriver.ChromeOptions()
  chrome_options.add_argument("--no-sandbox")
  chrome_options.add_argument("--user-agent={}".format(config.USER_AGENT))
  return webdriver.Chrome("/usr/local/bin/chromedriver", chrome_options=chrome_options)

1 Answer 1

2

Perhaps the driver is still running in the background and blocks the creation of a new webdriver instance.

Check if the process is running after the first execution of your code.

If so try to kill the process with quit():

webdriver.quit()
3
  • I'm using driver.close() each time in my script
    – Saurabh
    Dec 17, 2016 at 9:14
  • have you checked if the process is still running? Dec 17, 2016 at 20:27
  • make sense to me
    – Rfank2019
    Apr 14, 2018 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.