报错截图

因为appium服务用的是1.4.x版本,使用的是 uiatumator1.0在android7.0得不到支持,所以获取PIDS得到空。
解决办法
找到Appium安装目录下node_modules\appium\node_modules\appium-adb\lib\adb.js文件

修改,在var outlines = stdout.split("\n")这行代码下方增加outlines.shift();注意有分号,然后重启appium即可。

然后重现运行我们的代码即可
fromappiumimportwebdriverimporttime# server 启动参数desired_caps = {}# 设备信息desired_caps['platformName'] ='Android'desired_caps['platformVersion'] ='5.1'desired_caps['deviceName'] ='127.0.0.1:5555'# app信息desired_caps['appPackage'] ='com.android.settings'desired_caps['appActivity'] ='.Settings'driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)print(driver)time.sleep(5)driver.quit()
网友评论