【发布时间】:2016-12-17 04:27:50
【问题描述】:
我在 linux 服务器上有一个 chrome selenium 驱动程序,它由 cron 每小时执行一次。我遇到的错误仅在后续运行中发生,也就是说,在第一次运行期间它工作正常,但在第二次或任何其他子顺序运行期间它失败了。
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)
【问题讨论】:
标签: python linux google-chrome selenium