Appium appium 并发多台手机测试报错 (求解答)

Dorom · 2019年04月24日 · 最后由 回复于 2019年11月01日 · 2492 次阅读

问题 appium 并发 2 台手机报错

  • 错误信息

    [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

共收到 2 条回复 时间 点赞
2019-10-3009:53:40:736[ADB]apksignerstderr:Unabletofinda$JAVA_HOMEat"/usr",continuingwithsystem-providedJava...
2019-10-3009:53:40:737[ADB]
2019-10-3009:53:40:737[ADB]'/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'isalreadysigned.
2019-10-3009:53:40:737[UiAutomator2]Serverpackagesaregoingtobe(re)installed
2019-10-3009:53:40:746[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shell'ls-t-1/data/local/tmp/appium_cache2>&1||echo_ERROR_''
2019-10-3009:53:40:826[ADB]Thecountofapplicationsinthecache:7
2019-10-3009:53:40:826[ADB]Theapplicationat'/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk'isalreadycachedto'/data/local/tmp/appium_cache/56abf1bf10f6562619a2dd8fb060718e27c4cb28.apk'
2019-10-3009:53:40:827[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shellpminstall/data/local/tmp/appium_cache/56abf1bf10f6562619a2dd8fb060718e27c4cb28.apk'
2019-10-3009:53:44:733[ADB]Theinstallationof'appium-uiautomator2-server-v3.5.1.apk'took3.906s
2019-10-3009:53:44:733[ADB]Installcommandstdout:Success
2019-10-3009:53:44:736[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shell'ls-t-1/data/local/tmp/appium_cache2>&1||echo_ERROR_''
2019-10-3009:53:44:835[ADB]Thecountofapplicationsinthecache:7
2019-10-3009:53:44:836[ADB]Theapplicationat'/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'isalreadycachedto'/data/local/tmp/appium_cache/bc38a04068b79fe3b459303c28bb4b7103bfb6c9.apk'
2019-10-3009:53:44:836[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shellpminstall/data/local/tmp/appium_cache/bc38a04068b79fe3b459303c28bb4b7103bfb6c9.apk'
2019-10-3009:53:47:237[ADB]Theinstallationof'appium-uiautomator2-server-debug-androidTest.apk'took2.400s
2019-10-3009:53:47:237[ADB]Installcommandstdout:Success
2019-10-3009:53:47:237[UiAutomator2]Waitingupto30000msforservicestobeavailable
2019-10-3009:53:47:238[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shellpmlistinstrumentation'
2019-10-3009:53:47:829[UiAutomator2]Instrumentationtarget'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner'isavailable
2019-10-3009:53:47:829[UiAutomator2]ForwardingUiAutomator2Serverport6790to8200
2019-10-3009:53:47:829[ADB]Forwardingsystem:8200todevice:6790
2019-10-3009:53:47:830[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405forwardtcp\:8200tcp\:6790'
2019-10-3009:53:47:845[UiAutomator2]DeletingUiAutomator2session
2019-10-3009:53:47:846[UiAutomator2]DeletingUiAutomator2serversession
2019-10-3009:53:47:848[WDProxy]Matched'/'tocommandname'deleteSession'
2019-10-3009:53:47:850[UiAutomator2]DidnotgetconfirmationUiAutomator2deleteSessionworked;Errorwas:UnknownError:Anunknownserver-sideerroroccurredwhileprocessingthecommand.Originalerror:Tryingtoproxyasessioncommandwithoutsessionid
2019-10-3009:53:47:850[UiAutomator2]ResettingIMEto'io.appium.settings/.UnicodeIME'
2019-10-3009:53:47:851[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shellimesetio.appium.settings/.UnicodeIME'
2019-10-3009:53:48:436[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405shellamforce-stopcom.ymdd.galaxy.yimimobile'
2019-10-3009:53:48:584[Logcat]Stoppinglogcatcapture
2019-10-3009:53:48:587[ADB]Removingforwardedportsocketconnection:8200
2019-10-3009:53:48:587[ADB]Running'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405forward--removetcp\:8200'
2019-10-3009:53:48:595[UiAutomator2]Unabletoremoveportforward'ErrorexecutingadbExec.Originalerror:'Command'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405forward--removetcp\:8200'exitedwithcode1';Stderr:'adb:error:listener'tcp:8200'notfound';Code:'1''
2019-10-3009:53:48:595[BaseDriver]Event'newSessionStarted'loggedat1572429228595(17:53:48GMT+0800(中国标准时间))
2019-10-3009:53:48:595[W3C]Encounteredinternalerrorrunningcommand:ErrorexecutingadbExec.Originalerror:'Command'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405forwardtcp\:8200tcp\:6790'exitedwithcode1';Stderr:'adb:error:cannotbindlistener:Addressalreadyinuse';Code:'1'
2019-10-3009:53:48:596[W3C]Error:Command'/Users/ios/.jenkins/tools/android-sdk/platform-tools/adb-P26513-s192.168.53.10\:7405forwardtcp\:8200tcp\:6790'exitedwithcode1
2019-10-3009:53:48:596[W3C]atChildProcess.proc.on.code(/usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:94:19)
2019-10-3009:53:48:596[W3C]atChildProcess.emit(events.js:197:13)
2019-10-3009:53:48:596[W3C]atmaybeClose(internal/child_process.js:984:16)
2019-10-3009:53:48:596[W3C]atSocket.stream.socket.on(internal/child_process.js:401:11)
2019-10-3009:53:48:596[W3C]atSocket.emit(events.js:197:13)
2019-10-3009:53:48:596[W3C]atPipe._handle.close(net.js:611:12)
2019-10-3009:53:48:646[HTTP]<--POST/wd/hub/session50013546ms-1037
2019-10-3009:53:48:646[HTTP]
2019-10-3009:53:48:761[Appium]ReceivedSIGTERM-shuttingdown

我这个问题感觉跟楼主差不多啊,不过我是 Jenkins 多任务起来两个 appium 驱动两个 adb server,也是并发执行报错呢
Trying to proxy a session command without session id
adb: error: listener 'tcp:8200' not found

解决了吗老哥

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