我有一个包含 2 个单元格的 UITableView,每个单元格包含 2 个 UITextField。因为单元格是动态创建的,所以我使用可访问性标签和值来选择元素,如下所示:
id<GREYMatcher> firstNameMatcher = grey_allOf(grey_accessibilityLabel(@"First name"),
grey_accessibilityValue(@"Adult 1"), nil);
id<GREYMatcher> lastNameMatcher = grey_allOf(grey_accessibilityLabel(@"Last name"),
grey_accessibilityValue(@"Adult 1"), nil);
id<GREYMatcher> firstNameMatcher1 = grey_allOf(grey_accessibilityLabel(@"First name"),
grey_accessibilityValue(@"Adult 2"), nil);
id<GREYMatcher> lastNameMatcher1 = grey_allOf(grey_accessibilityLabel(@"Last name"),
grey_accessibilityValue(@"Adult 2"), nil);
[[EarlGrey selectElementWithMatcher:firstNameMatcher]
performAction:grey_typeText(@"Test")];
[[EarlGrey selectElementWithMatcher:lastNameMatcher]
performAction:grey_typeText(@"Test")];
[[EarlGrey selectElementWithMatcher:firstNameMatcher1]
performAction:grey_typeText(@"Test")];
[[EarlGrey selectElementWithMatcher:lastNameMatcher1]
performAction:grey_typeText(@"Test")];
成人 1 字段位于第一个单元格中,成人 2 位于第二个单元格中。
“测试”出现在前 2 个文本字段中,在第一个单元格中没有问题。EarlGrey 然后给出以下错误:
EarlGrey tried waiting for 5.0 seconds for the application to reach an idle state. It is now forced to clear the state of GREYAppStateTracker, because the test might have caused the application to remain in non-idle state indefinitely.
Full state tracker description: Waiting for viewDidAppear: call on this view controller. Please ensure that this view controller and its subclasses call through to their super's implementation
Waiting for CAAnimations to finish. Continuous animations may never finish and must be stop explicitly. Animations attached to hidden view may still be executing in the background.
Full state transition call stack for all elements:
<UICompatibilityInputViewController:0x7fe9394870d0> => Waiting for viewDidAppear: call on this view controller. Please ensure that this view controller and its subclasses call through to their super's implementation
我已经设法通过隐藏键盘 (cmd+k) 让它输入到第二个单元格的第一个文本字段(可访问性标签:“成人 2”,值:“名字)。但它不会再进一步了,无论我显示/隐藏键盘多少。