1. 程式人生 > >Centos 7 部署 selenium + chrome + chromedriver

Centos 7 部署 selenium + chrome + chromedriver

Centos 7 部署 selenium + chrome + chromedriver

版本要求:
centos 7
selenium >= 3.14
chrome 與 chromedriver 版本對應

NO.1 安裝 chrome

curl https://intoli.com/install-google-chrome.sh | bash
google-chrome-stable --version # 檢視版本,確認是否安裝成功

NO.2 安裝 chromedriver

wget https://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo
mv chromedriver /usr/local/bin/ chromedriver -v # 檢視版本,確認是否安裝成功

NO.3 安裝 java-8

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
tar -xvf jdk-8u141-linux-x64.tar.gz sudo mv jdk1.8.0_141/ /opt/ vim ~/.bashrc # 寫入以下程式碼 export JAVA_HOME=/opt/jdk1.8.0_141 export PATH=$JAVA_HOME/bin:$PATH # 使配置生效 source ~/.bashrc java -version

NO.4 更新 yum 源 & 安裝 git

cd  /etc/yum.repos.d
sudo wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
sudo yum update
sudo
vim /etc/yum.repos.d/wandisco-git.repo # 寫入以下程式碼 [wandisco-git] name=Wandisco GIT Repository baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco sudo yum install git ssh-keygen -t rsa cat ~/.ssh/id_rsa.pub

NO.5 安裝 pip

sudo yum -y install epel-release
sudo yum install python-pip
sudo pip install --upgrade pip

NO.6 安裝 selenium 並下載 selenium-server-standalone-3.14.0.jar

pip install --user selenium