我在连接设备(MI3)后,用 appium --no-reset 命令启动 appium,然后运行我的 python 测试脚本 设置如下:
def setUp(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.1'
desired_caps['deviceName'] = '00203a3f' #米3
#desired_caps['deviceName'] = '9ec94fd2'
#desired_caps['deviceName'] = 'TA9330EPP6' #摩托罗拉
#desired_caps['deviceName'] = 'Android Emulator'
desired_caps['app'] = PATH(
'E:\mexxx_apk\xxxxx_3.8.0.apk'
)
desired_caps['appPackage'] = 'com.xxx'
desired_caps['appActivity'] = 'com.xxxxx'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
运行后首先是频繁的连接设备并弹出 USB 设置选项(就是那个包含 “打开设备以查看文件文件夹 balabala” 的那个弹出框),另外测试根本不能成功,老是报类似
WebDriverException: Message: u'A new session could not be created. (Original error: Command failed: - waiting for device -\r\n)'
或者
WebDriverException: Message: u'A new session could not be created. (Original error: Command failed: - protocol failure -\r\n)'
这样的错误
求大神指点啊!!