第一個appium指令碼

來源:互聯網
上載者:User

標籤:inpu   target   pac   自動   完整   roi   ppi   rem   dev   

本篇簡單介紹一下用UtraEdit編寫自動化指令碼的方法。

 

在電腦任意一個目錄下,建立hello_appium.py檔案,把 Appium-Python-Client-0.25.tar.gz 和 selenium-3.8.0.tar.gz 解壓出來的 appium 檔案夾和 selenium 檔案夾放到和hello_appium.py同級的目錄下,然後就可以開始寫代碼了。

 1 from appium import webdriver 2 import time 3   4 desired_caps={} 5 desired_caps[‘platformName‘]=‘Android‘ 6 desired_caps[‘platformVersion‘]=‘4.4.2‘ 7 desired_caps[‘deviceName‘]=‘7N2SSE158P001892‘ 8 desired_caps[‘noReset‘]=‘noReset‘ 9 desired_caps[‘appPackage‘]=‘com.gomo.calculator‘10 desired_caps[‘appActivity‘]=‘.ui.activity.MainActivity‘11 driver=webdriver.Remote(‘http://localhost:4723/wd/hub‘, desired_caps)  #執行個體化driver12 self.driver.implicitly_wait(10)  #設定隱式等待時間13 14 driver.find_element_by_id("com.gomo.calculator:id/input_num_1").click()15 driver.find_element_by_id("com.gomo.calculator:id/input_num_5").click()16 driver.find_element_by_id("com.gomo.calculator:id/display_op_add").click()17 driver.find_element_by_id("com.gomo.calculator:id/input_num_6").click()18 driver.find_element_by_id("com.gomo.calculator:id/display_eq").click()19 driver.quit()

運行方法:

開啟cmd,輸入python hello_appium.py(最好輸入完整路徑),斷行符號

 

這就是appium最簡單的應用了。

第一個appium指令碼

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.