robotframework-appiumlibrary
robotframework-appiumlibrary copied to clipboard
How to handling iOS system alerts with Appiumlibrary
[XCUITest] The capabilities 'autoAcceptAlerts' and 'autoDismissAlerts' do not work for XCUITest-based tests. Please adjust your alert handling accordingly.
'autoAcceptAlerts' does not useful. Is there any where to handle the alerts by appiumlibrary?
I try to use the keyword "wait until page content element" for waiting the button of alerts by accessibility_id but it doesn't find element.(it show the alerts on phone)
tsk for any help
Asking permission for getting location warning I can get the element and can click to confirm. which type of alarm can not be confirmed ?
I can get the element of button Allow by inspector, but the keyword click element by accessibility_id can't.
alarm:“Bilibili” Would Like to Send You Notifications" Notifications may include alerts, sounds, and icon badges. These can be configured in Settings.
I used the iphone7 , iOS 10.3.2. the version of appium 1.7.1 XCUITestDriver (v2.51.1)
when i am using the appium inspector ,i can get the element accessibility id=Allow,but inspector also show the massage "error Could not find element. Try refreshing page ". I could't find out the reason.
I've been struggling with this for the past week too. I can see the elements from iOS alerts in the source but they can't be clicked on. This is preventing me from running tests on recent versions of iOS.
From what I've read, in Appium, the solution is to call driver.switch_to.alert
and interact with the returned object. However, AppiumLibrary does not expose any alert-related keywords.
I believe what should be implemented here is a Handle Alert
keyword similar to the one in SeleniumLibrary, and possibly other alert-related keywords.
You must clear that what's problem you met. The inspector of appium or the test case in your test suit. The inspector I alse met the problem which made me so crazy, but it never fails my test case. For some weird and unknown problem , accessibility_id won't work well , so , please ask for xpath. if neither xpath nor accessibility_id can work well, then please try iOSNsPredicateString. If none of them can work. Click point can work after all. HaHa~
Neither accessibility_id and xpath locator strategies work to interact with system alerts, at least on a real device. I assume it's the same for iOSNsPredicateString but I did not verify this because that locator strategy is not currently supported by AppiumLibrary anyway.
As the UI is controlled by the system, X/Y coordinates is not good enough either as they would change depending of the device, iOS version and potentially other system settings. I cannot rely on such a workaround.
@lalamini I'm not sure why your tests pass as your comments are vague and your English is really hard to understand. I suspect you're still using the default UIAutomation framework that has been retired by Apple instead of the XCUITest framework. If not, I would appreciate if you could prove me wrong with a working example.
@SmashManiac Sorry for making you hard understand me. then I use automationName=XCUITest to start my application and I use iOSNsPredicateString to catch the alarm message about getting location warning.
How are you using iOSNsPredicateString in the first place? As I mentioned earlier, according to the AppiumLIbrary documentation, this locator strategy is not supported.
Hi, has anyone found a work around for this issue?
Hi, I got this problem too, did anyone find a solution for this?
@chiahsien update to version 1.5 and above, use this line of keyword
Click Element nsp=name=="Allow"
It will trigger a call for this Calling AppiumDriver.findElements() with args: ["-ios predicate string","name==\"Allow\"","8a0cd588-cfac-4356-a6a9-2f10c3fc08ff"]
And the alert will be dismissed.
@thepoppingone's solution worked for me, BUT be careful to type 2 whitespaces after Click Element, otherwise Robot thinks that the whole sentence is 1 keyword, resulting in runtime error...
So:
Click Element nsp=name=="Allow"
and
Click Element nsp=name=="Don’t Allow"
Closing due to inactivity