appium + python
阿新 • • 發佈:2017-09-01
dumps 安裝 com current bsp tps 第三方 5.0 dev 1.安裝:node.js -> appium
node.js 先安裝node.js 。node.js官方網站:https://nodejs.org/
pip install Appium-Python-Client
2.demo #coding=utf-8 from appium import webdriver desired_caps = {} desired_caps[‘platformName‘] = ‘Android‘ desired_caps[‘platformVersion‘] = ‘5.0.1‘ desired_caps[‘deviceName‘] = ‘Demo‘ desired_caps[‘appPackage‘] = ‘com.android.calculator2‘ desired_caps[‘appActivity‘] = ‘.Calculator‘ driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘;, desired_caps) driver.find_element_by_name("1").click() driver.find_element_by_name("5").click() driver.find_element_by_name("9").click() driver.find_element_by_name("delete").click() driver.find_element_by_name("9").click() driver.find_element_by_name("5").click() driver.find_element_by_name("+").click() driver.find_element_by_name("6").click() driver.find_element_by_name("=").click() driver.quit()
3.android模擬器啟動不起來, Appium報錯(android環境變量沒有設置好) 運行Demo報錯也是android環境沒有設置好 ANDOID_HOME = C:\android %ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
4.android模擬器在AVD中不顯示(android環境變量沒有設置好) ANDOID_SDK_HOME = C:\android
5.獲取應用程序的包名
2.demo #coding=utf-8 from appium import webdriver desired_caps = {} desired_caps[‘platformName‘] = ‘Android‘ desired_caps[‘platformVersion‘] = ‘5.0.1‘ desired_caps[‘deviceName‘] = ‘Demo‘ desired_caps[‘appPackage‘] = ‘com.android.calculator2‘ desired_caps[‘appActivity‘] = ‘.Calculator‘ driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘;, desired_caps) driver.find_element_by_name("1").click() driver.find_element_by_name("5").click() driver.find_element_by_name("9").click() driver.find_element_by_name("delete").click() driver.find_element_by_name("9").click() driver.find_element_by_name("5").click() driver.find_element_by_name("+").click() driver.find_element_by_name("6").click() driver.find_element_by_name("=").click() driver.quit()
3.android模擬器啟動不起來, Appium報錯(android環境變量沒有設置好) 運行Demo報錯也是android環境沒有設置好 ANDOID_HOME = C:\android %ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
4.android模擬器在AVD中不顯示(android環境變量沒有設置好) ANDOID_SDK_HOME = C:\android
5.獲取應用程序的包名
- adb shell pm list package -f
- adb shell pm list package -3 -f #獲取第三方apk的包
- adb shell dumpsys window | findstr mCurrent #需要先打開應用程序
appium + python