xcode:时间戳事件匹配错误:找不到匹配元素
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36597862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xcode: Timestamped Event Matching Error: Failed to find matching element
提问by emoleumassi
I'm trying to record some XCUITesting functions. I get this error.
我正在尝试记录一些 XCUITesting 函数。我收到这个错误。
Timestamped Event Matching Error: Failed to find matching element
Is this an Xcode bug and/or issues with the complexity of my UI?
这是 Xcode 错误和/或 UI 复杂性的问题吗?
回答by ArielSD
I was having the same problem for a long time on a very complex app as well: The key is all in isAccessibilityElement
being set to YES. UI testing and accessibility go hand-in-hand. The way I think about it is that the device needs to be able to interact with the element, since ostensibly, the user wouldn't be able to.
我在一个非常复杂的应用程序上也遇到了同样的问题很长一段时间:关键isAccessibilityElement
在于设置为 YES。UI 测试和可访问性是相辅相成的。我的想法是设备需要能够与元素进行交互,因为从表面上看,用户无法做到。
I did this twice:
我做了两次:
In
cellForRowAtIndexPath
-cell.isAccessibilityElement = YES
In
awakeFromNib
in aUITableViewCell
subclass -self.isAccessibilityElement = YES
在
cellForRowAtIndexPath
-cell.isAccessibilityElement = YES
在
awakeFromNib
一个UITableViewCell
子类-self.isAccessibilityElement = YES
Hope that helps, and good luck!
希望能帮到你,祝你好运!
回答by Kamilton
Try manipulating with items isAccessibilityElement property. As far as I know containers like tableView should have this property set to NO in order to items contained inside them be accessible
尝试使用项目的 isAccessibilityElement 属性进行操作。据我所知,像 tableView 这样的容器应该将此属性设置为 NO,以便可以访问其中包含的项目
Assistive applications can get information only about objects that are represented by accessibility elements. Therefore, if you implement a custom control or view that should be accessible to users with disabilities, set this property to YES. The only exception to this practice is a view that merely serves as a container for other items that should be accessible.
辅助应用程序只能获取有关由辅助功能元素表示的对象的信息。因此,如果您实现了残障用户应该可以访问的自定义控件或视图,请将此属性设置为 YES。这种做法的唯一例外是一个视图,它仅用作其他应该可访问的项目的容器。
回答by Jay Mayu
You need to add key path value to your UI elements as below. For an example, if you are using a tableview
then select it in the Storyboard and then click on Identity Inspector
. Now enter the following value isAccessibilityElement
in the key and tick the checkbox as shown in the image below.
您需要将键路径值添加到您的 UI 元素,如下所示。例如,如果您使用的是 ,tableview
则在故事板中选择它,然后单击Identity Inspector
。现在isAccessibilityElement
在键中输入以下值并勾选复选框,如下图所示。
Also if you can't tap on the UITableViewCell or the subclasses, then enable the Accessibility option as shown below.
此外,如果您无法点击 UITableViewCell 或子类,请启用辅助功能选项,如下所示。
hereafter it should work just fine.
此后它应该可以正常工作。