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

Webdrivers::NetworkError, probably due to new chromedriver naming #237

Closed
ansonhoyt opened this issue Sep 28, 2022 · 6 comments · Fixed by #239
Closed

Webdrivers::NetworkError, probably due to new chromedriver naming #237

ansonhoyt opened this issue Sep 28, 2022 · 6 comments · Fixed by #239

Comments

@ansonhoyt
Copy link

Summary

It looks like Webdrivers' download_file gets a 404 because Google changed chromedriver's filename scheme with 106.0.5249.61.

Debug Info

  • Webdrivers version: 5.1.0
  • Ruby version: 3.0.4 (and 2.7.6 with another app. Both compiled for Apple's arm64, not x86_64 + Rosetta.)
  • Operating system / CI Environment: macOS 12.6 with an M1 Max
  • Browser and version: chromedriver 106.0.5249.61

Expected Behavior

download_file should download: https://chromedriver.storage.googleapis.com/106.0.5249.61/chromedriver_mac_arm64.zip

Actual Behavior

download_file tried to download: https://chromedriver.storage.googleapis.com/106.0.5249.61/chromedriver_mac64_m1.zip

/Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/network.rb:19:in `get': Net::HTTPServerException: 404 "Not Found" with https://chromedriver.storage.googleapis.com/106.0.5249.61/chromedriver_mac64_m1.zip (Webdrivers::NetworkError)
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/system.rb:74:in `block (2 levels) in download_file'
	from /Users/ahoyt/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tempfile.rb:317:in `open'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/system.rb:73:in `block in download_file'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/system.rb:72:in `chdir'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/system.rb:72:in `download_file'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/system.rb:63:in `download'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/common.rb:98:in `update'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/webdrivers-5.1.0/lib/webdrivers/chromedriver.rb:149:in `block in <top (required)>'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/actionpack-7.0.4/lib/action_dispatch/system_testing/browser.rb:36:in `preload'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/actionpack-7.0.4/lib/action_dispatch/system_testing/driver.rb:27:in `initialize'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/actionpack-7.0.4/lib/action_dispatch/system_test_case.rb:159:in `new'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/actionpack-7.0.4/lib/action_dispatch/system_test_case.rb:159:in `driven_by'
	from /Users/ahoyt/code/eita/eita-activity/test/application_system_test_case.rb:10:in `<class:ApplicationSystemTestCase>'
	from /Users/ahoyt/code/eita/eita-activity/test/application_system_test_case.rb:5:in `<main>'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/ahoyt/code/eita/eita-activity/test/system/activities_test.rb:1:in `<main>'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/test_unit/runner.rb:47:in `block in load_tests'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/test_unit/runner.rb:47:in `each'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/test_unit/runner.rb:47:in `load_tests'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/test_unit/runner.rb:40:in `run'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/commands/test/test_command.rb:33:in `perform'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/ahoyt/.rvm/gems/ruby-3.0.4@eita-activity/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:4:in `<main>'

Looking through https://chromedriver.storage.googleapis.com/, the naming seems to change with chromedriver 106.0.5249.61.

It looks like driver_filename always returns "mac64_m1" but should start returning "mac_arm64" for new chromedriver releases.

@ansonhoyt
Copy link
Author

Thanks to your helpful Version Pinning docs ❤️ , my system tests are running great on the previous version:

# test/application_system_test_case.rb
require 'test_helper'

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  Webdrivers::Chromedriver.required_version = '106.0.5249.21' # <= this version works

  driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end

@kapoorlakshya
Copy link
Collaborator

Oh Google...

Updating Chromedriver#driver_filename to return a version appropriate filename should work:

elsif System.platform == 'mac'
apple_arch = apple_m1_compatible?(driver_version) ? '_m1' : ''
"mac64#{apple_arch}"

Could either of you submit a PR? If not then I can try to take a look this week.

@jmccure
Copy link
Contributor

jmccure commented Sep 29, 2022

@kapoorlakshya I have submitted a PR for this issue

@kapoorlakshya
Copy link
Collaborator

kapoorlakshya commented Sep 29, 2022

v5.2.0 has been released. Thanks again, @jmccure!

@jmccure
Copy link
Contributor

jmccure commented Sep 30, 2022

No worries, I have added some tests in this PR #240

olttwa added a commit to simpledotorg/simple-server that referenced this issue Nov 4, 2022
olttwa added a commit to simpledotorg/simple-server that referenced this issue Nov 8, 2022
olttwa added a commit to simpledotorg/simple-server that referenced this issue Nov 9, 2022
* Update webdriver gem to 5.2.0 version

- Reason: SeleniumHQ/selenium#11066
- titusfortner/webdrivers#237

* Add NodeJS installation step in setup & README

* Update google-protobuf gem version to match Gemfile.lock
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.

4 participants