我正在尝试运行这个应用程序:https://github.com/flathunters/flathunter
我在一个新的Ubuntu18.04.6LTS安装上安装了这个程序。这个包需要Python。我使用的是pipenv install和pipenv shell,这是安装说明中推荐的。
另外,还需要一个铬网驱动程序.我试图按照https://stackoverflow.com/a/32139981/2311074中的解释,在VPS上安装它,并将它指向/usr/lib/chromium-browser/chromedriver。
我每天开始写剧本长达14个小时。应用程序可以工作几天,然后它将始终使用selenium.common.exceptions.SessionNotCreatedException退出。
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 .
当我重新安装这台机器时,它会再工作几天,然后在某一天永远失效。
我在这里做错什么了?
发布于 2022-02-05 10:43:20
会话selenium错误的原因是无法打开selenium浏览器。这是因为每次启动脚本时都会打开selenium浏览器,但是如果脚本停止,chromedriver就不会关闭。过了一段时间,您打开了许多显色驱动器:

并启动一个新的色度驱动器填充失败与“端口已经在使用”。
要修复它,可以在启动脚本之前杀死所有chromedriver。
killall chromedriverhttps://stackoverflow.com/questions/70984378
复制相似问题