Docker ubuntu 安装 chrome chromedriver

使用selenium时需要先安装chrome和chromedriver,以下是在Docker中安装的步骤

apt-get -y install xvfb gtk2-engines-pixbuf
apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
apt-get -y install imagemagick x11-apps
Xvfb -ac :99 -screen 0 1280x1024x16 & export DISPLAY=:99

wget -q -O - http://dl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
apt-get update -y
apt-get -y install google-chrome-stable


wget http://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip
apt-get -y install zip
apt-get -y install unzip
unzip chromedriver_linux64.zip
cp chromedriver /usr/bin/

上一篇:学会python,还怕618有抢不到的东西吗?


下一篇:Selenium3+MoocTest环境搭建常见问题解决方案