heroku / heroku-buildpack-chrome-for-testing

Heroku Buildpack that installs Chrome for Testing
19 stars 4 forks source link

browser.window_handles fails #22

Closed jamintz closed 4 months ago

jamintz commented 4 months ago

Seems as if after a recent update, browser.window_handles no longer works. Full stacktrace below:


~/.heroku/python/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py in window_handles(self)
    489                 driver.window_handles
    490         """
--> 491         return self.execute(Command.W3C_GET_WINDOW_HANDLES)["value"]
    492 
    493     def maximize_window(self) -> None:

~/.heroku/python/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
    342         response = self.command_executor.execute(driver_command, params)
    343         if response:
--> 344             self.error_handler.check_response(response)
    345             response["value"] = self._unwrap_value(response.get("value", None))
    346             return response

~/.heroku/python/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
    227                 alert_text = value["alert"].get("text")
    228             raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
--> 229         raise exception_class(message, screen, stacktrace)

WebDriverException: Message: unknown error: DevTools returned unknown type:shared_storage_worklet
  (Session info: chrome-headless-shell=126.0.6478.126)
Stacktrace:
#0 0x5570ebed2c7a <unknown>
#1 0x5570ebbb5e2c <unknown>
#2 0x5570ebbc83b0 <unknown>
#3 0x5570ebbc87fc <unknown>
#4 0x5570ebbb646f <unknown>
#5 0x5570ebb8ac0e <unknown>
#6 0x5570ebc3559a <unknown>
#7 0x5570ebc25588 <unknown>
#8 0x5570ebbf5247 <unknown>
#9 0x5570ebbf5b9e <unknown>
#10 0x5570ebe9924b <unknown>
#11 0x5570ebe9d2f1 <unknown>
#12 0x5570ebe84afe <unknown>
#13 0x5570ebe9de52 <unknown>
#14 0x5570ebe6979f <unknown>
#15 0x5570ebec2638 <unknown>
#16 0x5570ebec2810 <unknown>
#17 0x5570ebed1dac <unknown>
#18 0x7ffb4e2f8609 start_thread
mars commented 4 months ago

This seems like an issue with Chrome itself or the Python webdriver, not this buildpack. Here's some ideas for investigating & hopefully solving this problem:

What arguments are you starting Chrome with? Perhaps try --headless=new to use the real browser implementation, instead of the original separate "headless" browser.

What version of Selenium WebDriver is being used? Perhaps try upgrading to the most recent Selenium version.

If these ideas are not fruitful, then try posting a new issue in Selenium's GitHub repo.

jamintz commented 4 months ago

Thanks, the --headless=new fixed it