英文:
How to install Chrome for Testing from zip file on Debian?
问题
使用:
发行版 ID:Debian
描述:Debian GNU/Linux 10(buster)
版本:10
代号:buster
Google 现在建议人们在测试自动化中使用 Chrome 而不是商业版本的 Chrome,但我找不到使其工作的方法。这是我们最初在流水线中使用的方式:
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
apt-get -y update
apt-get -y install google-chrome-stable
但现在使用 Chrome 测试的新 API,这是我在我们的 shell 脚本中使用的内容:
LATEST_CHROME_JSON=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq '.channels.Stable')
LATEST_CHROME_URL=$(echo "$LATEST_CHROME_JSON" | jq -r '.downloads.chrome[] | select(.platform == "linux64") | .url')
wget -N "$LATEST_CHROME_URL" -P ~/
unzip ~/chrome-linux64.zip -d ~/
rm ~/chrome-linux64.zip
mkdir -p /opt/chrome
mv ~/chrome-linux64/* /opt/chrome/
rm -r ~/chrome-linux64
ln -s /opt/chrome/chrome /usr/local/bin/chrome
chmod +x /opt/chrome/chrome
chrome --version
每次我使用 chrome --version
时,流水线都会失败,因为缺少某个依赖项。为什么之前不需要这些依赖项?如何让它打印出所有必需的依赖项,而不是一个接一个地出错?目前,我不断添加一个新的依赖项来安装,提交并推送,运行我的流水线,只看到一个全新的错误和一个全新的依赖项是必需的。
我正在安装的依赖项:
apt-get update
apt-get install -y unzip openjdk-8-jre-headless
apt-get install -y xvfb libxi6 libgconf-2-4 jq libjq1 libonig5 #xorg apt-get install -y jq libjq1 libonig5
apt-get install -y libnss3
apt-get install -y libatk1.0-0
apt-get install -y libatk-bridge2.0-0
我不得不将它们分开,因为 openjdk-8-jre-headless
一直失败,因为某种原因它缺失了或其他什么问题。我记得从这个安装 Chrome 的教程中获取了这些依赖项:
https://gist.github.com/buttreygoodness/09e26d7f21eb5b95a4229658a7a9b321
当我发布这个问题时,我的流水线刚刚再次失败,这次出现了错误:
chrome: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
这让人非常沮丧。肯定有一种更好的方法来从像这样的 zip 文件中安装 Chrome。我不明白为什么他们不能像通常一样制作一个 .deb
文件。
英文:
Using:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Google is now recommending that people use Chrome for Testing for their test automation instead of commercial version of Chrome and I can't find a way to make it work. This is originally how we did it in our pipeline:
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
apt-get -y update
apt-get -y install google-chrome-stable
But now using the new api for Chrome for Testing this is what I'm using in our shell script:
LATEST_CHROME_JSON=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq '.channels.Stable')
LATEST_CHROME_URL=$(echo "$LATEST_CHROME_JSON" | jq -r '.downloads.chrome[] | select(.platform == "linux64") | .url')
wget -N "$LATEST_CHROME_URL" -P ~/
unzip ~/chrome-linux64.zip -d ~/
rm ~/chrome-linux64.zip
mkdir -p /opt/chrome
mv ~/chrome-linux64/* /opt/chrome/
rm -r ~/chrome-linux64
ln -s /opt/chrome/chrome /usr/local/bin/chrome
chmod +x /opt/chrome/chrome
chrome --version
Everytime I use chrome --version
the pipeline fails because some dependency or another is missing. How come I didn't need any of these dependencies before? And how do I have it print out all the required dependencies instead of erroring out one by one? Right now I keep adding a new dependency to install, commit and push, run my pipeline, only to see a brand new error and a brand new dependency is needed.
The dependencies I'm installing:
apt-get update
apt-get install -y unzip openjdk-8-jre-headless
apt-get install -y xvfb libxi6 libgconf-2-4 jq libjq1 libonig5 #xorg apt-get install -y jq libjq1 libonig5
apt-get install -y libnss3
apt-get install -y libatk1.0-0
apt-get install -y libatk-bridge2.0-0
I had to separate them because openjdk-8-jre-headless
kept failing because for some reason it's missing or something. I remember getting this from this tutorial on installing chrome:
https://gist.github.com/buttreygoodness/09e26d7f21eb5b95a4229658a7a9b321
As I post this, my pipeline just failed again this time with error
chrome: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
This is getting frustrating. There has to be a better way to install chrome from a zip file like this. I don't understand why they couldn't just make a .deb
file like they normally do
答案1
得分: 4
最终通过使用以下依赖项成功工作:
apt-get install -y unzip xvfb libxi6 libgconf-2-4 jq libjq1 libonig5 libxkbcommon0 libxss1 libglib2.0-0 libnss3 \
libfontconfig1 libatk-bridge2.0-0 libatspi2.0-0 libgtk-3-0 libpango-1.0-0 libgdk-pixbuf2.0-0 libxcomposite1 \
libxcursor1 libxdamage1 libxtst6 libappindicator3-1 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libxfixes3 \
libdbus-1-3 libexpat1 libgcc1 libnspr4 libgbm1 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxext6 \
libxrandr2 libxrender1 gconf-service ca-certificates fonts-liberation libappindicator1 lsb-release xdg-utils
LATEST_CHROME_RELEASE=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq '.channels.Stable')
LATEST_CHROME_URL=$(echo "$LATEST_CHROME_RELEASE" | jq -r '.downloads.chrome[] | select(.platform == "linux64") | .url')
wget -N "$LATEST_CHROME_URL" -P ~/
unzip ~/chrome-linux64.zip -d ~/
mv ~/chrome-linux64 ~/chrome
ln -s ~/chrome/chrome /usr/local/bin/chrome
chmod +x ~/chrome
rm ~/chrome-linux64.zip
英文:
Finally worked by using these dependencies
apt-get install -y unzip xvfb libxi6 libgconf-2-4 jq libjq1 libonig5 libxkbcommon0 libxss1 libglib2.0-0 libnss3 \
libfontconfig1 libatk-bridge2.0-0 libatspi2.0-0 libgtk-3-0 libpango-1.0-0 libgdk-pixbuf2.0-0 libxcomposite1 \
libxcursor1 libxdamage1 libxtst6 libappindicator3-1 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libxfixes3 \
libdbus-1-3 libexpat1 libgcc1 libnspr4 libgbm1 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxext6 \
libxrandr2 libxrender1 gconf-service ca-certificates fonts-liberation libappindicator1 lsb-release xdg-utils
LATEST_CHROME_RELEASE=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq '.channels.Stable')
LATEST_CHROME_URL=$(echo "$LATEST_CHROME_RELEASE" | jq -r '.downloads.chrome[] | select(.platform == "linux64") | .url')
wget -N "$LATEST_CHROME_URL" -P ~/
unzip ~/chrome-linux64.zip -d ~/
mv ~/chrome-linux64 ~/chrome
ln -s ~/chrome/chrome /usr/local/bin/chrome
chmod +x ~/chrome
rm ~/chrome-linux64.zip
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论