在这里积累学习中的点点滴滴!
第一个APP测试脚本-登录
上一篇 /
下一篇 2018-03-09 15:09:51
/ 个人分类:RFS+Appiumlibrary
3b%FU MVt7jpu0做
测试,对于工具的初步了解第一个尝试的脚本肯定是登录了,先上脚本
51Testing软件测试网!lP3r+h^Z1、打开
app检查页面是否有【我的】文字信息
k2]
?gUx^@02、点击【我的】tab,检查页面有【未登录】文字信息
51Testing软件测试网0V2MY
@[|,RE3、点击【未登录】进入登录页面
_\*O`5sMAdox G4]04、输入账号【18700000000】
\@?8qg m$O l8q051Testing软件测试网{]A Yc*?\V6P登录
51Testing软件测试网4O-PH#a5BX open application http://localhost:4723/wd/hub platformName=Android platformVersion=4.2.2 deviceName=10.0.1.128:5555 app=${CURDIR}/xxxx.apk
}b}.s(zn0_m.Y0 sleep 3s
51Testing软件测试网UA#}e'jk
e!X Wait Until Page Contains Element xPath=//android.view.View[@content-desc='我的']
51Testing软件测试网f+t+q5}+B
p5_9W.O click element xPath=//android.view.View[@content-desc='我的']
U H$S+i
Q)u0 Wait Until Page Contains Element xPath=//android.view.View[@content-desc='未登录']
51Testing软件测试网!^%N[R-i;{ click element xPath=//android.view.View[@content-desc='未登录']
+dV|8n2[6@1RW ??0 input text xPath=//android.widget.EditText[@index='0'] 18700000000
51Testing软件测试网*k4}Jcpv;K!I6T7D$E.c0X^Sg0注意事项:
51Testing软件测试网6[nq
\'[
H#P;a$m1、open application 关键字用于打开app,如果未安装则根据配置路径安装app并打开。
51Testing软件测试网"r iwOm7A2、使用UI Automator Viewer工具可以查看APP页面中的元素便于定位,"C:\Program Files (x86)\Android\android-sdk\tools\uiautomatorviewer.bat"。
.w7Vq ~:P'c03、APP中常用的content-desc属性,可以在脚本中当作name,id属性直接使用。
51Testing软件测试网!~n'N@hq&q!M4、元素属性识别大小写,当时就因为定位文本框时index首字母大写了导致花费了很多时间排查问题。
Ha7R@ T(P8^051Testing软件测试网kP,e7DB(q#]%x9JR6n7Q'lGXL$R051Testing软件测试网!Sh^4c1IV
收藏
举报
TAG: