Python Selenium WebDriverException-无法访问chrome
我在linux服务器上有一个chrome selenium驱动程序,每小时由cron执行一次。我的错误只发生在后续的运行中,也就是说,在第一次运行期间它工作正常,但在第二次或任何其他子顺序运行期间它失败Python Selenium WebDriverException-无法访问chrome,python,linux,google-chrome,selenium,Python,Linux,Google Chrome,Selenium,我在linux服务器上有一个chrome selenium驱动程序,每小时由cron执行一次。我的错误只发生在后续的运行中,也就是说,在第一次运行期间它工作正常,但在第二次或任何其他子顺序运行期间它失败 raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: chrome not reachable (Session info: chr
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)
我是这样运行的:
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)
可能驱动程序仍在后台运行,并阻止了新webdriver实例的创建 检查第一次执行代码后进程是否正在运行 如果是,请尝试使用quit()终止进程:
可能驱动程序仍在后台运行,并阻止了新webdriver实例的创建 检查第一次执行代码后进程是否正在运行 如果是,请尝试使用quit()终止进程:
我在脚本中每次都在使用driver.close(),您是否检查了进程是否仍在运行?对我来说有意义我在脚本中每次都在使用driver.close()您是否检查了进程是否仍在运行?对我来说有意义
webdriver.quit()