【问题标题】:XCTest: Tap "Done" button in SFSafariViewControllerXCTest:点击 SFSafariViewController 中的“完成”按钮
【发布时间】:2019-04-21 13:39:28
【问题描述】:

我正在打开一个 SFSafariViewController,但找不到“完成”按钮以再次离开 Safari。

另外,如果我尝试使用 swipeRight XCode 来解决它,则会创建无法在之后的测试中使用的代码

let element = app.children(matching: .window).element(boundBy: 0).children(matching: .other).element.children(matching: .other).element.children(matching: .other).element(boundBy: 2)
    element.swipeRight()

知道如何关闭 SFSafariViewController 吗? (我不需要访问浏览器中的元素)。

【问题讨论】:

    标签: xcode xctest xcuitest sfsafariviewcontroller uitest


    【解决方案1】:

    这对我有用:

    let doneButton = app.buttons["Done"]
    waitUntilElementExists(element: doneButton)
    doneButton.tap()
    

    waitUntilElementExists 我认为它是让它工作的关键,我等待 60 秒。

    【讨论】:

      猜你喜欢
      • 2012-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多