WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

前端 未结 29 3199
旧巷少年郎
旧巷少年郎 2020-11-21 07:11

I am trying to launch chrome with an URL, the browser launches and it does nothing after that.

I am seeing the below error after 1 minute:

Unable to         


        
29条回答
  •  有刺的猬
    2020-11-21 07:16

    No solution worked for my. But here is a workaround:

    maxcounter=5
    for counter in range(maxcounter):
        try:           
            driver = webdriver.Chrome(chrome_options=options,
                              service_log_path=logfile,
                              service_args=["--verbose", "--log-path=%s" % logfile])
            break
        except WebDriverException as e:
            print("RETRYING INITIALIZATION OF WEBDRIVER! Error: %s" % str(e))
            time.sleep(10)
            if counter==maxcounter-1:
                raise WebDriverException("Maximum number of selenium-firefox-webdriver-retries exceeded.")
    

提交回复
热议问题