Mac OS 10.13.2
Appium 1.2.7
Android 5.1.1 (MIUI 8.6.9.15)
Python3

(整个脚本执行 50 次大概有一半遇到这种问题,当然每次出错的地方不都在这里)

sleep(10)
for i in range(1,6):
    if dr.find_elements_by_android_uiautomator('new UiSelector().text("INSTALL")'):
        print ("*** INSTALL has been found. ")
        break
    else:
        swipeUp(dr)
        sleep(5)

报错信息如下:
Traceback (most recent call last):
File "../COMMON/Appium_GooglePlay_Android.py", line 133, in SearchApp
if dr.find_elements_by_android_uiautomator('new UiSelector().text("INSTALL")'):
File "/usr/local/lib/python3.6/site-packages/appium/webdriver/webdriver.py", line 167, in find_elements_by_android_uiautomator
return self.find_elements(by=By.ANDROID_UIAUTOMATOR, value=uia_string)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 886, in find_elements
'value': value})['value'] or []
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
File "/usr/local/lib/python3.6/site-packages/appium/webdriver/errorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: read ECONNRESET


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