在 XCUITest 的可访问性指示器中找不到堆栈视图 [英] Cannot find stackview in accessibility indicator in XCUITest

查看:22
本文介绍了在 XCUITest 的可访问性指示器中找不到堆栈视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的视图控制器编写 UI 测试用例.它有三个视图

I'm writing UI test cases for my view controller.it has three views

1.标题视图 ->Stackview -> 4 个按钮

1.A header view ->Stackview -> 4 buttons

2.表格视图

3.footer view -> 5 个按钮

3.footer view - > 5 buttons

除stackview及其子按钮外,所有视图均可访问

All views are accessible except stackview and its child buttons

谁能指导我如何获得stackview及其子元素的引用?

Can anyone guide me how do i get reference of stackview and its child elements?

推荐答案

将标题视图和堆栈视图设置为不可访问,而将子元素设置为可访问.您可以使用 UIAccessibility API 执行此操作,将容器的 isAccessibilityElement 设置为 false.在要与之交互的视图上,将 isAccessibilityElement 设置为 true,并在每个视图上设置 accessibilityIdentifier.

Set the header view and stack view to be inaccessible and the child elements to be accessible. You can do this using the UIAccessibility API, setting isAccessibilityElement to false for the containers. On the views you want to interact with, set isAccessibilityElement to true and also set accessibilityIdentifier on each view.

如果容器视图是可访问的,它的子视图通常会被遮住,以避免混淆用户试图与之交互的内容.

If a container view is accessible, its child views are often obscured to avoid confusion about what the user is trying to interact with.

这篇关于在 XCUITest 的可访问性指示器中找不到堆栈视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