1

I am trying to run this application: https://github.com/flathunters/flathunter

I installed this on a fresh Ubuntu 18.04.6 LTS installation. The package requires Python v3.6+. I am using pipenv install and pipenv shell as recommended in the install instructions.

Additionally a chrome-web-driver is required. I tried to install globally install it on my VPS as explained in https://stackoverflow.com/a/32139981/2311074 and point it to /usr/lib/chromium-browser/chromedriver.

I start the script every day for 14 hours. The application works for a couple of days and then it will always exit with a 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)

Same issue if I download the chrome driver directly from https://chromedriver.chromium.org/

I have chrome and chrome-driver v98 installed.

When I reinstall the machine, it will work again for a few days and then fail at some day forever.

What am I doing wrong here?

2
  • Chrome browser should be installed before starting chrome-web-driver. If it's installed, this pypi.org/project/webdriver-manager able to detect and download the correct chromedriver for os/browser-version. Commented Feb 4, 2022 at 11:15
  • @MaxDaroshchanka okay I made I installed chrome correctly, now I get the session error for both, local and global installation. Refactored my question. Commented Feb 4, 2022 at 13:43

1 Answer 1

0

Reason for the session selenium error is because the selenium browser could not be opened. This is, because everytime the script is started a selenium browser is opened, but if the script is stopped chromedriver is not closed. After a while, you have many chromedriver open:

enter image description here

And starting a new chromedriver fill fail with "port already in use".

To fix it, you could kill all chromedriver before starting the script.

killall chromedriver

See also https://github.com/flathunters/flathunter/issues/155

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.