Skip to content

Commit

Permalink
add support for 97
Browse files Browse the repository at this point in the history
drop support for chrome 91, 92
  • Loading branch information
ichylinux committed Feb 14, 2022
1 parent 2685ec4 commit 8740c61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/itamae/plugin/recipe/selenium/chrome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

execute 'yum update -y google-chrome-stable' do
user 'root'
not_if "which google-chrome-stable && google-chrome-stable --version | egrep 'Google Chrome (91|92|93|94|96)\.'"
not_if "which google-chrome-stable && google-chrome-stable --version | egrep 'Google Chrome (93|94|96|97)\.'"
end
2 changes: 1 addition & 1 deletion lib/itamae/plugin/recipe/selenium/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Itamae
module Plugin
module Recipe
module Selenium
VERSION = '0.3.2'
VERSION = '0.3.3'
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions lib/itamae/plugin/resource/setup_selenium_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ def run_setup_chromedriver
base_url = 'https://' + host
browser_version = run_command('sudo yum list | grep google-chrome-stable').stdout.split[1]
browser_version = Gem::Version.new(browser_version.to_s).segments[0..2].join('.')

driver_version_url = base_url + "/LATEST_RELEASE_#{browser_version}"
driver_version = Net::HTTP.get_response(URI(driver_version_url)).body

# see https://stackoverflow.com/questions/70967207/selenium-chromedriver-cannot-construct-keyevent-from-non-typeable-key/70968668
driver_version = '97.0.4692.71' if driver_version.start_with?('98.')

download_url = base_url + "/#{driver_version}/chromedriver_linux64.zip"
header = Net::HTTP.start(host) { |http| http.head("/#{driver_version}/chromedriver_linux64.zip") }
etag = header['etag'][1...-1]

Itamae.logger.debug "browser version: #{browser_version}"
Itamae.logger.debug "driver version: #{driver_version}"
Itamae.logger.info "browser version: #{browser_version}"
Itamae.logger.info "driver version: #{driver_version}"
Itamae.logger.debug "download url: #{download_url}"
Itamae.logger.debug "etag: #{etag}"

Expand Down

0 comments on commit 8740c61

Please sign in to comment.