flathunters / flathunter

A bot to help people with their rental real-estate search. 🏠🤖
GNU Affero General Public License v3.0
831 stars 180 forks source link

"unable to discover open window in chrome" when launching from Docker #290

Open ivan-kenobi opened 1 year ago

ivan-kenobi commented 1 year ago

Hello there! I've pulled the repo and configured my config.yaml and proceeding according to the docker installation / usage instructions. Got a weird error. Initially I thought it might be somehow related to me having Mac M1 (I built / launched under linux/amd64 under Rosetta so should be ok) But then I tried it on freshly installed Manjaro on a different laptop and I get the exact same error. Any hints at what might be wrong?

UPD: I forgot to enable headless mode. After enabling that, I get:

local/share/undetected_chromedriver/12d907a159a9fd7e_chromedriver
Traceback (most recent call last):
  File "/usr/src/app/flathunt.py", line 109, in <module>
    main()
  File "/usr/src/app/flathunt.py", line 75, in main
    config.init_searchers()
  File "/usr/src/app/flathunter/config.py", line 97, in init_searchers
    CrawlImmobilienscout(self),
  File "/usr/src/app/flathunter/crawl_immobilienscout.py", line 40, in __init__
    self.driver = get_chrome_driver(driver_arguments)
  File "/usr/src/app/flathunter/chrome_wrapper.py", line 44, in get_chrome_driver
    driver = uc.Chrome(version_main=chrome_version, options=chrome_options) # pylint: disable=no-member
  File "/usr/local/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 431, in __init__
    super(Chrome, self).__init__(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 693, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open window in chrome
  (Session info: headless chrome=109.0.5414.74)
Stacktrace:

#0 0x00400065d303 <unknown>
#1 0x004000431d37 <unknown>
#2 0x00400040ae0d <unknown>
#3 0x00400049760c <unknown>
#4 0x00400048e753 <unknown>
#5 0x004000461a14 <unknown>
#6 0x004000462b7e <unknown>
#7 0x0040006ac32e <unknown>
#8 0x0040006afc0e <unknown>
#9 0x004000692610 <unknown>
#10 0x0040006b0c23 <unknown>
#11 0x004000684545 <unknown>
#12 0x0040006d16a8 <unknown>
#13 0x0040006d1836 <unknown>
#14 0x0040006ecd13 <unknown>
#15 0x0040025feea7 start_thread
codders commented 1 year ago

What arguments are you using for chromedriver? Do you have --no-sandbox set?

ivan-kenobi commented 1 year ago

I tried with just "--headless" but also tried adding "--no-sandbox", same error. I also tried a config from another guy which used to work for him, but it didn't work for me. docker build --platform linux/amd64 --no-cache -t flathunter . docker run --platform linux/amd64 --mount type=bind,source=$PWD/config.yaml,target=/config.yaml flathunter

codders commented 1 year ago

We've upgraded the version of undetected-chromedriver - has that improved the situation for you?

ivan-kenobi commented 1 year ago

Thanks for the update, I'll try getting it up again this week