Skip to content

Instantly share code, notes, and snippets.

@Sen
Last active March 1, 2021 03:45
Show Gist options
  • Save Sen/01d41636cf0043e1beb81172e7a69c6f to your computer and use it in GitHub Desktop.
Save Sen/01d41636cf0043e1beb81172e7a69c6f to your computer and use it in GitHub Desktop.
chrome driver upgrade
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