itamae-plugin-recipe-selenium 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c09754552df248ca7a5ae610ad75319bcde6ca1c669d52234ebd466d79e2ac55
|
|
4
|
+
data.tar.gz: 98b9ce4b0d3a9cf33f7d84346ece31095f8d0fde8e8f0e2e2e97fc6cb4197909
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb05ad92669d9e2e7681687d47489d0abbeec37f389bca1e4bbb9d84b746b9535d2eeb7671c3fffcca2bffaba6bc80e92e7fed24c8ef66d88ed9d2f1b6bb4392
|
|
7
|
+
data.tar.gz: 9aaef2f6bf0445b2b7dfff4c7488eef1bc1ec8fd2153b46c062963f3fde46df885040128f67433d7e29ca767b1a7f09337a8ebc3e6980f072311e8a0d6c47ccd
|
|
@@ -7,11 +7,11 @@ template '/etc/yum.repos.d/google-chrome.repo' do
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
if ENV['CHROME_VERSION'].to_s.empty?
|
|
10
|
-
ENV['CHROME_VERSION'] = '
|
|
10
|
+
ENV['CHROME_VERSION'] = '117.0.5938.92'
|
|
11
11
|
|
|
12
12
|
execute "yum install -y https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-stable-#{ENV['CHROME_VERSION']}-1.x86_64.rpm" do
|
|
13
13
|
user 'root'
|
|
14
|
-
not_if "which google-chrome-stable && google-chrome-stable --version | egrep 'Google Chrome (
|
|
14
|
+
not_if "which google-chrome-stable && google-chrome-stable --version | egrep 'Google Chrome (115|116|117)\.'"
|
|
15
15
|
end
|
|
16
16
|
else
|
|
17
17
|
execute "yum install -y https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-stable-#{ENV['CHROME_VERSION']}-1.x86_64.rpm" do
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'net/https'
|
|
3
|
+
require 'uri'
|
|
2
4
|
|
|
3
5
|
module Itamae
|
|
4
6
|
module Plugin
|
|
@@ -32,41 +34,35 @@ module Itamae
|
|
|
32
34
|
private
|
|
33
35
|
|
|
34
36
|
def run_setup_chromedriver
|
|
35
|
-
host = 'chromedriver.storage.googleapis.com'
|
|
36
|
-
base_url = 'https://' + host
|
|
37
37
|
browser_version = run_command('sudo yum list | grep google-chrome-stable').stdout.split[1]
|
|
38
38
|
browser_version = Gem::Version.new(browser_version.to_s).segments[0..2].join('.')
|
|
39
|
-
|
|
40
|
-
driver_version_url = base_url + "/LATEST_RELEASE_#{browser_version}"
|
|
41
|
-
driver_version = Net::HTTP.get_response(URI(driver_version_url)).body
|
|
42
|
-
|
|
43
|
-
# see https://stackoverflow.com/questions/70967207/selenium-chromedriver-cannot-construct-keyevent-from-non-typeable-key/70968668
|
|
44
|
-
driver_version = '97.0.4692.71' if driver_version.start_with?('98.')
|
|
45
|
-
|
|
46
|
-
download_url = base_url + "/#{driver_version}/chromedriver_linux64.zip"
|
|
47
|
-
header = Net::HTTP.start(host) { |http| http.head("/#{driver_version}/chromedriver_linux64.zip") }
|
|
48
|
-
etag = header['etag'][1...-1]
|
|
49
|
-
|
|
50
39
|
Itamae.logger.info "browser version: #{browser_version}"
|
|
40
|
+
|
|
41
|
+
driver_version_url = 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json'
|
|
42
|
+
driver_versions = JSON.parse(Net::HTTP.get_response(URI(driver_version_url)).body)
|
|
43
|
+
driver_version_info = driver_versions['versions'].select{|hash| hash['version'].start_with?(browser_version) }.sort{|a, b| a['revision'] <=> b['revision'] }.last
|
|
44
|
+
driver_version = driver_version_info['version']
|
|
51
45
|
Itamae.logger.info "driver version: #{driver_version}"
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
|
|
47
|
+
driver_download_url = driver_version_info['downloads']['chromedriver'].find{|hash| hash['platform'] == 'linux64' }&.[]('url')
|
|
48
|
+
Itamae.logger.info "driver download url: #{driver_download_url}"
|
|
54
49
|
|
|
55
50
|
run_command_if_not(
|
|
56
51
|
'download chromedriver',
|
|
57
|
-
"
|
|
52
|
+
"#{attributes.install_dir}chromedriver -v | grep 'ChromeDriver #{driver_version} '",
|
|
58
53
|
<<-COMMANDS
|
|
59
|
-
rm -
|
|
60
|
-
curl -o
|
|
54
|
+
rm -f chromedriver-linux64.zip
|
|
55
|
+
curl -o chromedriver-linux64.zip #{driver_download_url}
|
|
61
56
|
COMMANDS
|
|
62
57
|
)
|
|
63
58
|
|
|
64
59
|
run_command_if_not(
|
|
65
60
|
'install chromedriver',
|
|
66
|
-
"#{attributes.install_dir}chromedriver -v | grep 'ChromeDriver #{driver_version}'",
|
|
61
|
+
"#{attributes.install_dir}chromedriver -v | grep 'ChromeDriver #{driver_version} '",
|
|
67
62
|
<<-COMMANDS
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
rm -Rf chromedriver-linux64/
|
|
64
|
+
unzip chromedriver-linux64.zip
|
|
65
|
+
sudo mv -f chromedriver-linux64/chromedriver #{attributes.install_dir}
|
|
70
66
|
COMMANDS
|
|
71
67
|
)
|
|
72
68
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: itamae-plugin-recipe-selenium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- y-matsuda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: itamae
|