??????cmd?????????? appium
???????????
????????????????cmd???? adb devices ???豸?????б??
??????дpython??????
????1?????python-client-appium??:
????pip install Appium-Python-Client
????2?????uiautomatorviewer
????cmd???????? uiautomatorviewer ???UI??
????UIAutomatorviewer??Android sdk??????????tools???????????UI????????????????????????????????????????????element??package???????id??
????3????дpython???
fromappiumimportwebdriver
importos
# Returns abs path relative to this file and not cwd
PATH = lambdap: os.path.abspath(
os.path.join(os.path.dirname(__file__)?? p)
)
desired_caps = {}
desired_caps['platformName'] ='Android'
desired_caps['platformVersion'] ='4.4.4'
desired_caps['deviceName'] ='Hisense I635T'
desired_caps['appPackage'] ='io.appium.android.apis'
desired_caps['appActivity'] ='io.appium.android.apis.ApiDemos'
desired_caps['app'] = PATH(
'./apps/ApiDemos.apk'
)
driver = webdriver.Remote('http://localhost:4723/wd/hub'?? desired_caps)
arr = driver.find_element_by_accessibility_id("App")
assertarrisnotNone
driver.quit()
?????????????
???????? 1?? python???б????urllib2.URLError:
????appium????????????????????????py??
????????2??δ???
????Telnet command got response: aavavdavd avd navd naavd namavd name
????????3??
????Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
????appactivityд???????????????????????
????????4??Original error: Permission to start activity??
???????????????????????????AndroidManifest.xml????н?Activity???ó?????????Android:exported=”true”??
??????????У?????
?????????????
?????????????????????????????в???????????£?
????????Android?????????? AVD Manager.exe ???????????????????start??
????????HAXMδ???????SDK Manager?а???£???????????δ???????android sdk???μ?extrasintelHardware_Accelerated_Execution_Manager?????intelhaxm-android.exe???а???????????????????OK???
????Device Name??д??????????????????????????appium???????Inspector??Reflesh???App???????в????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????app???????ж?λ??
???????
????????????????????????????????????