错误信息
[debug] [ADB] Removing forwarded port socket connection: 8022
[debug] [ADB] Running '/Users/workspace/software/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.8.181\:5559 forward --remove tcp\:8022'
[UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command '/Users/workspace/software/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.8.181\:5559 forward --remove tcp\:8022' exited with code 1'; Stderr: 'error: listener 'tcp:8022' not found'; Code: '1''
总是会自动退出后启动的 server ,同时 uiautomator2 也会被退出
部分代码
def desired_cap(data):
desired_caps = {}
desired_caps["platformName"] = data["platformName"]
desired_caps["platformVersion"] = data["platformVersion"]
desired_caps["deviceName"] = data["deviceName"]
desired_caps["udid"] = data["udid"]
desired_caps["appPackage"] = " aaaaaa" # 此处不好展示
desired_caps["appActivity"] = "aaaaa" # 此处不好展示
desired_caps["noReset"] = True
desired_caps["unicodeKeyboard"] = True
desired_caps["resetKeyboard"] = True
desired_caps ["automationName"] = "uiautomator2"
desired_caps["newCommandTimeout"] = 1000
desired_caps ['systemPort'] = data["systemPort"]
driver = webdriver.Remote('http://'+str(data['ip'])+':'+str(data['port'])+'/wd/hub',desired_caps)
return driver
systemPort 端口 8020 和 8022
调用方法
data = read_yaml(GetVariable.DESIREDCAPS)
desired_pool = []
for i in range(len(data)):
pool = multiprocessing.Process(target = create_case,args = (data[i]))
desired_pool.append(pool)
for pool in desired_pool:
pool.start()
for pool in desired_pool:
pool.join()
appium 服务启动命令:
appium -a 127.0.0.1 -p 4725 -bp 4726
appium -a 127.0.0.1 -p 4723 -bp 4724
appium : 版本 1.12.0
环境 : mac