func testClickSystemAlert(){ let app = XCUIApplication(); XCUIApplication().alerts["“纳豆行” Would like to Send You Notifications"].buttons["Allow"].tap() }
这是print的输出(XCUIApplication().deBUGDescription);
Attributes: Application 0x60000016c540: {{0.0,0.0},{414.0,736.0}},label: '纳豆行'Element subtree: →Application 0x60000016c540: {{0.0,label: '纳豆行' Window 0x60000016bc40: Main Window,{{0.0,736.0}} Other 0x60000016c780: {{0.0,736.0}} Other 0x60000016c9c0: traits: 8589934592,736.0}} ScrollVIEw 0x60000016bf40: traits: 8589934592,736.0}} Image 0x60000016c0c0: traits: 8589934596,IDentifIEr: '1' PageIndicator 0x600000163000: traits: 8589939200,{{132.0,691.0},{150.0,55.0}},value: page 1 of 4 Window 0x6000001693c0: {{0.0,736.0}} Statusbar 0x600000169240: {{0.0,20.0}} Other 0x60000016ca80: {{0.0,20.0}} Other 0x60000016cb40: {{0.0,20.0}} Other 0x60000016cc00: traits: 8388608,{{6.0,{39.0,20.0}} Other 0x60000016ccc0: traits: 8388608,{{50.0,{13.0,20.0}},label: '3 of 3 Wi-Fi bars',value: SSID Other 0x60000016cd80: traits: 8389120,{{181.0,{56.0,label: '12:29 AM' Other 0x60000016ce40: traits: 8388608,{{384.0,{25.0,label: '-100% battery power'Path to element: →Application 0x60000016c540: {{0.0,label: '纳豆行'query chain: →Find: Target Application 0x6000000b7340 Output: { Application 0x60000016c540: {{0.0,label: '纳豆行' }解决方法 我最终使用这个:
addUIInterruptionMonitor(withDescription: "Allow push") { (alerts) -> Bool in if(alerts.buttons["Allow"].exists){ alerts.buttons["Allow"].tap(); } return true; }
它将单击“允许”按钮
总结以上是内存溢出为你收集整理的ios – Xcode UITest推送通知提醒无法点击“允许”全部内容,希望文章能够帮你解决ios – Xcode UITest推送通知提醒无法点击“允许”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)