Appium appium 用例 1.6.3 执行不稳定?

cheng · 2017年10月24日 · 最后由 小小的蜗牛 回复于 2020年02月19日 · 1402 次阅读

先说下我的环境:

win7,python27,appium1.6.3,jdk_1.8.0_91

下面是我 appium 配置的参数:

appPackage: com.xx.xx
appActivity: .ui.activity.BeginActivity
app: C:\Users\Administrator\Desktop\xxx.apk
deviceName: '192.168.17.101:5555'
platformName: Android
platformVersion: '5.1'
unicodeKeyboard: True
resetKeyboard: True
noReset: False
automationName: uiautomator2

下面是我的 unittest 脚本

# coding: utf-8
from Runner import runnercase
from page.smartlock import LoginPage
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time


class Lock_login(runnercase.TestInterfaceCase):

    @classmethod
    def setUpClass(cls):
        print ‘开始执行登录用例’

    def setUp(self):
        super(Lock_login, self).setUp()
        print '用例初始化'

    def tearDown(self):
        print '用例执行完成'

    @classmethod
    def tearDownClass(cls):
        print('登录用例执行完毕')

    def _find_toast(self,message,timeout,poll_frequency,driver):
        message = '//*[@text=\'{}\']'.format(message)
        element = WebDriverWait(driver,timeout,poll_frequency).until(EC.presence_of_element_located((By.XPATH,message)))
        return element

    def test_only_mail_login(self):

        LoginPage(self.driver).click_login()
        LoginPage(self.driver).find_entermail().set_value('786868')
        LoginPage(self.driver).click_confirm()
        try:
            el=self._find_toast('Incorrect Email',15,0.2,self.driver)
            self.assertEqual('Incorrect Email',el.text)
        except:
            print u"没有找到'邮箱错误'的提示"

    def test_input_nothing_login(self):
        LoginPage(self.driver).click_login()
        LoginPage(self.driver).click_confirm()
        try:
            el = self._find_toast('Incorrect Email', 15, 0.2, self.driver)
            self.assertEqual('Incorrect Email', el.text)
        except:
            print u"没有找到'邮箱错误'的提示"

    def test_input_wrong_pwd_login(self):
        LoginPage(self.driver).click_login()
        LoginPage(self.driver).find_entermail().set_value('**@qq.com')
        LoginPage(self.driver).find_enterpwd().set_value('12345678')
        LoginPage(self.driver).click_confirm()
        try:
            el = self._find_toast('Wrong Password', 15, 0.2, self.driver)
            self.assertEqual('Wrong Password', el.text)
        except:
            print u"没有找到'密码错误'的提示"

    def test_input_all_right_login(self):
        LoginPage(self.driver).click_login()
        LoginPage(self.driver).find_entermail().set_value('**@qq.com')
        LoginPage(self.driver).find_enterpwd().set_value('qqqqqqqq')
        LoginPage(self.driver).click_confirm()
        time.sleep(2)

当跑起来后,四个用例,老是有 1 个或 2 个用例失败,错误是

[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: read ECONNRESET
    at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:152:13)
    at tryCatch (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37)

appium 日志如下:

