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

Chrome 133 Breaking #2793

Open
garrettgregor opened this issue Feb 5, 2025 · 13 comments · May be fixed by #2797
Open

Chrome 133 Breaking #2793

garrettgregor opened this issue Feb 5, 2025 · 13 comments · May be fixed by #2797

Comments

@garrettgregor
Copy link

garrettgregor commented Feb 5, 2025

Selenium::WebDriver::Error::InvalidSessionIdError:
                invalid session id

Cannot use page.window_handles as you could in Chrome 132

Additionally, after some additional steps to try to fix, I'm now getting this wrror:

Selenium::WebDriver::Error::NoSuchWindowError:
       no such window
         (Session info: chrome=133.0.6943.54)
@boris-petrov
Copy link

I also see an issue with page.current_window.maximize on 133:

Selenium::WebDriver::Error::UnknownError:
  unknown error: JavaScript code failed
  from unknown command: 'Runtime.evaluate' wasn't found
    (Session info: chrome=133.0.6943.53)
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/response.rb:41:in `error'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/http/common.rb:103:in `create_response'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/remote/bridge.rb:264:in `maximize_window'
# ./gems/selenium-webdriver-4.28.0/lib/selenium/webdriver/common/window.rb:139:in `maximize'
# ./gems/capybara-3.39.2/lib/capybara/selenium/driver.rb:233:in `block in maximize_window'
# ./gems/capybara-3.39.2/lib/capybara/selenium/driver.rb:424:in `within_given_window'
# ./gems/capybara-3.39.2/lib/capybara/selenium/driver.rb:232:in `maximize_window'
# ./gems/capybara-3.39.2/lib/capybara/window.rb:101:in `block in maximize'
# ./gems/capybara-3.39.2/lib/capybara/window.rb:131:in `wait_for_stable_size'
# ./gems/capybara-3.39.2/lib/capybara/window.rb:101:in `maximize'

@ndbroadbent
Copy link
Contributor

ndbroadbent commented Feb 7, 2025

Further info: The first test is passing, then Capybara's config.after RSpec hook crashes when calling Capybara.reset_sessions!:

# lib/capybara.rb:327

  config.after do
    if self.class.include?(Capybara::DSL)
      Capybara.reset_sessions!
      Capybara.use_default_driver
    end
  end
Randomized with seed 39071
F

Failures:

  1) Example spec
     Failure/Error: example.call

     Selenium::WebDriver::Error::NoSuchWindowError:
       no such window
         (Session info: chrome=133.0.6943.53)
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/response.rb:41:in `error'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/http/common.rb:103:in `new'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/http/common.rb:103:in `create_response'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/remote/bridge.rb:193:in `switch_to_window'
     # .../gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/common/target_locator.rb:108:in `window'
     # .../gems/capybara-3.40.0/lib/capybara/selenium/driver.rb:261:in `switch_to_window'
     # .../gems/capybara-3.40.0/lib/capybara/selenium/driver.rb:402:in `within_given_window'
     # .../gems/capybara-3.40.0/lib/capybara/selenium/driver.rb:238:in `close_window'
     # .../gems/capybara-3.40.0/lib/capybara/selenium/driver_specializations/chrome_driver.rb:41:in `block in reset!'
     # .../gems/capybara-3.40.0/lib/capybara/selenium/driver_specializations/chrome_driver.rb:41:in `each'
     # .../gems/capybara-3.40.0/lib/capybara/selenium/driver_specializations/chrome_driver.rb:41:in `reset!'
     # .../gems/capybara-3.40.0/lib/capybara/session.rb:132:in `reset!'
     # .../gems/capybara-3.40.0/lib/capybara.rb:327:in `block in reset_sessions!'
     # .../gems/capybara-3.40.0/lib/capybara.rb:327:in `reverse_each'
     # .../gems/capybara-3.40.0/lib/capybara.rb:327:in `reset_sessions!'
     # <internal:kernel>:187:in `loop'
     # <internal:kernel>:187:in `loop'
     # -e:1:in `<main>'
     # ------------------
     # --- Caused by: ---
     # Selenium::WebDriver::Error::WebDriverError:
     #   0   chromedriver                        0x00000001052eb94c cxxbridge1$str$ptr + 2728228
1   chromedriver                        0x00000001052e3fa8 cxxbridge1$str$ptr + 2697088
2   chromedriver                        0x0000000104e49e64 cxxbridge1$string$len + 92952
3   chromedriver                        0x0000000104ec1a48 cxxbridge1$string$len + 583420
4   chromedriver                        0x0000000104e85004 cxxbridge1$string$len + 335032
5   chromedriver                        0x00000001052b41f4 cxxbridge1$str$ptr + 2501068

@twalpole
Copy link
Member

twalpole commented Feb 7, 2025

This will be looked at next week

@reconcoys
Copy link

Is there any workaround for this if we're using the selenium-webdriver gem to manage chromedriver? I don't see a good way to downgrade while this is fixed.

@garrettgregor
Copy link
Author

Downgrade your chromedriver to 132.x - that worked for me

@defkode
Copy link

defkode commented Feb 19, 2025

Downgrade your chromedriver to 132.x - that worked for me

In Rails the easiest way to do this is to pass browser_version via options:

driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ] do |options|
  options.add_option(:browser_version, '132.0.6834.159')
end

@garrettgregor
Copy link
Author

Downgrade your chromedriver to 132.x - that worked for me

In Rails the easiest way to do this is to pass browser_version via options:

driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ] do |options|
options.add_option(:browser_version, '132.0.6834.159')
end

@defkode Do you mean to say that you don't have a chrome driver built globally and that by adding that option it will build a chromedriver using that version or does that just mask the version?

@defkode
Copy link

defkode commented Feb 19, 2025

@defkode Do you mean to say that you don't have a chrome driver built globally and that by adding that option it will build a chromedriver using that version or does that just mask the version?

Yes (it downloads correct chromedriver version and Chrome for Testing). Thanks to Selenium Manager 👇🏻

https://medium.com/@santhoshshetty58/testing-made-easy-chrome-for-testing-and-selenium-manager-join-forces-3e610764bc4a

https://www.selenium.dev/blog/2023/whats-new-in-selenium-manager-with-selenium-4.11.0/

Works great on CI. On local computer it also downloads matching Chrome for Testing when no regular Chrome browser is installed.

@defkode
Copy link

defkode commented Feb 19, 2025

You can also manage versions via ENV variables

SE_BROWSER_VERSION=132.0.6834.159
SE_DRIVER_VERSION=132.0.6834.159
SE_FORCE_BROWSER_DOWNLOAD=true # use Chrome for Testing instead of regular Chrome in the PATH

@rbclark
Copy link

rbclark commented Feb 23, 2025

I've been experiencing the test failures only on macOS, things are still working properly with Chrome 133 in CI on Ubuntu. In my case, the problems still seem to be occurring even when downgrading the chromedriver. The only thing I've found that works so far is downgrading Edge to v132 (MS makes old versions of Edge available for download, unlike Chrome). I've then updated all my tests to be driven by Edge and things have been working once again.

@MichaelHoste
Copy link

We have the same issue on MacOS, but we noticed that we can make the tests pass without failures when the headless mode is disabled. That way we can keep testing locally.

Perhaps a clue to investigate what went wrong?

@drvn-mr
Copy link

drvn-mr commented Feb 24, 2025

The issue is related to chromedriver, see SeleniumHQ/selenium#15318

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

Successfully merging a pull request may close this issue.

10 participants