Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ivan-kenobi opened this issue Jan 15, 2023 · 4 comments
Open

Comments

@ivan-kenobi
Copy link

ivan-kenobi commented Jan 15, 2023

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
@ivan-kenobi ivan-kenobi changed the title Cryptic error when launching from Docker "unable to discover open window in chrome" when launching from Docker Jan 16, 2023
@codders
Copy link

codders commented Jan 19, 2023

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

@ivan-kenobi
Copy link
Author

ivan-kenobi commented Jan 23, 2023

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
Copy link

codders commented Feb 21, 2023

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

@ivan-kenobi
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants