系列文章目录
文章目录
前言
appuim生态
安装
初学者使用appuim desktop 可以直接录制 但是建议直接使用client server
1. 安装Java
太多的教程 这里就不再累赘
2. 安装SDK
2.1 下载
打开浏览器,进入网址:http://tools.android-studio.org/index.php/sdk
由于自己的电脑是mac, 所以下载mac的安装包
2.2 解压
下载好后进行解压,然后需要对这个sdk进行升级
因为readMe文件已经说了 这个并不是所有的你需要的, 你需要执行 tools/android update sdk --no-ui
所以以后安装文件,一定要看一下readme文件
下面是readme的原文
Welcome to the Android SDK!
The Android SDK archive initially contains only the basic SDK tools. It does
not contain an Android platform or any third-party libraries. In fact, it
doesn't even have all the tools you need to develop an application.
In order to start developing applications, you must install the Platform-tools
and at least one version of the Android platform, using the SDK Manager.
Platform-tools contains build tools that are periodically updated to support new
features in the Android platform (which is why they are separate from basic
SDK tools), including adb, dexdump, and others.
To install Platform-tools, Android platforms and other add-ons, you must
have an Internet connection, so if you plan to use the SDK while
offline, please make sure to download the necessary components while online.
To start the SDK Manager, please execute the program "android".
From the command-line you can also directly trigger an update by
executing:
tools/android update sdk --no-ui
Tip: use --help to see the various command-line options.
For more information, please consult the Android web site at
http://developer.android.com/sdk/
2.3 脚本升级
进入安装包目录
执行了脚本 tools/android update sdk --no-ui
允许java操作
命令运行中需要对一些协议进行允许, 直接点击y就行
2.4 配置环境变量
vim ~/.bash_profile
export ANDROID_HOME=/Users/XXX/Downloads/android-sdk-macosx
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
运行 source ~/.bash_profile
然后命令行输入 adb 显示如下就安装成功了
3. 安装Appium
sudo npm install -g cnpm --regitry=https://registry.npm.taobao.org
sudo cnpm install -g appium
遇到一个坑就是
报错 Error: Request failed with status code 404,[npminstall:runscript:error] appium-android试下下面的:
npm install appium -g --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
最后验证成功
你也可以安装appium desktop 自带appium server
3.使用
4. 元素定位与等待
Appium的官网网站有些卡, 我找了看云网站的内容 也很全面可以直接看看 但是不知道更新是不是及时,可以点击以下链接进入
https://www.kancloud.cn/testerhome/appium_docs_cn/2001595
4.1 Capability
Json格式的内容,当一个新的自动化会话被请求时,Appium客户端发送此参数到服务端
{
"platformName": "iOS",
"platformVersion": "11.0",
"deviceName": "iPhone 7",
"automationName": "XCUITest",
"app": "/path/to/my.app"
}