標籤:pac bsp access UI 位置 自動化測試 分享 介面 cto
Click A Point關鍵字用來類比點擊APP介面上的一個點,該關鍵字接收兩個三個參數[ x=0 | y=0 | duration=100 ],x和y代表的是點的座標位置,duration代表的是點擊持續的時間長度。這三個參數如果沒有傳入的話,會分表預設x=0,y=0,duration=100。
樣本1:這裡依舊採用上面使用的APP介面來做操作樣本,使用Click A Point關鍵字來類比點擊一個button按鈕,輸入button按鈕所在的座標。
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
Input Text accessibility_id=輸入框 23
Input Text id=com.example.calculator:id/factortwo 12
Click A Point 370 339 1000
執行結果:
Starting test: RobotFrameworkTest1.TestSuite5.TestCase008
20170510 15:32:25.243 : INFO : Typing text ‘23‘ into text field ‘accessibility_id=輸入框‘
20170510 15:32:25.243 : INFO : msg:find accessibility_id=輸入框
20170510 15:32:32.005 : INFO : Typing text ‘12‘ into text field ‘id=com.example.calculator:id/factortwo‘
20170510 15:32:32.006 : INFO : msg:find id=com.example.calculator:id/factortwo
20170510 15:32:37.282 : INFO : Clicking on a point (370,339).
Ending test: RobotFrameworkTest1.TestSuite5.TestCase008
從執行結果可以看到,還可以通過Click A Point關鍵字類比點擊一個button按鈕。
RobotFramework自動化測試架構-移動手機自動化測試Click A Point關鍵字的使用