Last active
March 1, 2021 03:45
-
-
Save Sen/01d41636cf0043e1beb81172e7a69c6f to your computer and use it in GitHub Desktop.
chrome driver upgrade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome_string = %x(google-chrome --version) | |
chrome_string =~ /([\.\d]+)/ | |
version = $1 | |
local_chromedriver = %x(chromedriver --version) rescue '' | |
local_chromedriver =~ /([\.\d]+)/ | |
local_chromedriver_version = $1 | |
if version != local_chromedriver_version | |
url = "https://chromedriver.storage.googleapis.com/#{version}/chromedriver_linux64.zip" | |
puts "upgrading chrome driver with: #{url}" | |
system("curl #{url} > chromedriver_linux64_#{version}.zip") | |
system("unzip chromedriver_linux64_#{version}.zip -d chromedriver_#{version}") | |
system("cp chromedriver_#{version}/chromedriver $HOME/bin/") | |
else | |
puts "version match, no need to upgrade" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment