titusfortner / webdrivers

Keep your Selenium WebDrivers updated automatically
MIT License
593 stars 111 forks source link

Installing the ARM chromedriver on x86 mac #202

Closed ambirdsall-gogo closed 3 years ago

ambirdsall-gogo commented 3 years ago

Summary

On a mac, Webdrivers::Chromedriver.update resolves the latest chromedriver binary to the version compiled for the new ARM macs, even on macs with x86 chips. Now any code path which uses chromedriver or the Webdrivers code related to it leads to error messages containing Bad CPU type in executable - ~/.webdrivers/chromedriver (Errno::E086)

Debug Info

Please provide the following information for bug reports:

Expected Behavior

I expect Webdrivers to install 88.0.4324.96/chromedriver_mac64.zip from https://chromedriver.storage.googleapis.com/

Actual Behavior

Webdrivers installs 88.0.4324.96/chromedriver_mac64_m1.zip

Caveat

I can't see a way to properly verify the version it installed, so the "Actual Behavior" is to some degree an educated guess:

➣ rake webdrivers:chromedriver:version
/Users/alex.birdsall/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``': Bad CPU type in executable - /Users/alex.birdsall/.webdrivers/chromedriver (Errno::E086)
        [long stack trace omitted]

➣ file ~/.webdrivers/chromedriver
/Users/alex.birdsall/.webdrivers/chromedriver: Mach-O 64-bit executable arm64
ambirdsall-gogo commented 3 years ago

I updated the code to use version 4.5.0 of webdrivers, but to no avail:

➣ grep webdrivers Gemfile.lock
    webdrivers (4.5.0)
  webdrivers (~> 4.5)

➣ rails routes
rails aborted!
Errno::E086: Bad CPU type in executable - /Users/alex.birdsall/.webdrivers/chromedriver
[stack trace leading to the rails initializer which calls `Webdrivers::Chromedriver.update`]
ambirdsall-gogo commented 3 years ago

Apologies for spamming the notifications for this project as I work through the issue; once I deleted the unusable-but-version-conformant chromedriver binary, the latest version of the gem installed the correct replacement in its place. It's possible to add code to check the installed driver's architecture against the system along with the version check, but I'm not remotely sure that the added complexity's maintenance burden would be justified by closing out a transient edge case.

Thanks for making such a helpful tool!

kapoorlakshya commented 3 years ago

@ambirdsall-gogo Glad you figured it out. This was something that crossed my mind when merging the PR, but didn't act on it since this is a one time manual step. Besides that, I assumed most people were just starting fresh (without any drivers) on their shiny new M1 macs :).

kapoorlakshya commented 3 years ago

I have updated the README with a note for other users - https://github.com/titusfortner/webdrivers#chrome-and-edge-on-apple-m1-arm64