Appium环境的安装与配置,Python测试脚本测试
Appium自动化测试系列1 - Appium环境的安装与配置
寻找 会’偷懒’的开发者线下公开课,报名即享受免费体验云主机
之前一直使用Robotium做为Android App测试框架的底层基础,受限于跨进程,以及控件加载的一些限制,很多特殊场景无法覆盖,决定尝试久闻的Appium(它也差不多成熟了),顺便做个笔记,方便其他有同样需求的朋友。
先从安装说起吧,关于Appium的安装,网上的资料大多语焉不详,基本上你按照他们写的步骤,是不可能装的出一个完整的环境的。所以,为了把步骤 写得详细一点,自己从无到有反复试了几次,确保自己的安装步骤是完整的。(当然,安装方法其实有多种,这里只是其中的一种而已。) 这里以Python作为脚本开发语言为例:
1 安装并配置JDK,1.6或者1.7版均可,建议1.7,Java SDK的安装很简单,不详述了。(装JDK是因为后面Android SDK要依赖它)
2 安装Android SDK并配置环境变量(测试中用到Android SDK的一些工具)
1) 安装Android SDK https://developer.android.com/sdk/installing/index.html?pkg=tools
2) 安装完毕后启动Android SDK Manger (SDK Manager.exe,在Android SDK的安装目录下),安装需要的Android Packages,比如一些工具,需要的Android版本, EABI(模拟器相关的包)等等
3) 添加环境变量Android_HOME, 值是Android SDK的安装路径; 并把Android SDK下的platform-tools路径和tools路径添加到环境变量Path (%ANDROID_HOME%\platform-tools; %ANDROID_HOME%\tools;)
3 安装Python开发环境并配置环境变量
1) 下载并安装Python2.7 https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi
2)将Python2.7的安装路径(也就是python.exe所在的目录)添加到环境变量Path
4 安装Nodejs (Appium使用Node.js作为服务器引擎)
1) 下载并安装Node.js http://nodejs.org/dist/v0.10.35/node-v0.10.35-x86.msi
2) 把Node.js的安装路径(也就是node.exe文件所在的目录)添加到环境变量Path
5 安装Appium。
1) 打开CMD窗口,执行 npm install -g appium 命令开始安装Appium. Appium默认被安装到C:\Users\Administrator\AppData\Roaming\npm\ 下。
2) 把路径C:\Users\Administrator\AppData\Roaming\npm\ (appium可执行文件所在的目录)添加到环境变量Path
至此,Appium的环境就算搭建好了。打开CMD窗口,执行 appium 即可运行起来。默认侦端口为4723。运行状态如下图:

