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

Posted jamesjkl

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 18.04测试环境搭建-自动化测试相关的知识,希望对你有一定的参考价值。

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测试环境搭建-自动化测试的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu 18.04 搭建hyperledge-fabric 2.x网络和fabric-explorer

ubuntu18.04+CUDA9.0+cuDNN7.1.4+tensorflow1.9 环境搭建

DPDK — 安装部署(Ubuntu 18.04)

Ubuntu18.04下QT开发Android无法连接设备问题解决

基于Jetson Nano 平台图像识别环境搭建及测试

Ubuntu18.04下QT开发Android无法连接设备问题解决