Linux 搭建Selenium自动化测试环境

Centos 7搭建

1: 安装Firefox

当前最新版本93.其他版本可以前往火狐官网下载: https://www.mozilla.org/

yum remove firefox -y
rm -rf /usr/lib64/firefox
rm -rf /usr/bin/firefox
wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/93.0/linux-x86_64/zh-CN/firefox-93.0.tar.bz2
tar -xjvf firefox-93.0.tar.bz2
mv firefox /usr/lib64
ln -s /usr/lib64/firefox/firefox /usr/bin/firefox

2:安装Geckodriver

其他版本可以到: https://npm.taobao.org/mirrors/geckodriver/ 下载

wget https://npm.taobao.org/mirrors/geckodriver/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar -zxvf geckodriver-v0.30.0-linux64.tar.gz
sudo rm -rf /usr/bin/geckodriver
sudo mv geckodriver /usr/bin/geckodriver
sudo chmod -R 777  /usr/bin/geckodriver

Ubuntu 20 搭建

1: 安装Firefox

当前最新版本93.其他版本可以前往火狐官网下载: https://www.mozilla.org/

wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/93.0/linux-x86_64/zh-CN/firefox-93.0.tar.bz2
tar -xjvf firefox-93.0.tar.bz2
apt remove firefox -y
apt install libdbus-glib-1-2 libdbusmenu-glib4 libdbusmenu-gtk3-4 xul-ext-ubufox libgtk-3-dev -y
rm -rf /usr/lib64/firefox
mv firefox /usr/lib64
rm -rf /usr/bin/firefox
ln -s /usr/lib64/firefox/firefox /usr/bin/firefox
apt install libdbus-glib-1-2 libdbusmenu-glib4 libdbusmenu-gtk3-4 xul-ext-ubufox libgtk-3-dev -y

2:安装Geckodriver

其他版本可以到: https://npm.taobao.org/mirrors/geckodriver/ 下载

wget https://npm.taobao.org/mirrors/geckodriver/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar -zxvf geckodriver-v0.30.0-linux64.tar.gz
sudo rm -rf /usr/bin/geckodriver
sudo mv geckodriver /usr/bin/geckodriver
sudo chmod -R 777  /usr/bin/geckodriver
# Selenium  

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×