xcode - XCTest:点击 SFSafariViewController 中的“完成”按钮
问题描述
我正在打开一个 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 吗?(我不需要访问浏览器中的元素)。
解决方案
这对我有用:
let doneButton = app.buttons["Done"]
waitUntilElementExists(element: doneButton)
doneButton.tap()
waitUntilElementExists 我认为它是让它工作的关键,我等了 60 秒。
推荐阅读
- java - 在 maven 中创建和安装 de-lomboked 源 jar
- java - 从项目父 pom 构建时激活位于不同 pom 中的配置文件
- angular - Angular 6:在子路由中跳过父路由解析器?
- javascript - Angular 不会返回内部嵌套的 for 循环
- python - 循环函数查找数字的平方根
- openstack - Openstack Neutron:通过rest api为路由器添加静态路由器
- spring - 如何使用 spring 存储库进行 bean 验证?
- cpanel - 当我遇到一些电子邮件问题时如何配置 WHM 服务器
- php - 电子邮件进入收件箱,但显示垃圾邮件
- mysql - MySQL:检查一列是否具有基于另一列的值