每次全部执行跑,很多用例都会报这个错误,KeyError: 'status',但是单独跑是通过的,
我发现在用例执行过程中,有的用例没执行完成,APP 就退出了,不知道是不是这个原因导致的。
但是不知道为什么会退出。求大佬赐教,谢谢了。

def setUp(self):
    self.desired_caps = {
        'platformName' : 'Android',
        'platformVersion' : '7.0',          #安卓版本号
        'deviceName' :',       #设备名称
        'appPackage' :'',  # 包名
        'appActivity' : '',
        'noReset' : True,  # 启动后结束后不清空应用数据
        'automationName': 'Uiautomator2',
        'unicodeKeyboard': False,      # 调用appium自带键盘
        "resetKeyboard": False,         # 重置键盘
        # "autoLaunch":False
    }
    self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps)
    self.driver.implicitly_wait(20)

错误信息:

ft1.2: Traceback (most recent call last):
  File "", line 26, in setUp
    self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps)
  File "C:\Users\luoliang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\appium\webdriver\webdriver.py", line 36, in __init__
    super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
  File "C:\Users\luoliang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Users\luoliang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\luoliang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:\Users\luoliang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 130, in check_response
    status = value["status"]
KeyError: 'status'


↙↙↙阅读原文可查看相关链接,并与作者交流