gpt4 book ai didi

ios - Xcode UITest 推送通知提示无法点击 "Allow"

转载 作者:可可西里 更新时间:2023-11-01 05:11:05 25 4
gpt4 key购买 nike

有人遇到过类似情况吗?所以应用程序打开,推送通知警报出现询问用户是否允许接收推送通知,测试单击不允许即使我有以下代码:

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, 0.0}, {414.0, 736.0}}, label: '纳豆行'
Window 0x60000016bc40: Main Window, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x60000016c780: {{0.0, 0.0}, {414.0, 736.0}}
Other 0x60000016c9c0: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
ScrollView 0x60000016bf40: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Image 0x60000016c0c0: traits: 8589934596, {{0.0, 0.0}, {414.0, 736.0}}, identifier: '1'
PageIndicator 0x600000163000: traits: 8589939200, {{132.0, 691.0}, {150.0, 55.0}}, value: page 1 of 4
Window 0x6000001693c0: {{0.0, 0.0}, {414.0, 736.0}}
StatusBar 0x600000169240: {{0.0, 0.0}, {414.0, 20.0}}
Other 0x60000016ca80: {{0.0, 0.0}, {414.0, 20.0}}
Other 0x60000016cb40: {{0.0, 0.0}, {414.0, 20.0}}
Other 0x60000016cc00: traits: 8388608, {{6.0, 0.0}, {39.0, 20.0}}
Other 0x60000016ccc0: traits: 8388608, {{50.0, 0.0}, {13.0, 20.0}}, label: '3 of 3 Wi-Fi bars', value: SSID
Other 0x60000016cd80: traits: 8389120, {{181.0, 0.0}, {56.0, 20.0}}, label: '12:29 AM'
Other 0x60000016ce40: traits: 8388608, {{384.0, 0.0}, {25.0, 20.0}}, label: '-100% battery power'
Path to element:
→Application 0x60000016c540: {{0.0, 0.0}, {414.0, 736.0}}, label: '纳豆行'
Query chain:
→Find: Target Application 0x6000000b7340
Output: {
Application 0x60000016c540: {{0.0, 0.0}, {414.0, 736.0}}, label: '纳豆行'
}

最佳答案

我最终使用了这个:

addUIInterruptionMonitor(withDescription: "Allow push") { (alerts) -> Bool in
if(alerts.buttons["Allow"].exists){
alerts.buttons["Allow"].tap();
}
return true;
}

它将点击允许按钮

关于ios - Xcode UITest 推送通知提示无法点击 "Allow",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42190134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com