相关信息:

npm 版本: 3.9.0,
appium server 版本: 1.14.0
手机: 华为 nova7 Pro 5G
app 架构: 原生外壳 + H5

appium 参数配置信息:

desired_caps = {
    'platformName': self.platform_name,
    'platformVerion': self.device_info['platform_version'],
    'udid': self.device_info["udid"],
    "deviceName": self.device_info["udid"],
    'noReset': True,
    'appPackage': self.app_package,
    'appActivity': self.app_activity,
    "unicodeKeyboard": True,
    "reset_keyboard": True,
    'automationName': UiAutomator2,
    'chromedriverExecutable': self.chrome_driver_path,
    'chromeOptions': {'androidProcess': self.app_package},
    "systemPort": int(self.device_info["systemPort"]),
    "autoWebview": True,
    'adbExecTimeout': 200000
}

执行 pytest

def main(device_info):
    pytest.main(
        ["--device_info={}".format(device_info),
         "cases/xxxxx.py",
         "--alluredir", "./result", "-vs"])
     os.system('allure generate result/ -o report/ --clean')


if __name__ == "__main__":
    for num in range(20):
        with Pool(len(device_infos)) as pool:
            pool.map(main, device_infos)
            pool.close()
            pool.join()

APPIUM 相关日志:

[debug] [35m[ADB][39m Running 'E:\android-sdk\platform-tools\adb.exe -P 5037 -s UJKDU20611008827 shell cat /proc/net/unix'
[35m[HTTP][39m [37m<-- GET /wd/hub/session/b511eb04-9972-4a2d-b4b3-7600841a1cb8/contexts [39m[32m-[39m [90m- ms - -[39m
[35m[HTTP][39m [90m[39m
[35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/b511eb04-9972-4a2d-b4b3-7600841a1cb8/contexts[39m
[35m[HTTP][39m [90m{}[39m
[debug] [35m[W3C (b511eb04)][39m Calling AppiumDriver.getContexts() with args: ["b511eb04-9972-4a2d-b4b3-7600841a1cb8"]
[debug] [35m[AndroidDriver][39m Getting a list of available webviews
[debug] [35m[ADB][39m Running 'E:\android-sdk\platform-tools\adb.exe -P 5037 -s UJKDU20611008827 shell cat /proc/net/unix'
 [debug] [35m[W3C (b511eb04)][39m Encountered internal error running command: Error executing adbExec. Original error: 'Command 'E\:\\android-sdk\\platform- 
tools\\adb.exe -P 5037 -s UJKDU20611008827 shell cat /proc/net/unix' timed out after 200000ms'. Try to increase the 200000ms adb execution timeout represented by 
 'adbExecTimeout' capability
 [debug] [35m[W3C (b511eb04)][39m Error: Command 'E\:\\android-sdk\\platform-tools\\adb.exe -P 5037 -s UJKDU20611008827 shell cat /proc/net/unix' timed out after 200000ms
[debug] [35m[W3C (b511eb04)][39m     at Timeout._onTimeout (C:\Users\zhangfuqiang\AppData\Roaming\npm\node_modules\appium\node_modules\teen_process\lib\exec.js:112:19)
[debug] [35m[W3C (b511eb04)][39m     at listOnTimeout (internal/timers.js:531:17)
[debug] [35m[W3C (b511eb04)][39m     at processTimers (internal/timers.js:475:7)


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