Ubuntu installed in the system during the recording Macaca

First, the basic installation environment

1, the installation and configuration environment variable nodejs
user environment
vim ~ / .bashrc

Global System Environment
Vim ~ / .profile
Source / etc / Profile

In nodejs official website to download nodejs source node-v5.1.0-linux-x64.tar.gz, to the / opt directory;

Into the / opt directory, enter the command: tar -zxf node-v5.1.0-linux-x64.tar.gz, extract the files to the current directory

2 (This step can be saved) enter the command: mv node-v5.1.0-linux-x64.tar.gz node, file renamed node

3 Enter the command: vim / etc / profile, add at the end of the following three lines:

export NODE_HOME=/opt/node

export PATH=$PATH:$NODE_HOME/bin

export NODE_PATH=$NODE_HOME/lib/node_modules

After pressing the Esc key, and enter ": wq!" Command to save the configuration and launch

4 At the command line, enter: source / etc / profile, and then enter the command line: node -v, returns the version information v5.1.0, environment variable configuration instructions will take effect; however, you will find into the root account, and did not change the configuration become effective

5 at the command line: vi /root/.bashrc, and add a line at the end of the file source etc / profile command, save


## Configuration Taobao mirror
npm install -g cnpm --registry = https: //registry.npm.taobao.org

Has been apt-get install git, node before the system.
Version 2.17.1 git
the Node v8.10.0

Installation jdk environment
Download:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
jdk-8u201-Linux-x64.tar.gz
decompression:

$ tar -zxvf jdk-8u201-linux-x64.tar.gz /usr/local/jdk180_201
配置环境:
$vim /etc/profile 末尾:
#java 1.8
export JAVA_HOME=/usr/local/jdk180_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=.:${JAVA_HOME}/bin:$PATH
测试:
$source /etc/profile
$java --version

java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

Install android environment:
Download:
https://www.androiddevtools.cn/
SDK Tools:
androiddk_r24.4.1-linux.tgz

解压:$tar zxvf androiddk_r24.4.1-linux.tgz  /usr/local/android-sdk-linux
配置环境:
$vim /etc/profile 末尾
#android sdk 24 
export  ANDROID_HOME=/usr/local/android-sdk-linux
export  PATH=$PATH::$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools
$cd /usr/local/android-sdk-linux/tools
$./android update sdk

在 界面 Android SDK Manager选择:
tools:android sdk tools,android sdk platform-tools, android sdk build-tools
android 8.1.0 (api 27):sdk platform
extras: android support repository
然后install packages

安装gradle:
https://gradle.org/install/

$ brew install gradle
配置环境:
$vim /etc/profile
#gradle
export PATH=$PATH:/home/linuxbrew/.linuxbrew/Cellar/gradle/5.2.1/bin 测试: $grade -v 

Gradle 5.2.1

Build time: 2019-02-08 19:00:10 UTC
Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183

Kotlin DSL: 1.1.3
Kotlin: 1.3.20
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_201 (Oracle Corporation 25.201-b09)
OS: Linux 4.15.0-43-generic amd64

Installation macaca-android:

$ MAVEN_MIRROR_URL=http://maven.aliyun.com/nexus/content/groups/public/ npm i macaca-android -g $cd /usr/local/android-sdk-linux/ $mkdir licenses $vim android-sdk-license,添加如下内容 8933bad161af4178b1185d1a37fbf41ea5269c55 安装Macaca: $ npm i -g macaca-cli 安装驱动:macaca-chrome, macaca-electron $npm i macaca-chrome -g $npm i macaca-electron -g 查看本机chrome版本:版本 65.0 下载对应chromedriver:(2.36,具体可以查阅http://npm.taobao.org/mirrors/chromedriver/2.36/notes.txt) http://npm.taobao.org/mirrors/chromedriver/ http://npm.taobao.org/mirrors/chromedriver/2.36/chromedriver_linux64.zip $unzip chromedriver_linux64.zip $mv chromedriver /usr/local/lib/node_modules/macaca-chrome/node_modules/macaca-chromedriver/exec $mv chromedriver chromedriver2.45 (必须和之前文件名一致) 测试: $macaca -v 2.1.11 $macaca doctor 

macaca-doctor version: 2.0.15

Node.js checklist:

node env: /usr/bin/node
node version: v8.10.0

Android checklist:

JAVA version is 1.8
JAVA_HOME is set to /usr/local/jdk180_201
ANDROID_HOME is set to /usr/local/android-sdk-linux
Platforms is set to /usr/local/android-sdk-linux/platforms/android-27
ADB tool is set to /usr/local/android-sdk-linux/platform-tools/adb
TypeError: Cannot read property '0' of undefined
at checkJavaHome.then.catch.then.then.catch.then.std (/usr/local/lib/node_modules/macaca-cli/node_modules/java-home/lib/java-home.js:92:27)
at <anonymous>
gradle is installed, version: 5.2

Installed driver list:

android: 2.0.48
chrome: 1.1.0
electron: 2.1.3

NOTE: TypeError: Can Property Not Read '0' of undefined
AT checkJavaHome.then.catch.then.then.catch.then.std (/ usr / local / lib / the node_modules / Macaca-CLI / the node_modules / Java-Home / lib / home.js-Java: 92: 27)
AT <Anonymous>
the error temporarily to solve

Test case: (sample-python)
Reference: https://github.com/macaca-sample/sample-python

$ pip install -r requirements.txt
$cd ~/macaca/ $git clone https://github.com/macaca-sample/sample-python.git $vim sample-python/tests/macaca-desktop-sample.test # 'browserName': 'electron' 'browserName': 'chrome' (或者:https://testerhome.com/topics/6233 $ npm uninstall macaca-electron -g $npm i macaca-electron -g ) $ macaca server --verbose 

The newly opened terminal:
Python Tests / macaca-desktop-sample.test.py
appear chrome test interface

Reference article:
https://macacajs.github.io/zh/guide/
https://testerhome.com/topics/5509

Link: https: //www.jianshu.com/p/87aa06231e92
Source: Jane books

Guess you like

Origin www.cnblogs.com/zgq123456/p/12508855.html