【发布时间】:2019-11-13 22:01:01
【问题描述】:
我刚开始使用 Detox 来测试我的 react native 应用程序,我在回答原生确认时遇到了一些麻烦。
我没有找到_UI的列表......查看 (如:_UIAlertControllerActionView、_UINavigationBarBackIndicatorView)
it('should show world screen after tap', async () => {
await loginPage.getFbBtn().tap();
// await element(by.type('_UINavigationBarBackIndicatorView')).tap();
//await element(by.text('Continue')).tap();
await element(by.text('Continue').and(by.type('_UIAlertControllerActionView'))).tap();
});
元素(by.type('_UINavigationBarBackIndicatorView')).tap();
(节点:2009)UnhandledPromiseRejectionWarning:错误:找不到 UI 元素。 操作异常:{ “动作名称”:“点击”, "元素匹配器": "((!(kindOfClass('RCTScrollView')) && kindOfClass('(null)')) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass( 'RCTScrollView'))) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('(null)')))))", "Recovery Suggestion": "检查下打印的UI层级中是否存在该元素,如果存在,调整匹配器,使其准确匹配元素。" }
错误跟踪:[ { "Description": "交互无法继续,因为找不到所需的元素。", "错误域": "com.google.earlgrey.ElementInteractionErrorDomain", “错误代码”:“0”, "文件名": "GREYElementInteraction.m", "函数名称": "-[GREYElementInteractionmatchedElementsWithTimeout:error:]", “行”:“124” } ]
等待元素(by.text('Continue')).tap();
错误:找不到 UI 元素。 操作异常:{ “动作名称”:“点击”, "元素匹配器": "((!(kindOfClass('RCTScrollView')) && (((kindOfClass('UILabel') || kindOfClass('UITextField') || kindOfClass('UITextView')) && hasText('Continue' )) || (kindOfClass('RCTTextView') && an object with accessibilityLabel "Continue"))) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('RCTScrollView')) ) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches((((kindOfClass('UILabel') || kindOfClass('UITextField') || kindOfClass('UITextView')) && hasText(' Continue')) || (kindOfClass('RCTTextView') && an object with accessibilityLabel "Continue"))))))", "Recovery Suggestion": "检查下打印的UI层级中是否存在该元素,如果存在,调整匹配器,使其准确匹配元素。" }
等待元素(by.text('Continue').and(by.type('_UIAlertControllerActionView'))).tap(); 错误:找不到 UI 元素。
【问题讨论】:
标签: react-native detox