为什么我收到“[XCUITest]无法在超时时间内接收任何数据:在iOS真实的设备上运行移动的Web测试时出现5000”错误?

bsxbgnwa  于 2023-01-06  发布在  iOS
关注(0)|答案(3)|浏览(444)

我目前正尝试在一台真实的iOS设备上使用Appium运行测试,其中包含pytest和selenium框架。在运行测试之前,我成功地在设备上构建了WebDriverAgent并启动了Appium服务器。在输入pytest命令启动测试后,iOS设备中的Safari浏览器打开,但测试没有启动。我在Appium日志中看到以下错误:

[debug] [iProxy@67f2ea78:8100] Closing the connection
[debug] [DevCon Factory] Cached connections count: 0
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [XCUITest] Found a remote debugger session. Removing...
[debug] [RemoteDebugger] Cleaning up listeners
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1639089800521 (14:43:20 GMT-0800 (Pacific Standard Time))
[debug] [W3C] Encountered internal error running command: Error: Could not navigate to webview! Err: Failed to receive any data within the timeout: 5000
[debug] [W3C]     at spinHandles (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-ios-driver/lib/commands/context.js:522:23)
[debug] [W3C]     at XCUITestDriver.navToViewWithTitle (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-ios-driver/lib/commands/context.js:564:3)
[debug] [W3C]     at XCUITestDriver.navToInitialWebview (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/context.js:29:5)
[debug] [W3C]     at XCUITestDriver.start (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:479:7)
[debug] [W3C]     at XCUITestDriver.createSession (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:215:7)
[debug] [W3C]     at AppiumDriver.createSession (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/lib/appium.js:371:35)
[debug] [W3C] Caused by: Error: Failed to receive any data within the timeout: 5000
[debug] [W3C]     at Timeout._onTimeout (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-ios-device/lib/plist-service/index.js:67:16)
[debug] [W3C]     at listOnTimeout (node:internal/timers:557:17)
[debug] [W3C]     at processTimers (node:internal/timers:500:7)
[HTTP] <-- POST /wd/hub/session 500 14924 ms - 741
[HTTP] 
[iProxy@67f2ea78:8100] The connection has been closed

有人遇到过这个问题并找到了解决方案吗?
功能= {“平台名称”:移动的设备平台,“平台版本”:平台版本,“新命令超时”:3000,“乌迪德”:设备标识符,“自动化名称”=“XCUIT测试”,“浏览器名称”=“Safari”,“使用预建WDA”:真,“设备名称”:“iPhone手机}
APIUM版本:1.22.1
XCode版本:13.1(13A1030d)
设备上的iOS版本:15.1
节点版本:17.0.1
NVM版本:0.39.0

k75qkfdt

k75qkfdt1#

这是由于IOSDriver,当我们访问编程. Android工作正常.
出现未创建会话异常:无法创建新的远程会话。有关详细信息,请检查服务器日志。原始错误:处理命令时发生未知的服务器端错误。原始错误:在超时时间内未接收到任何数据:5000
就在这里失败了。
driver =新的IOSDriver〈〉(新的URL(远程URL.toString()),所需的功能);

AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
    serviceBuilder.usingAnyFreePort();
    serviceBuilder.usingDriverExecutable(new File(Appium_Node_Path));
    serviceBuilder.withAppiumJS(new File(Appium_JS_Path));
    HashMap<String, String> environment = new HashMap<String,String>();
    environment.put("PATH", "/usr/local/bin:" + System.getenv("PATH"));
    serviceBuilder.withEnvironment(environment);
    server = AppiumDriverLocalService.buildService(serviceBuilder);
    server.start();
    server.isRunning();
driver = new IOSDriver<>(new URL(remoteUrl.toString()), desiredCapabilities);

Mac操作系统版本12.2.1 Xcode版本13.2.1苹果电脑版本1.22.2
如果直接运行Appium桌面服务器,WDA没有问题。

URL remoteUrl = new URL("http://0.0.0.0:4723/wd/hub");
    driver = new IOSDriver<>(remoteUrl, desiredCapabilities);
jk9hmnmh

jk9hmnmh2#

不知道为什么或如何,但我的问题是固定的使用Appium桌面代替。

cgyqldqp

cgyqldqp3#

我在使用Appium 1.22.3时遇到了同样的问题。节点版本是此错误的根本原因。我使用的是节点v18,当我将其更改为v16时,它按预期工作。

相关问题