有人能告诉我如何提取任何按钮或导航条的标签/值/名称吗?
到目前为止我尝试过的代码
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].title;
NSLog(@"%@++++++++", Test);和
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].accessibilityLabel;
NSLog(@"%@++++++++", Test);和
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].accessibilityValue;
NSLog(@"%@++++++++", Test);对于上述所有3项,输出仍然为空。
发布于 2016-12-15 09:30:29
使用label访问静态文本元素的值。
NSString *test = app.navigationBars[@"Test"].staticTexts[@"Test"].label;
NSLog(@"%@++++++++", test);https://developer.apple.com/reference/xctest/xcuielementattributes/1500692-label
发布于 2016-12-15 09:36:45
您必须使用label。对于您的情况,请将其替换为:
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].label;https://stackoverflow.com/questions/41136555
复制相似问题