如何使用 iOS 17.4 在 Swift XCTest UI 中打开密码字段

问题描述 投票:0回答:1

当我在 iOS 17.0.1 的 iOS 模拟器中运行此代码时,它可以工作:

    let passcodeInput = springboard.secureTextFields["Passcode field"]
    _ = passcodeInput.waitForExistence(timeout: 10)
    passcodeInput.tap()

但是,如果我在 iOS 17.4 的 iOS 模拟器上运行它,我会收到此错误:

    t =      nans     Checking existence of `"Passcode field" SecureTextField`
    t =      nans     Capturing debug information
    t =      nans         Requesting snapshot of accessibility hierarchy for app with pid 66943
    t =      nans     Tap "Passcode field" SecureTextField
    t =      nans         Wait for com.apple.springboard to idle
    t =      nans         Find the "Passcode field" SecureTextField
    t =      nans             Find the "Passcode field" SecureTextField (retry 1)
    t =      nans             Find the "Passcode field" SecureTextField (retry 2)
    t =      nans     Requesting snapshot of accessibility hierarchy for app with pid 66943
<unknown>:0: error: PRCheckUITests : Failed to tap "Passcode field" SecureTextField: No matches found for Descendants matching type SecureTextField from input {(
    Application, pid: 66943, label: ' '
)}

iOS 17.4 的硬编码字符串“密码字段”是否发生变化? 如何在测试中通过跳板访问密码字段?

swift xcode xctest springboard passcode
1个回答
0
投票

我进一步调查发现,密码字段不像 iOS 17.0.1 那样出现在 iOS 17.4 模拟器中。这就是为什么测试代码找不到密码字段并因此失败。

© www.soinside.com 2019 - 2024. All rights reserved.