RobotFramework自動化測試架構-移動手機自動化測試Click Element關鍵字的使用

來源:互聯網
上載者:User

標籤:手機   ima   ges   start   cas   測試架構   robot   orm   ppp   

Click Element關鍵字用來類比點擊APP介面上的一個元素,該關鍵字接收一個參數[ locator ] ,這裡的locator指的是介面元素的定位方式。

樣本1:使用Click Element關鍵字來類比點擊一個button按鈕,這裡locator使用name的方式來定位需要點擊的元素,依舊採用上面之前使用過的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

Input Text       accessibility_id=輸入框 23                               

Input Text       id=com.example.calculator:id/factortwo       12                               

Click Element       name=計算

執行結果:

Starting test: RobotFrameworkTest1.TestSuite5.TestCase007

20170510 15:13:18.868 :  INFO : Typing text ‘23‘ into text field ‘accessibility_id=輸入框‘

20170510 15:13:18.868 :  INFO : msg:find accessibility_id=輸入框

20170510 15:13:25.718 :  INFO : msg:find id=com.example.calculator:id/factortwo

20170510 15:13:31.077 :  INFO : Clicking element ‘name=計算‘.

20170510 15:13:31.077 :  INFO : msg:find name=計算

20170510 15:13:31.704 :  INFO : elements: [<appium.webdriver.webelement.WebElement (session="3b92f067-4ddd-4dc5-90eb-c6915eb8e364", element="3")>]

Ending test:   RobotFrameworkTest1.TestSuite5.TestCase007

從執行結果可以看到,通過Click Element關鍵字也可以類比點擊一個button按鈕。

RobotFramework自動化測試架構-移動手機自動化測試Click Element關鍵字的使用

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.