I am using Ruby in a Cucumber automation framework to automate my Android and iOS application. I am using Appium 1.6.4 beta as it supports iOS 10.2.
When the Appium server first installs the iOS app on the device it is prompted with an Alert Dialog asking if I want to allow notifications. With Appium as far as I can tell the "autoAcceptAlerts" capability does not currently work.
My main question is how would I go about checking if the alert dialog is there and then use something like find_element to press the "Allow" button but not have to edit my feature files. Is there a way I can use my "Log in as an Existing User" step to check for the alert and dismiss it if it's there and if not just continue with the login flow?
I tried to use find_element(xpath to OK button).exists? to make an if/else statement but I think I'm just doing it wrong. If the alert is not present the step fails and my test run stops.
I'm sorry if this question was answered somewhere on her but I've been unable to find a good answer for this question myself. Thank you for any help you can provide.
According to documentation from the Appium team it appears as though the desired capability for automatically accepting all dialogs is broken. As such I have hard-coded the action rather than relying on appium. Perhaps this will be fixed in the next version.
You can use #driver.switch_to.alert.accept to Accept or #driver.switch_to.alert.dismiss to dismiss the Alert.
If you are unsure about the alert, use begin/rescue to handle the exception
Related
What are some possible reasons that UNUserNotificationCenter.current().requestAuthorization might not prompt?
I have some users that are not receiving the prompt for permission at all. I've even tried to change the app bundle Id in TestFlight to see if they would get the prompt but to no avail.
I've tried resetting permission via https://developer.apple.com/library/archive/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42 as well.
Notification permission settings does not get listed within the app settings on iOS which leads me to believe it isn't necessarily rejected.
Any help would be greatly appreciated. I don't think this is a code issue as the call is fairly straightforward.
Asking for provisional permissions causes the permission prompt for notifications not to show on iOS < 12.
If the user has rejected the permission for your app before, then the dialog won't show either.
Even though the problem was caused by something silly; I think it would still be worthwhile to share the problem resolution.
We have a WK WebView iOS app. On our Angular side, we try to detect whether or not the environment is currently iOS native app before trying to prompt the user for permission. We do this detection by setting a flag in local storage (I don't really have all the details as it is not my code - I'm just the reviewer). Between the loading of the native app, the WebView and angular code, we couldn't reliably ensure that things are handled synchronously.
The detection failed - so we never prompt the user.
Thanks again for the help.
I'm using https://github.com/fechanique/cordova-plugin-fcm plugin and it works great for both platforms.
However, on iOS, the notification permission pop up is invoked right at the launch of the app, and I want it to appear only after the login process is complete.
I have zero knowledge in objective-C so i can't override the classes.
Can anyone please help?
Found a solution in case anyone encounters the same problem in the future...
https://github.com/jjrom/cordova-plugin-fcm/commit/4fedc72b2d94d85a67f6266aef13e774b7a16bfe
I have to have handle system pop up on iOS. I have tried below solution but they do not help:
1. driver.findElement(By.name("OK")).click();
2. capabilities.setCapability("autoAcceptAlerts", true);
These solution do not help.
I went through http://bitbar.com/appium-tip-9-how-to-automatically-dismiss-dialogs-and-autoaccept-alerts/ which says to use image recognition to handle alerts.
Is there any solution which can help me handle these pop-ups. Or if anyone is aware of any script which can be called at time of popup appearance to handle these pop ups.
Also, I came to know that appium can handle system pop-ups for ios 10. Is there any solution for lower versions.
I installed appium 1.6.3 and tested for handling ios system pop ups and I was able to click on Install button for one of the pop up using element.click() method.
I use KIF to test the UI for continuous integration. When the app is the first launch on a device (or iOS Simulator), the system will show some alert views for security. How can KIF automatically acknowledge system alerts to prevent test from failure?
The best way is to use [tester acknowledgeSystemAlert]. It will click the last button in the system alert :)
For more information see this github thread.
How can I suspend/close my iPad app programmatically? I wanted to show the terms of use on app start up. If user presses the Accept button the app should continue. If user presses the Decline button the app should be suspended/closed.
PS : The app is built using Titanium Appcelerator framework.
you could try calling exit() but, to be honest, i doubt that the behaviour you want is desirable. i haven't seen any other apps do it - i'm not sure it'd be considered acceptable by Apple.
You never exit from an iPhone or iPad application.
If it does apple takes it as a crash and surely reject your application.
In your case, the best solution will be displaying another screen which display a message like: "You cannot access the application until you accept the terms" or something like that.
You can use exit(0); whenever you want to exit the app. I have implemented this code in my project and it works perfectly fine for me.