首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >selenium.common.exceptions.SessionNotCreatedException

selenium.common.exceptions.SessionNotCreatedException
EN

Stack Overflow用户
提问于 2022-02-04 09:53:23
回答 1查看 417关注 0票数 1

我正在尝试运行这个应用程序:https://github.com/flathunters/flathunter

我在一个新的Ubuntu18.04.6LTS安装上安装了这个程序。这个包需要Python。我使用的是pipenv installpipenv shell,这是安装说明中推荐的。

另外,还需要一个铬网驱动程序.我试图按照https://stackoverflow.com/a/32139981/2311074中的解释,在VPS上安装它,并将它指向/usr/lib/chromium-browser/chromedriver

我每天开始写剧本长达14个小时。应用程序可以工作几天,然后它将始终使用selenium.common.exceptions.SessionNotCreatedException退出。

代码语言:javascript
复制
Traceback (most recent call last):
  File "/home/adam/flathunter/flathunt.py", line 95, in <module>
    main()
  File "/home/adam/flathunter/flathunt.py", line 68, in main
    config = Config(config_handle.name)
  File "/home/adam/flathunter/flathunter/config.py", line 29, in __init__
    self.__searchers__ = [CrawlImmobilienscout(self),
  File "/home/adam/flathunter/flathunter/crawl_immobilienscout.py", line 43, in __init__
    self.driver = self.configure_driver(self.driver_executable_path, self.driver_arguments)
  File "/home/adam/flathunter/flathunter/abstract_crawler.py", line 53, in configure_driver
    driver = webdriver.Chrome(executable_path=driver_path, options=chrome_options)
  File "/home/adam/.local/share/virtualenvs/flathunter-SBM5Nxub/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/adam/.local/share/virtualenvs/flathunter-SBM5Nxub/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/adam/.local/share/virtualenvs/flathunter-SBM5Nxub/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/adam/.local/share/virtualenvs/flathunter-SBM5Nxub/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/adam/.local/share/virtualenvs/flathunter-SBM5Nxub/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from tab crashed
  (Session info: headless chrome=98.0.4758.80)

如果我直接从https://chromedriver.chromium.org/下载铬驱动程序,同样的问题。

我安装了铬和铬驱动程序v98 .

当我重新安装这台机器时,它会再工作几天,然后在某一天永远失效。

我在这里做错什么了?

EN

回答 1

Stack Overflow用户

发布于 2022-02-05 10:43:20

会话selenium错误的原因是无法打开selenium浏览器。这是因为每次启动脚本时都会打开selenium浏览器,但是如果脚本停止,chromedriver就不会关闭。过了一段时间,您打开了许多显色驱动器:

并启动一个新的色度驱动器填充失败与“端口已经在使用”。

要修复它,可以在启动脚本之前杀死所有chromedriver。

代码语言:javascript
复制
killall chromedriver

另见https://github.com/flathunters/flathunter/issues/155

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70984378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档