[ruby] Try to load older devtools version if current browser version doesn't match#11827
Conversation
|
From a random user: Thanks, @arielj! ⭐ |
|
hi could this be release perhaps as a 0.111.1? thank you :) |
|
This has already been released. |
|
i'm not sure it has. i think the selenium-webdriver gem has had a recent release, but the selenium-devtools gem has not had a release since this was merged. i have the latest version of selenium-webdriver (4.8.6) and the latest version of selenium-devtools (0.111.0) |
|
You are right, seems the person who released 4.8.6 did not pull in this change. We are doing a release next week in any case. |
When using the feature added in SeleniumHQ#11827 that loads devtools methods possibly a version or two earlier than was necessary asked for, i was seeing this error: ``` NoMethodError: undefined method `get_targets' for nil:NilClass ./rb/lib/selenium/webdriver/devtools.rb:75:in `start_session' ./rb/lib/selenium/webdriver/devtools.rb:34:in `initialize' ./rb/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb:35:in `new' ./rb/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb:35:in `devtools' ``` because `target` was nil because it was trying to load a class named: ``` Selenium::DevTools::V#{Selenium::DevTools.version}::#{method.capitalize} ``` which resolved to: ``` Selenium::DevTools::V112::Target ``` even though the falling-back code had already given up on 112 and loaded 111 instead. The simplest way to fix this seems to be ensure that `Selenium::DevTools.version` matches what was loaded. Also now there's a test
Fix ruby devtools version fallback When using the feature added in #11827 that loads devtools methods possibly a version or two earlier than was necessary asked for, i was seeing this error: ``` NoMethodError: undefined method `get_targets' for nil:NilClass ./rb/lib/selenium/webdriver/devtools.rb:75:in `start_session' ./rb/lib/selenium/webdriver/devtools.rb:34:in `initialize' ./rb/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb:35:in `new' ./rb/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb:35:in `devtools' ``` because `target` was nil because it was trying to load a class named: ``` Selenium::DevTools::V#{Selenium::DevTools.version}::#{method.capitalize} ``` which resolved to: ``` Selenium::DevTools::V112::Target ``` even though the falling-back code had already given up on 112 and loaded 111 instead. The simplest way to fix this seems to be ensure that `Selenium::DevTools.version` matches what was loaded. Also now there's a test
…doesn't match (SeleniumHQ#11827) Try to load older devtools version if current doesn't match Co-authored-by: Diego Molina <[email protected]>
Fix ruby devtools version fallback When using the feature added in SeleniumHQ#11827 that loads devtools methods possibly a version or two earlier than was necessary asked for, i was seeing this error: ``` NoMethodError: undefined method `get_targets' for nil:NilClass ./rb/lib/selenium/webdriver/devtools.rb:75:in `start_session' ./rb/lib/selenium/webdriver/devtools.rb:34:in `initialize' ./rb/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb:35:in `new' ./rb/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb:35:in `devtools' ``` because `target` was nil because it was trying to load a class named: ``` Selenium::DevTools::V#{Selenium::DevTools.version}::#{method.capitalize} ``` which resolved to: ``` Selenium::DevTools::V112::Target ``` even though the falling-back code had already given up on 112 and loaded 111 instead. The simplest way to fix this seems to be ensure that `Selenium::DevTools.version` matches what was loaded. Also now there's a test
Is that release still on for this week? Our build has been breaking all week and I'm wondering whether I should start some mitigation or just wait a little bit longer. :) |
|
Release is delayed by one week, Eastern holidays happened. However, I just pushed https://rubygems.org/gems/selenium-devtools/versions/0.112.0 |
Description
This is an attempt to fix #11651.
This change makes it so, if the devtools version based on the current browser doesn't match, it tries to load an older version of devtools instead.
I added some logs/warnings to alert a user that this is happening, so they know there's something to address.
I only added 2 versions back fallback, I imagine that's plenty enough time until a new devtools release is done matching the proper version but let me know if that's not desired.
I would be happy to add tests for this but I really don't know how to do a test for something like this.
I also have to mention that I was not able to use the gem from a local clone of the repo to really really confirm this is working as expected, I CAN confirm though that the fallback is working to an extent because I can see the messages so it is trying to require older versions if the current one failed:
Motivation and Context
There's a recurring problem that when chrome gets a new major version update, requiring devtools fails until a new devtools version is released and updated in the Gemfile of the app.
Types of changes
Checklist