Appium 我该怎么改变你,任性的 WDA 端口

hello · 2018年08月30日 · 最后由 丽丽 回复于 2019年12月27日 · 2285 次阅读

前言

千辛万苦,连哄带骗,向领导申请了 3 台 Mac 二手机器,来搞 IOS 自动化。安装单独执行都没问题,集成起来问题来了。有两台机器的 WDA 端口一直监听在 8100 上,集成多开无法搞定!

尝试

机器上修改 WDA 源码,设置固定端口 8200,编译后,WDA 确实可以监听 8200,但是我 java 里如下设置后,appium 启动后 WDA 依然还是会自动编译。
capabilities.setCapability("useNewWDA", false);//不重新装 WDA
capabilities.setCapability("wdaLocalPort", 8200);//监听 8200
各位有没有办法 让 WDA 不编译或者指定端口啊

设置参数 USE_PORT

Build settings from command line:
    USE_PORT = 8300

2018-08-30 15:22:49.714 xcodebuild[25252:7963294]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/var/folders/g6/8792kvn52hv52d169m85lyhr0000gp/T/com.apple.dt.XCTest/IDETestRunSession-EF7C3AED-F06E-41CC-AD43-3D4F1F867756/WebDriverAgentRunner-827F85BB-7037-4E7A-8744-2F9B84F74B54/Session-WebDriverAgentRunner-2018-08-30_152249-JIOZi8.log
2018-08-30 15:22:49.714 xcodebuild[25252:7963275] [MT] IDETestOperationsObserverDebug: (5868CF73-5DF8-42DB-8EC1-CCC53202314F) Beginning test session WebDriverAgentRunner-5868CF73-5DF8-42DB-8EC1-CCC53202314F at 2018-08-30 15:22:49.714 with Xcode 9F2000 on target <DVTiPhoneSimulator: 0x7f997f217b00> {
        SimDevice: iPhone X (E51A02EC-52B9-424A-8610-42A5E06BBD30, iOS 11.4, Booted)
} (11.4 (15F79))
=== BUILD TARGET WebDriverAgentLib OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET WebDriverAgentRunner OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===

Check dependencies

2018-08-30 15:22:50.994175+0800 WebDriverAgentRunner-Runner[25270:7963614] +[CATransaction synchronize] called within transaction
2018-08-30 15:22:51.053773+0800 WebDriverAgentRunner-Runner[25270:7963614] Running tests...
objc[25270]: Class VCWeakObjectHolder is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/Frameworks/ViceroyTrace.framework/ViceroyTrace (0x1243184d0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/AVConference (0x122f16e38). One of the two will be used. Which one is undefined.
2018-08-30 15:22:51.444877+0800 WebDriverAgentRunner-Runner[25270:7963614] Continuing to run tests in the background with task ID 1
Test Suite 'All tests' started at 2018-08-30 15:22:52.194
Test Suite 'WebDriverAgentLib.framework' started at 2018-08-30 15:22:52.194
Test Suite 'WebDriverAgentLib.framework' passed at 2018-08-30 15:22:52.194.
     Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'WebDriverAgentRunner.xctest' started at 2018-08-30 15:22:52.195
Test Suite 'UITestingUITests' started at 2018-08-30 15:22:52.195
Test Case '-[UITestingUITests testRunner]' started.
    t =     0.00s Start Test at 2018-08-30 15:22:52.195
    t =     0.00s Set Up
2018-08-30 15:22:52.197300+0800 WebDriverAgentRunner-Runner[25270:7963614] Built at Aug 30 2018 15:19:28
2018-08-30 15:22:52.217590+0800 WebDriverAgentRunner-Runner[25270:7963614] ServerURLHere->http://10.112.4.135:8100<-ServerURLHere

可以看到 设置 8300 时,编译后 端口仍然是 8200,脑壳疼,各位有么有解决方案啊。先拜谢各位了!

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 11 条回复 时间 点赞

@codeskyblue @chenhengjie123 @carl 斗胆打扰一下,可否帮小弟看一下什么情况,谢谢了🙏

"usePrebuildWDA": True 应该可以不编译?

雨夜狂奔 回复

True 是编译吧,true / false 我都试过,只要指定了端口都会编译的。要是能不编译,只指定端口就好了

WebDriverAgent-master\WebDriverAgent.xcodeproj\xcshareddata\xcschemes\WebDriverAgentRunner.xcscheme 这个文件添加

<EnvironmentVariables>
         <EnvironmentVariable
            key = "USE_PORT"
            value = "$(USE_PORT)"
            isEnabled = "YES">
         </EnvironmentVariable>
      </EnvironmentVariables>

添加位置如图所示

adfghzhang 回复

多谢大神,我马上试试~

adfghzhang 回复

这个怎么在 wda 文件夹里没有?这是他的源代码里的么?

hello 回复

嗯,源码里面。我是单独用 wda 的,不清楚这样是否 appium 能直接用。

adfghzhang 回复

appium 是打包后的,不能直接用。appium 里的,不知道在哪里设置😂

去找一下 appium 的配置文件的说明,好像可以配置不同的端口吧,现在没做这块了,没细研究,论坛里好像有同学试过 mac 同时跑多台 ios 设备的,你找找看

hello #10 · 2018年09月03日 Author
bauul 回复

恩,多谢。我再研究研究

hello 回复

楼主,这个问题你处理了嘛?我也遇到了这个问题,求指导

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