[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","start","-W","-n","com.pg.smartlocker/.ui.activity.BeginActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[Appium] New AndroidUiautomator2Driver session created successfully, session 0bca59f5-787c-46fc-8a29-c805e687df68 added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1508849421136 (20:50:21 GMT+0800 (中国标准时间))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {"unicodeKeyboard":true,"deviceName":"192.168.17.101:5555","automationName":"uiautomator2","noReset":false,"port":4809,"resetKeyboard":true,"platformVersion":"5.1","appPackage":"com.pg.smartlocker","app":"C:\\Users\\Administrator\\Desktop\\smartlock-debug-1.0.3.apk","platformName":"Android","appActivity":".ui.activity.BeginActivity","udid":"192.168.17.101:5555"}
[HTTP] <-- POST /wd/hub/session 200 48793 ms - 436 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"id","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"com.pg.smartlocker:id/tv_user_splash"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.pg.smartlocker:id/tv_user_splash","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"id","selector":"com.pg.smartlocker:id/tv_user_splash","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"cbd8d7fa-29f3-45b5-b6f8-08e0dd530596"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"cbd8d7fa-29f3-45b5-b6f8-08e0dd530596"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 648 ms - 122 
[HTTP] --> GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/cbd8d7fa-29f3-45b5-b6f8-08e0dd530596/displayed {}
[debug] [MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["cbd8d7fa-29f3-45b5-b6f8-08e0dd530596","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [JSONWP Proxy] Proxying [GET /element/cbd8d7fa-29f3-45b5-b6f8-08e0dd530596/attribute/displayed] to [GET http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element/cbd8d7fa-29f3-45b5-b6f8-08e0dd530596/attribute/displayed] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"ae83a5cf-2d0b-412f-a031-b2bfccbd707b\",\"status\":0,\"value\":\"true\"}"
[debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/cbd8d7fa-29f3-45b5-b6f8-08e0dd530596/displayed 200 62 ms - 76 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"id","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"com.pg.smartlocker:id/tv_user_splash"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.pg.smartlocker:id/tv_user_splash","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"id","selector":"com.pg.smartlocker:id/tv_user_splash","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"9f3c3fe9-5561-4a62-bf31-ec069232b331"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"9f3c3fe9-5561-4a62-bf31-ec069232b331"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 84 ms - 122 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"id","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"com.pg.smartlocker:id/tv_user_splash"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.pg.smartlocker:id/tv_user_splash","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"id","selector":"com.pg.smartlocker:id/tv_user_splash","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"0ae128c7-9ed6-40f8-9c06-66c3d48bb2da"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"0ae128c7-9ed6-40f8-9c06-66c3d48bb2da"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 100 ms - 122 
[HTTP] --> GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/0ae128c7-9ed6-40f8-9c06-66c3d48bb2da/displayed {}
[debug] [MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["0ae128c7-9ed6-40f8-9c06-66c3d48bb2da","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [JSONWP Proxy] Proxying [GET /element/0ae128c7-9ed6-40f8-9c06-66c3d48bb2da/attribute/displayed] to [GET http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element/0ae128c7-9ed6-40f8-9c06-66c3d48bb2da/attribute/displayed] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"ae83a5cf-2d0b-412f-a031-b2bfccbd707b\",\"status\":0,\"value\":\"true\"}"
[debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/0ae128c7-9ed6-40f8-9c06-66c3d48bb2da/displayed 200 63 ms - 76 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"id","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"com.pg.smartlocker:id/tv_user_splash"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.pg.smartlocker:id/tv_user_splash","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"id","selector":"com.pg.smartlocker:id/tv_user_splash","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"d46eac69-0010-482d-b57a-2b7a0ad3cc1f"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"d46eac69-0010-482d-b57a-2b7a0ad3cc1f"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 101 ms - 122 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/d46eac69-0010-482d-b57a-2b7a0ad3cc1f/click {"sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","id":"d46eac69-0010-482d-b57a-2b7a0ad3cc1f"}
[debug] [MJSONWP] Calling AppiumDriver.click() with args: ["d46eac69-0010-482d-b57a-2b7a0ad3cc1f","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [JSONWP Proxy] Proxying [POST /element/d46eac69-0010-482d-b57a-2b7a0ad3cc1f/click] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element/d46eac69-0010-482d-b57a-2b7a0ad3cc1f/click] with body: {"element":"d46eac69-0010-482d-b57a-2b7a0ad3cc1f"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":true}
[debug] [MJSONWP] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/d46eac69-0010-482d-b57a-2b7a0ad3cc1f/click 200 113 ms - 76 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[contains(@text,'OK')]"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'OK')]","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'OK')]","context":"","multiple":false}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 500 351 ms - 164 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[contains(@text,'OK')]"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'OK')]","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'OK')]","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"fb3cb44f-9162-49f7-a708-ab48d181263d"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"fb3cb44f-9162-49f7-a708-ab48d181263d"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 3353 ms - 122 
[HTTP] --> GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/fb3cb44f-9162-49f7-a708-ab48d181263d/displayed {}
[debug] [MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["fb3cb44f-9162-49f7-a708-ab48d181263d","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [JSONWP Proxy] Proxying [GET /element/fb3cb44f-9162-49f7-a708-ab48d181263d/attribute/displayed] to [GET http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element/fb3cb44f-9162-49f7-a708-ab48d181263d/attribute/displayed] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"ae83a5cf-2d0b-412f-a031-b2bfccbd707b\",\"status\":0,\"value\":\"true\"}"
[debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/fb3cb44f-9162-49f7-a708-ab48d181263d/displayed 200 55 ms - 76 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[contains(@text,'OK')]"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'OK')]","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'OK')]","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"c23e3581-e970-4d5e-abd2-a4d80abc09f1"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"c23e3581-e970-4d5e-abd2-a4d80abc09f1"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 435 ms - 122 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[contains(@text,'OK')]"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'OK')]","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'OK')]","context":"","multiple":false}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 500 640 ms - 164 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[contains(@text,'OK')]"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'OK')]","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'OK')]","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"e61d7f8f-4ccc-45d5-9396-6883c350f196"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"e61d7f8f-4ccc-45d5-9396-6883c350f196"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 416 ms - 122 
[HTTP] --> GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/e61d7f8f-4ccc-45d5-9396-6883c350f196/displayed {}
[debug] [MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["e61d7f8f-4ccc-45d5-9396-6883c350f196","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [JSONWP Proxy] Proxying [GET /element/e61d7f8f-4ccc-45d5-9396-6883c350f196/attribute/displayed] to [GET http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element/e61d7f8f-4ccc-45d5-9396-6883c350f196/attribute/displayed] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"ae83a5cf-2d0b-412f-a031-b2bfccbd707b\",\"status\":0,\"value\":\"true\"}"
[debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/e61d7f8f-4ccc-45d5-9396-6883c350f196/displayed 200 68 ms - 76 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[contains(@text,'OK')]"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'OK')]","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'OK')]","context":"","multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":{"ELEMENT":"968147d3-1734-4f46-a9aa-1c8279a8efc8"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"968147d3-1734-4f46-a9aa-1c8279a8efc8"}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 200 143 ms - 122 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/968147d3-1734-4f46-a9aa-1c8279a8efc8/click {"sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","id":"968147d3-1734-4f46-a9aa-1c8279a8efc8"}
[debug] [MJSONWP] Calling AppiumDriver.click() with args: ["968147d3-1734-4f46-a9aa-1c8279a8efc8","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [JSONWP Proxy] Proxying [POST /element/968147d3-1734-4f46-a9aa-1c8279a8efc8/click] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element/968147d3-1734-4f46-a9aa-1c8279a8efc8/click] with body: {"element":"968147d3-1734-4f46-a9aa-1c8279a8efc8"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ae83a5cf-2d0b-412f-a031-b2bfccbd707b","status":0,"value":true}
[debug] [MJSONWP] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element/968147d3-1734-4f46-a9aa-1c8279a8efc8/click 200 140 ms - 76 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[@text='Incorrect Email']"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[@text='Incorrect Email']","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[@text='Incorrect Email']","context":"","multiple":false}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 500 809 ms - 164 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[@text='Incorrect Email']"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[@text='Incorrect Email']","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[@text='Incorrect Email']","context":"","multiple":false}
[BaseDriver] Shutting down because we waited 60 seconds for a command
[debug] [UiAutomator2] Deleting UiAutomator2 session
[Appium] Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[Appium] Removing session 0b184eb4-98f6-426c-b17a-efcdafc965c1 from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://localhost:8246/wd/hub/session/be8fd44a-55af-4858-90e0-71b1740bf6fe] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"be8fd44a-55af-4858-90e0-71b1740bf6fe\",\"status\":0,\"value\":\"Session deleted\"}"
[debug] [UiAutomator2] Resetting IME to 'io.appium.android.ime/.UnicodeIME'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","ime","set","io.appium.android.ime/.UnicodeIME"]
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 500 825 ms - 164 
[HTTP] --> POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element {"using":"xpath","sessionId":"0bca59f5-787c-46fc-8a29-c805e687df68","value":"//*[@text='Incorrect Email']"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[@text='Incorrect Email']","0bca59f5-787c-46fc-8a29-c805e687df68"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8247/wd/hub/session/ae83a5cf-2d0b-412f-a031-b2bfccbd707b/element] with body: {"strategy":"xpath","selector":"//*[@text='Incorrect Email']","context":"","multiple":false}
[HTTP] <-- POST /wd/hub/session/0bca59f5-787c-46fc-8a29-c805e687df68/element 500 107 ms - 251 
[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: read ECONNRESET
    at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:152:13)
    at tryCatch (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37)

以上是test_input_nothing_login这个用例的时候,执行到找Incorrect mail这个toast的时候,突然就报错了,搞不懂为什么
然后接着又执行第三个用例test_input_wrong_pwd_login,日志如下

.[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"unicodeKeyboard":true,"deviceName":"192.168.17.101:5555","automationName":"uiautomator2","noReset":false,"port":4809,"resetKeyboard":true,"platformVersion":"5.1","appPackage":"com.pg.smartlocker","app":"C:\\Users\\Administrator\\Desktop\\smartlock-debug-1.0.3.apk","platformName":"Android","appActivity":".ui.activity.BeginActivity"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"unicodeKeyboard":true,"deviceName":"192.168.17.101:5555","automationName":"uiautomator2","noReset":false,"port":4809,"resetKeyboard":true,"platformVersion":"5.1","appPackage":"com.pg.smartlocker","app":"C:\\Users\\Administrator\\Desktop\\smartlock-debug-1.0.3.apk","platformName":"Android","appActivity":".ui.activity.BeginActivity"},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1508849431186 (20:50:31 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidUiautomator2Driver session
[Appium] Capabilities:
[Appium]   unicodeKeyboard: true
[Appium]   deviceName: '192.168.17.101:5555'
[Appium]   automationName: 'uiautomator2'
[Appium]   noReset: false
[Appium]   port: 4809
[Appium]   resetKeyboard: true
[Appium]   platformVersion: '5.1'
[Appium]   appPackage: 'com.pg.smartlocker'
[Appium]   app: 'C:\\Users\\Administrator\\Desktop\\smartlock-debug-1.0.3.apk'
[Appium]   platformName: 'Android'
[Appium]   appActivity: '.ui.activity.BeginActivity'
[Appium]   udid: '192.168.17.101:5555'
[BaseDriver] The following capabilities were provided, but are not recognized by appium: port.
[BaseDriver] Session created with session id: 75fb2f57-3ace-4979-a0f0-1f823ec653ac
[BaseDriver] Using local app 'C:\Users\Administrator\Desktop\smartlock-debug-1.0.3.apk'
[debug] [UiAutomator2] Checking whether app is actually present
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_91
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Using device: 192.168.17.101:5555
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe
[debug] [ADB] Setting device id to 192.168.17.101:5555
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","getprop","ro.build.version.release"]
[debug] [ADB] Current device property 'ro.build.version.release': 5.1
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","wm","size"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","force-stop","com.pg.smartlocker"]
[debug] [UiAutomator2] [UIAutomator2] 
[debug] [UiAutomator2] [UIAutomator2] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:.
[debug] [UiAutomator2] [UIAutomator2] 
[debug] [UiAutomator2] [UIAutomator2] Time: 18.237
[debug] [UiAutomator2] [UIAutomator2] 
[debug] [UiAutomator2] [UIAutomator2] OK (1 test)
[debug] [UiAutomator2] [UIAutomator2] 
[debug] [UiAutomator2] [UIAutomator2] 
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","getprop","ro.product.model"]
[debug] [ADB] Current device property 'ro.product.model': Google Nexus 4 - 5.1.0 - API 22 - 768x1280
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","getprop","ro.product.manufacturer"]
[debug] [ADB] Current device property 'ro.product.manufacturer': unknown
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","force-stop","io.appium.uiautomator2.server"]
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8246 
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","forward","--remove","tcp:8246"]
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\19.1.0\aapt.exe
[debug] [ADB] Getting install status for io.appium.uiautomator2.server
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","list","packages","io.appium.uiautomator2.server"]
[debug] [ADB] App is installed
[debug] [ADB] Getting install status for io.appium.uiautomator2.server.test
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","list","packages","io.appium.uiautomator2.server.test"]
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for io.appium.uiautomator2.server
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","dumpsys","package","io.appium.uiautomator2.server"]
[debug] [UiAutomator2] Waiting up to 20000ms for instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' to be available
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","list","instrumentation"]
[debug] [UiAutomator2] Instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' available
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","wait-for-device"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","echo","ping"]
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Enabling Unicode keyboard support
[debug] [AndroidDriver] Pushing unicode ime to device...
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","install","C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\_appium-android-ime@2.0.0@appium-android-ime\\bin\\UnicodeIME-debug.apk"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","settings","get","secure","default_input_method"]
[debug] [AndroidDriver] Unsetting previous IME io.appium.android.ime/.UnicodeIME
[debug] [AndroidDriver] Setting IME to 'io.appium.android.ime/.UnicodeIME'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","ime","enable","io.appium.android.ime/.UnicodeIME"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","ime","set","io.appium.android.ime/.UnicodeIME"]
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Uninstalling and re-installing 'io.appium.settings'
[debug] [ADB] Uninstalling io.appium.settings
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","list","packages","io.appium.settings"]
[debug] [ADB] App is installed
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","force-stop","io.appium.settings"]
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","uninstall","io.appium.settings"]
[debug] [ADB] ADB command output: Success
[ADB] io.appium.settings was successfully uninstalled
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","list","packages","io.appium.settings"]
[debug] [ADB] App is not installed
[debug] [ADB] App 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_io.appium.settings@2.3.0@io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk' not installed. Installing
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","install","C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\_io.appium.settings@2.3.0@io.appium.settings\\app\\build\\outputs\\apk\\settings_apk-debug.apk"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","getprop","ro.build.version.sdk"]
[debug] [ADB] Current device property 'ro.build.version.sdk': 22
[debug] [ADB] Device API level: 22
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","dumpsys","package","io.appium.settings"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","ps"]
[debug] [ADB] Device API level: 22
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","start","-W","-n","io.appium.settings/.Settings","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[debug] [ADB] Device API level: 22
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","settings","put","secure","mock_location","1"]
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","install","C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\_appium-unlock@0.1.1@appium-unlock\\bin\\unlock_apk-debug.apk"]
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8248
[debug] [ADB] Forwarding system: 8248 to device: 6790
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","forward","tcp:8248","tcp:6790"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [AndroidDriver] Extracting strings from apk C:\Users\Administrator\Desktop\smartlock-debug-1.0.3.apk null C:\Users\Administrator\AppData\Local\Temp\com.pg.smartlocker
[debug] [ADB] Extracting strings for language: default
[debug] [ADB] Device API level: 22
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","getprop","persist.sys.language"]
[debug] [ADB] Current device property 'persist.sys.language': en
[debug] [ADB] No strings.xml for language 'en', getting default strings.xml
[debug] [ADB] Reading strings from converted strings.json
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","push","C:\\Users\\Administrator\\AppData\\Local\\Temp\\com.pg.smartlocker\\strings.json","/data/local/tmp"]
[debug] [ADB] Checking app cert for C:\Users\Administrator\Desktop\smartlock-debug-1.0.3.apk.
[debug] [ADB] App already signed.
[debug] [ADB] Zip-aligning 'C:\Users\Administrator\Desktop\smartlock-debug-1.0.3.apk'
[ADB] Checking whether zipalign is present
[ADB] Using zipalign.exe from C:\android-sdk_r24.4.1-windows\android-sdk-windows\tools\zipalign.exe
[debug] [ADB] Zip-aligning apk.
[AndroidDriver] Remote apk path is /data/local/tmp/97bbc1757d8a3d1625264254f4e87c1d.apk
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","ls","/data/local/tmp/97bbc1757d8a3d1625264254f4e87c1d.apk"]
[debug] [AndroidDriver] Checking if app is installed
[debug] [ADB] Getting install status for com.pg.smartlocker
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","list","packages","com.pg.smartlocker"]
[debug] [ADB] App is installed
[AndroidDriver] Apk is already on remote and installed, resetting
[debug] [AndroidDriver] Running fast reset (stop and clear)
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","force-stop","com.pg.smartlocker"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","pm","clear","com.pg.smartlocker"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","force-stop","io.appium.uiautomator2.server"]
[UiAutomator2] Starting uiautomator2 server v0.1.8
[UiAutomator2] Running command: 'adb -s 192.168.17.101:5555 shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner'
[UiAutomator2] Waiting up to 20000ms for UiAutomator2 to be online...
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8248/wd/hub/status] with no body
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id
[debug] [UiAutomator2] Resetting IME to 'io.appium.android.ime/.UnicodeIME'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","ime","set","io.appium.android.ime/.UnicodeIME"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","shell","am","force-stop","com.pg.smartlocker"]
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8248 
[debug] [ADB] Running 'C:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.17.101:5555","forward","--remove","tcp:8248"]
[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8248
    at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:152:13)
    at tryCatch (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37)

上面日志可以看到uiautomator2 和uiautomator2 sever session都被删了,接着报错,但奇怪的是,报错后,继续跑第四个用例,又执行成功了,实在搞不懂

备:百度和 google 都查了好久,还是没有找到解决方案,好难过。。。。不知道你们有没有碰到过

共收到 4 条回复 时间 点赞

你这个 toast 能抓到吗?我的环境跟你一样,但是获取 toast 不成功。我也不知道是什么原因,能告诉我你大概还装过哪些东西吗?

老哥,我也遇到这个问题了,appium 官方说建议我们跟新 adb 或者不用 uiautomator2 作为测试套件,但是不用 uiautomator2 的话 7.0 没法玩了,所以还有别的解决办法没?

test_lj 回复

toast 能抓到的,desired_caps 中要指定 uiautomator2 才行

我也遇到这个问题了,请问有人解决了吗?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册