driver.acceptAlert() and ‘appium:autoAcceptAlerts’: true are clicking on Don’t Allow instead of Allow Once.
This issue is also related to other alerts - clicking on the wrong buttons.
appium-xcuitest-driver version is 7.26.2
appium version 2.11.3
iOS Sim 18.0
Xcode RC 16.0
@Aleksei, thanks for your response, but it’s not working. I put this setting into capabilities and it’s clicking ‘Don’t Allow’ anyway.
‘appium:settings[acceptAlertButtonSelector]’: ‘//XCUIElementTypeButton[@name=“Allow Once”]’
Also tried this to update the setting during the script execution - didn’t work.
await driver.updateSettings({ acceptAlertButtonSelector: ‘//XCUIElementTypeButton[@name=“Allow Once”]’ });
or
await driver.updateSettings({ ‘appium:acceptAlertButtonSelector’: ‘//XCUIElementTypeButton[@name=“Allow Once”]’ });
OK, found the right way to do that. The selector must be only a class chain selector. So this worked: await driver.updateSettings({ acceptAlertButtonSelector: '**/XCUIElementTypeButton[name == “Allow Once”]' });
And to restore to default settings: await driver.reloadSession();