Appium自动化测试系列2- 写一个Python测试脚本来测试一下YY语音
寻找 会’偷懒’的开发者线下公开课,报名即享受免费体验云主机
我们在《Appium自动化测试系列1-Appium环境的安装和配置》里已经搭好了Appium的基本环境,这一章,我们就来真刀真枪使用一下Appium, 看看Appium是如果来实现自动化测试的。在写测试脚本之前,我们先安装几个必要的Python三方库。
1 安装Python的setuptools库 (因为安装Python的Selenium库需要用到它)
1) 下载setuptools文件并解压 https://pypi.python.org/pypi/setuptools/12.0.4#downloads
2) 打开CMD窗口,进入解压后的setuptools目录,执行命令python setup.py install 进行安装
|
1
|
D:\setuptools-12.0.4>python setup.py install |
2 安装Python的Selenium库(Appium是采用WebDriver传输测试请求,利用Selenium的WebDriver功能)
1) 下载selenium文件并解压 https://pypi.python.org/pypi/selenium/2.44.0
2) 打开CMD窗口,进入解压后的selenium目录,执行命令python setup.py install 进行安装
|
1
|
D:\selenium-2.44.0>python setup.py install |
3 下载Python的HTMLTestRunner.py,保存到Python安装路径的Lib目录下(如C:\Python27\Lib)。
下载地址 http://tungwaiyip.info/software/HTMLTestRunner.html
接下来,在你的Android手机上安装一个YY语音(我们以YY语音为例),然后把你的手机连接到电脑(建议采用Android4.x的手机),
执行命令adb devices 查看手机的deviceName,比如我的手机deviceName是 4d00b6a5bee8a047
|
1
2
3
|
D:\>adb devicesList of devices attached4d00b6a5bee8a047 device |
开始写测试脚本my_android_test.py(脚本里要配置正确deviceName,软件包和启动Activity):
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#coding:utf-8import osimport HTMLTestRunnerimport unittestfrom selenium import webdriver# Returns abs path relative to this file and not cwdPATH = lambda p: os.path.abspath( os.path.join(os.path.dirname(__file__), p))class elementA(unittest.TestCase): def test_(self): desired_caps = {} desired_caps['deviceName'] = '4d00b6a5bee8a047' #adb devices查到的设备名 desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '4.2' desired_caps['appPackage'] = 'com.duowan.mobile' #被测App的包名 desired_caps['appActivity'] = 'com.yy.mobile.ui.splash.SplashActivity' #启动时的Activity driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) el = driver.find_element_by_name(u"神曲") self.assertIsNotNone(el) el.click() yueBang = driver.find_element_by_name(u"月榜") self.assertIsNotNone(yueBang) yueBang.click() driver.quit() if __name__ == '__main__': testunit=unittest.TestSuite() #定义一个单元测试容器 testunit.addTest(elementA("test_")) #将测试用例加入到测试容器中 filename="./myAppiumLog.html" #定义个报告存放路径,支持相对路径。 fp=file(filename,'wb') runner = HTMLTestRunner.HTMLTestRunner(stream=fp,title='Report_title',description='Report_description') #使用HTMLTestRunner配置参数,输出报告路径、报告标题、描述 runner.run(testunit) #自动进行测试 |
打开一个CMD窗口,启动Appium。 再打开一个CMD新窗口,执行命令 python my_android_test.py 执行测试脚本。
测试完成后,会在测试脚本的同目录下生成一个名为
myAppiumLog.html的Log文件(见脚本中相应的代码段)。同时,Appium运行窗口默认会打印整个测试过程的所有信息,如下所示:(整
个测试过程,Appium做了以下一些事:获取手机系统信息、启动UIAutomator、端口forward、启动手机上的Appium服务、执行控件
的操作如查找点击等等)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.2","deviceName":"4d00b6a5bee8a047","platformName":"Android","appActivity":"com.yy.mobile.ui.splash.SplashActivity","appPackage":"com.duowan.mobile"}}info: Client User-Agent string: Python-urllib/2.7info: [debug] Didn't get app but did get Android package, will attempt to launch it on the deviceinfo: [debug] Creating new appium session 1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35info: Starting android appiuminfo: [debug] Getting Java versioninfo: Java version is: 1.6.0_45info: [debug] Using fast reset? trueinfo: [debug] Preparing device for sessioninfo: [debug] Not checking whether app is present since we are assuming it's already on the deviceinfo: [debug] Checking whether adb is presentinfo: [debug] Using adb from C:\Android\sdk\platform-tools\adb.exeinfo: Retrieving deviceinfo: [debug] Trying to find a connected android deviceinfo: [debug] Getting connected devices...info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe devicesinfo: [debug] 2 device(s) connectedinfo: Found device 4d00b6a5bee8a047info: [debug] Setting device id to 4d00b6a5bee8a047info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 wait-for-deviceinfo: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "echo 'ready'"info: [debug] Starting logcat capturewarn: No app capability, can't parse package/activityinfo: [debug] Getting device API levelinfo: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "getprop ro.build.version.sdk"info: [debug] Device is at API Level 19info: Device API level is: 19info: [debug] Apk doesn't exist locallyinfo: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "rm -rf /data/local/tmp/strings.json"info: [debug] Not uninstalling app since server not started with --full-resetinfo: [debug] Skipping install since we launched with a package instead of an app pathinfo: [debug] Forwarding system:4724 to device:4724info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 forward tcp:4724 tcp:4724info: [debug] Pushing appium bootstrap to device...info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 push "C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/info: [debug] Pushing settings apk to device...info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 install "C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\build\settings_apk\settings_apk-debug.apk"info: [debug] Pushing unlock helper app to device...info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 install "C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"info: Starting Appinfo: [debug] Attempting to kill all 'uiautomator' processesinfo: [debug] Getting all processes with 'uiautomator'info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "ps 'uiautomator'"info: [debug] No matching processes foundinfo: [debug] Running bootstrapinfo: [debug] spawning: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrapinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunnerinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServerinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrapinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Readyinfo: [debug] [BOOTSTRAP] [debug] Loading json...info: [debug] Waking up device if it's not aliveinfo: [debug] Pushing command to appium work queue: ["wake",{}]info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.info: [debug] [BOOTSTRAP] [debug] Client connectedinfo: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: wakeinfo: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "dumpsys window"info: [debug] Screen already unlocked, continuing.info: [debug] Pushing command to appium work queue: ["getDataDir",{}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: getDataDirinfo: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp","status":0}info: [debug] dataDir set to: /data/local/tmpinfo: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchyinfo: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}info: [debug] Getting device API levelinfo: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "getprop ro.build.version.sdk"info: [debug] Device is at API Level 19info: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.duowan.mobile/com.yy.mobile.ui.splash.SplashActivity"info: [debug] Waiting for pkg "com.duowan.mobile" and activity "com.yy.mobile.ui.splash.SplashActivity" to be focusedinfo: [debug] Getting focused package and activityinfo: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "dumpsys window windows"info: [debug] Device launched! Ready for commandsinfo: [debug] Setting command timeout to the default of 60 secsinfo: [debug] Appium session started with sessionId 1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35info: <-- POST /wd/hub/session 303 8377.855 ms - 9info: --> GET /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35 {}info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"4.2","deviceName":"4d00b6a5bee8a047","platformName":"Android","appActivity":"com.yy.mobile.ui.splash.SplashActivity","appPackage":"com.duowan.mobile"},"deviceName":"4d00b6a5bee8a047","platformName":"Android","appActivity":"com.yy.mobile.ui.splash.SplashActivity","appPackage":"com.duowan.mobile"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- GET /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35 200 2.143 ms - 641 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"4.2","deviceName":"4d00b6a5bee8a047","platformName":"Android","appActivity":"com.yy.mobile.ui.splash.SplashActivity","appPackage":"com.duowan.mobile"},"deviceName":"4d00b6a5bee8a047","platformName":"Android","appActivity":"com.yy.mobile.ui.splash.SplashActivity","appPackage":"com.duowan.mobile"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: --> POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element {"using":"name","sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35","value":"神曲"}info: [debug] Waiting up to 0ms for conditioninfo: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"神曲","context":"","multiple":false}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"神曲","context":"","multiple":false}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: findinfo: [debug] [BOOTSTRAP] [debug] Finding 神曲 using NAME with the contextId: multiple: falseinfo: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=神曲, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=神曲, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"1"},"status":0}info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element 200 30359.695 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: --> POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element/1/click {"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35","id":"1"}info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: clickinfo: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element/1/click 200 3267.154 ms - 76 {"status":0,"value":true,"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: --> POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element {"using":"name","sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35","value":"站台"}info: [debug] Waiting up to 0ms for conditioninfo: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"站台","context":"","multiple":false}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"站台","context":"","multiple":false}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: findinfo: [debug] [BOOTSTRAP] [debug] Finding 站台 using NAME with the contextId: multiple: falseinfo: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=站台, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=站台, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}info: [debug] Condition unmet after 190ms. Timing out.info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element 500 196.363 ms - 195info: --> POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element {"using":"name","sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35","value":"月榜"}info: [debug] Waiting up to 0ms for conditioninfo: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"月榜","context":"","multiple":false}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"月榜","context":"","multiple":false}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: findinfo: [debug] [BOOTSTRAP] [debug] Finding 月榜 using NAME with the contextId: multiple: falseinfo: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=月榜, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=月榜, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"2"},"status":0}info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"2"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element 200 242.911 ms - 87 {"status":0,"value":{"ELEMENT":"2"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: --> POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element/2/click {"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35","id":"2"}info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"2"}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: clickinfo: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element/2/click 200 3377.934 ms - 76 {"status":0,"value":true,"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: --> POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element {"using":"name","sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35","value":"站台"}info: [debug] Waiting up to 0ms for conditioninfo: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"站台","context":"","multiple":false}]info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"站台","context":"","multiple":false}}info: [debug] [BOOTSTRAP] [debug] Got command of type ACTIONinfo: [debug] [BOOTSTRAP] [debug] Got command action: findinfo: [debug] [BOOTSTRAP] [debug] Finding 站台 using NAME with the contextId: multiple: falseinfo: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=站台, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=站台, INSTANCE=0]info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"3"},"status":0}info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"3"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- POST /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35/element 200 630.792 ms - 87 {"status":0,"value":{"ELEMENT":"3"},"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: --> DELETE /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35 {}info: Shutting down appium sessioninfo: [debug] Pressing the HOME buttoninfo: [debug] executing cmd: C:\Android\sdk\platform-tools\adb.exe -s 4d00b6a5bee8a047 shell "input keyevent 3"info: [debug] Stopping logcat captureinfo: [debug] Logcat terminated with code null, signal SIGTERMinfo: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWNinfo: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0}info: [debug] [BOOTSTRAP] [debug] Closed client connectioninfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunnerinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServerinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrapinfo: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.info: [debug] [UIAUTOMATOR STDOUT] Time: 41.607info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1info: [debug] Sent shutdown command, waiting for UiAutomator to stop...info: [debug] UiAutomator shut down normallyinfo: [debug] Cleaning up android objectsinfo: [debug] Cleaning up appium sessioninfo: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"}info: <-- DELETE /wd/hub/session/1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35 200 1333.091 ms - 76 {"status":0,"value":null,"sessionId":"1b0e4603-d4c8-44d7-868a-cd1c0d1f4b35"} |
有任何问题,欢迎大家指正。
至于网上说的还要安装Ant和Maven,其实不必,除非你的代码和库管理需要用到他们。
接下来我们将以手机YY为例,写一个简单的Python测试脚本,来看看Appium到底怎么使用。
Appium环境的安装与配置,Python测试脚本测试的更多相关文章
- 在 CentOS 7上安装并配置 Python 3.6 环境
前言 按照此方法安装保证以下报错什么的统统都没有! 基础环境 系统:centos7.4 软件:python3 Retrying (Retry(total=0, connect=None, read=N ...
- 【C#】VS2015开发环境的安装和配置(二)2016-08-03更新
分类:C#.VS2015.WPF.ASP.NET MVC.Android.iOS.Unity3D: 更新日期:2016-08-03 按下面介绍的步骤安装即可. 一.安装JDK和Android SDK ...
- Twitter Storm:单机环境的安装与配置
Twitter Storm:单机环境的安装与配置 好久没写博客了,这一段时间一直被导师push着做毕业设计.由于目前的方向偏向于图像识别检索,毕设打算做一个基于分布式计算平台的图像检索系统,查阅相关资 ...
- Appium环境的安装以及一路上的坑
Appium环境的安装以及一路上的坑 第一步环境的安装 l javaJDK的安装以及环境变量的配置这个我就不说了网上的教程全都是,搜一个安装一下吧 l AndroidSDK的安装也是如此我是直接安 ...
- Deepin环境下安装科学研究版Python和Pytorch--防网卡
Deepin环境下安装科学研究版Python和Pytorch--防网卡 由于本教程所引起的一切损失作者概不负责,本教程不使用pip和conda命令,因此下载好包后配合U盘可以给某个机器进行离线安装 · ...
- Dubbo入门到精通学习笔记(十四):ActiveMQ集群的安装、配置、高可用测试,ActiveMQ高可用+负载均衡集群的安装、配置、高可用测试
文章目录 ActiveMQ 高可用集群安装.配置.高可用测试( ZooKeeper + LevelDB) ActiveMQ高可用+负载均衡集群的安装.配置.高可用测试 准备 正式开始 ActiveMQ ...
- Ubuntu16.04下LAMP环境的安装与配置
Ubuntu16.04下LAMP环境的安装与配置 最近做个实验需要用到Ubuntu环境的靶场,所以这里介绍下Ubuntu环境下LAMP的安装与配置,话不多说,我们gkd! 1.Apache2的安装 首 ...
- 【C#】VS2015开发环境的安装和配置(一)2016-08-03更新
分类:C#.VS2015.WPF.ASP.NET MVC.Android.iOS.Unity3D: 更新日期:2016-08-03 一.简介 为了避免网上乱七八糟的过时介绍,避免误导初学者,这次把至2 ...
- Java环境的安装与配置
Java环境的安装与配置 环境:Java8,win10 推荐oracle官网oracle官网https://www.oracle.com/index.html下载JDK进行安装 选择自己需要的版本下载 ...
随机推荐
- Unity 播放音频文件
Unity 播放音频文件参考代码: public void Play(string strSoundName, float autoDestroyTime = 0f, bool bLoop = fal ...
- iOS Core Animation 动画 入门学习(一)基础
reference:https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreAnimation_guide ...
- 编程经验(C#)
本文记录我在编程里学到的一些小技巧,遇到了就记录一下. 1.如果通用接口中的回调没有参数,而调用时需要参数,这个时候可以用匿名函数多封装一层.例如: Private void Main() { Fun ...
- Android中数据存储(三)——SQLite数据库存储数据
当一个应用程序在Android中安装后,我们在使用应用的过程中会产生很多的数据,应用都有自己的数据,那么我们应该如何存储数据呢? 数据存储方式 Android 的数据存储有5种方式: 1. Share ...
- Mysql报错 Cannot load from mysql.proc
Auth: Jin Date: 20140716 mysql --default-character-set utf8 -h127.0.0.1 -uroot -p < account-20140 ...
- JS 中对变量类型的判断
总结:1. 一般简单的使用 typeof 或 instanceof 检测(这两种检测的不完全准确) 2. 完全准确的使用 原生js中的 Object.prototype.toStri ...
- Cocos2d-x 水果忍者划痕效果
网上找的一个关于水果忍者划痕的,效果还算凑合.其原理就是基于OpenGL绘制直线,因为版本号过老,此处笔者改动了一些方法,粘贴后可直接使用 适用于Cocos2d-x 2.2.1 .h文件里须要添�的代 ...
- 第一章 在linux下python读串口 存MYSQL数据库(703N)
import MySQLdb//定义引用数据库的驱动文件 import serial import time ser = serial.Serial('/dev/ttyATH0', 115200, t ...
- PTC点击网赚入门
第一次接触PTC大概是11月19号左右,那时候第一感觉是"这不就是传销吗,肯定是骗人的",但是由于利润十分之大,又忍不住仔细研究了一下,我还是十分还是十分谨慎的,再加上程序员的头脑 ...
- Guava的使用
package guava; import java.io.File; import java.io.IOException; import java.util.ArrayList; import j ...