Android SDK
解压配置:
进入安卓系统的开发者模式进行USB调试
安卓系统版本是4.2.2以上的,包括4.4、5.0
1.系统设置
2.关于手机
3.版本号,在最底下一行,连续猛点七八下,激活开发者模式
4.返回“系统设置”这层,你可以看到“开发者模式”
这时,你可以打开“开发者模式”比如:USB调试
问题
如果adb devices 一直显示offline 则可以运行adb kill-server 或者重启电脑
检测
genymotion
安装需要注册,创建虚拟机时选择个人使用
安装app问题
由于市场上大部分应用都是基于ARM架构来编译的,因此,与默认模拟器,真机相比,对于包含仅支持ARM架构的so的应用,默认不支持。
点击下载ARM_Translation_Android系列包
appium
1. nodejs 安装appium
npm install –g appium 或者
npm --registry http://registry.cnpmjs.org install -g appium (推荐这种,npm的国内镜像)
2. appium 客户端
3. python 需要的包
selenium
Appium-Python-Client 下载安装(或者:pip install Appium-Python-Client)
启动 appium 和 android 机
appium 启动
C:\Users\Administrator>appium
[Appium] Welcome to Appium v1.6.5
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
android 模拟器 正常启动 或者 真机启动
第一个例子
1.
2.
3.
4. python unit test
import unittest
from appium import webdriver
class MyTestCase(unittest.TestCase):
def test_something(self):
self.assertEqual(True, False)
# 获取操作实例
def setUp(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.3'
desired_caps['deviceName'] = '192.168.77.101:5555'
'''
>adb logcat | find 'START' windows
cmp=com.android.calculator2
'''
desired_caps['appPackage'] = 'com.android.calculator2'
# /.Calculator (has extras)}
desired_caps['appActivity'] = '.Calculator'
desired_caps['unicodeKeyboard'] = 'True'
desired_caps['resetKeyboard'] = 'True' # appium 会在android 上安装一个特定的输入法
# 获取句柄
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
# 资源释放
def tearDown(self):
self.driver.quit()
#测试脚本
def testAdd(self):
# locate
digit_8 = self.driver.find_element_by_id('digit8')
# Operate
digit_8.click()
op_add = self.driver.find_element_by_id('plus')
op_add.click()
digit_2 = self.driver.find_element_by_id('digit2')
digit_2.click()
eq = self.driver.find_element_by_id('equal')
eq.click()
if __name__ == '__main__':
unittest.main()
5.
安装包
链接:http://pan.baidu.com/s/1pK8fGQR 密码:1emd