码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu 18.04测试环境搭建-自动化测试

时间:2018-09-27 18:04:01      阅读:471      评论:0      收藏:0      [点我收藏+]

标签:-o   current   print   vim   .bashrc   .com   环境搭建   get   sel   

Python(python2.7/ 3.6/3.7 + pip1/3 + selenium3.14.0 + chromedriver2.42 + JDK8 + selenium-server-standalone3.14 + xvfb)自动化测试环境搭建

安装python2.7

  sudo apt install python2.7

  sudo apt install python-minimal

安装curl

  sudo apt install curl

获取pip

  sudo apt-get install python3-distutils

  sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

安装pip

  sudo python3 get-pip.py

pip3安装

  sudo apt-get install python3-pip

pip3查看版本

  sudo pip3 –V

  sudo pip –V

pip3升级

  sudo pip3 install –upgrade pip

卸载pip

  sudo python3 –m pip uninstall pip

  sudo spt-get remove python3-pip

绑定pip3和python3

  sudo vim ~/.bashrc

  最后一行添加

    alias pip=/usr/local/bin/pip3.6

    alias python=/usr/bin/python3.6

  更新环境

    sudo source ~/.bashrc

安装chrome

  sudo Wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

  sudo dpkg –i google-chrome*.deb

报错修复

  sudo apt-get install –f

安装selenium

  sudo pip3 install selenium

显示selenium版本

  python3

  Import selenium

  print(selenium.__version__)

安装chromedriver

  查看最高版本:

  http://chromedriver.storage.googleapis.com/index.html

  sudo wget –N http://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip

  sudo unzip chromedriver_linux64.zip

  sudo chmod +x chromedriver

  sudo Mv –f chromedriver /usr/local/share/chromedriver

  sudo Ln –s /usr/local/share/chromedriver /usr/local/bin/chromedriver

  sudo Ln –s /usr/local/share/chromedriver /usr/bin/chromedriver

安装JDK8

  sudo add-apt-repository ppa:webupd8team/java

  sudo apt-get update

  sudo apt-get install oracle-java8-installer

配置java环境

  sudo update-java-alternatives -s java-8-oracle

查看java安装版本

  java -version

安装selenium-server-standalone

  查看最高版本:

  http://selenium-release.storage.googleapis.com/index.html

  sudo wget http://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar

运行selenium-server-standalone

  java –jar selenium-server-standalone –role hub

  java –jar selenium-server-standalone –role node –port 5555

  java –jar selenium-server-standalone –role node –port 5556 –hub http://主机IP:4444/grid/register

解决XShell运行RC模式错误问题

  安装xvfb

    sudo apt-get install xvfb

  运行xvfb

    sudo Xvfb :10 –ac

  新建会话并指定输出显示

    export DISPLAY=:10

打开节点

  java -jar selenium-server-standalone-3.14.0.jar -role node -port 5556 -hub http://192.168.186.1:4444/grid/register

Ubuntu 18.04测试环境搭建-自动化测试

标签:-o   current   print   vim   .bashrc   .com   环境搭建   get   sel   

原文地址:https://www.cnblogs.com/jamesjkl/p/9714259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!