作者的原创文章,转载须注明出处。原创文章归作者所有,欢迎转载,但是保留版权。对于转载了博主的原创文章,不标注出处的,作者将依法追究版权,请尊重作者的成果。

RobotFramework自动化测试框架-移动手机自动化测试Get Element Location关键字的使用

Get Element Location关键字用来获取一个Element的Location位置,该关键字接收一个参数[ locator ]

示例1:使用Get Element Location来获取一个EditText输入框的Location位置,在这里依旧采用上面使用的APP界面来做操作示例

Open Application   http://localhost:4723/wd/hub  platformName=Android platformVersion=22       deviceName=98YFBP522VSU       app=C:/Users/yongqing/Desktop/app-debug.apk   appPackage=com.example.calculator    appActivity=MainActivity

${Location}    Get Element Location    id=com.example.calculator:id/factorone

log   ${Location}                                             

执行结果:

Starting test: RobotFrameworkTest1.TestSuite5.TestCase010

20170510 15:56:05.348 :  INFO : msg:find id=com.example.calculator:id/factorone

20170510 15:56:06.929 :  INFO : Element 'id=com.example.calculator:id/factorone' location: {'y': 50, 'x': 0}

20170510 15:56:06.930 :  INFO : ${Location} = {'y': 50, 'x': 0}

20170510 15:56:06.932 :  INFO : {'y': 50, 'x': 0}

Ending test:   RobotFrameworkTest1.TestSuite5.TestCase010

从执行结果可以看到,获取到的Location结果为{'y': 50, 'x': 0}

【原文归作者所有,欢迎转载,但是保留版权

Robot Framework自动化测试框架核心指南电子版试读

posted @ 2017-11-08 00:02  张永清  阅读(2117)  评论(0编辑  收藏  举报
作者的原创文章,转载须注明出处。原创文章归作者所有,欢迎转载,但是保留版权。对于转载了博主的原创文章,不标注出处的,作者将依法追究版权,请尊重作者的成果。