Linux平台下基于图像识别的自动化测试-sikuli环境搭建

#!/bin/bash

# 替换源
sys_list=$(head -1 /etc/apt/sources.list)
new_list=$(head -1 ./sources.list)

if [ ${sys_list} == ${new_list} ];then
    echo "源已更新!"
else
    cd /etc/apt && sudo rm -rf sources.list
    cd -
    sudo cp sources.list /etc/apt && sudo apt-get update
fi
# apt安装的方法
function apt_insatll(){
    sudo apt-get -y install $1
}

function apt_check(){
    dpkg -l | grep -i $1 > /dev/null
    if [ $? -eq 0 ];then
        echo "======$1 已安装!======="
    else
        echo "======$1 安装失败!======="
    fi    
}


# 安装依赖:
apt_insatll libcanberra-gtk0
apt_insatll libcanberra-gtk-module
apt_insatll wmctrl

# 安装opencv:
apt_insatll libopencv3.2-java
sudo ln -s /usr/lib/jni/libopencv_java320.so /usr/lib/libopencv_java.so

# 安装tesseract:
apt_insatll tesseract-ocr
apt_insatll libtesseract-dev
apt_insatll libleptonica-dev

# 安装Java环境:
apt_insatll openjdk-8-jre

# 检查apt-get命令是否安装成功
for i in libcanberra-gtk0 libcanberra-gtk-module wmctrl libopencv3.2-java tesseract-ocr libtesseract-dev libleptonica-dev openjdk-8-jre
do
    apt_check $i
done

# 创建Log目录
mkdir report
# 下载sikuli:
#wget https://launchpadlibrarian.net/469010975/sikulixide-2.0.4.jar
# 下载jython:
wget https://repo1.maven.org/maven2/org/python/jython-standalone/2.7.1/jython-standalone-2.7.1.jar
# 下载jruby:
#wget https://repo1.maven.org/maven2/org/jruby/jruby-complete/9.2.0.0/jruby-complete-9.2.0.0.jar
# 运行sikuli
java -jar sikulixide-2.0.4.jar

 

posted @ 2020-08-03 17:34  mikigo  阅读(857)  评论(0编辑  收藏  举报