Phuc Thai
Phuc Thai

Reputation: 718

How to tap OK button in permission dialog that required to access to photos on iOS using Xamarin.UITest?

I am using Xamarin.UITest to execute automation on iOS app.

The problem is that: while accessing gallery to upload a photo, there is a permission dialog and i need to tap "OK" button to dismiss it.

The following ways that i tried, but they didn't work:

Are there any solution to work on this problem? Thanks.

Upvotes: 8

Views: 2335

Answers (3)

Lucas Moura Veloso
Lucas Moura Veloso

Reputation: 315

If you use Repl(); in your code you can try to get the marking for the OK button with the tree command.

If you are using the Visual Studio Entrerprise Edition you can make your tests a lot easier using the Xamarin Test Recorder, it works fantastically!

Another thing that should be noted is that UI Tests are usually made for screenshots and screen layout validations, the functionality of your should be tested with another kind of test with another framework or toolkit.

Upvotes: 0

therealjohn
therealjohn

Reputation: 2398

System dialogs for permissions are outside the scope of the app and won't show up in tree or any other query that you can do through UITest. Instead, these are typically handled automatically by calabash. The "automatic" behavior is to accept any permission dialog that appears.

Is your dialog in a different language where "OK" might be displayed in a non-english language? If so, we may need to file an issue for that specific locale so it can be implemented.

Also, make sure you have the latest UITest version. Take a look at the changes for iOS 10 and InvokeUia here.

Upvotes: 5

woof
woof

Reputation: 1288

try this: target.frontMostApp().mainWindow().elements()[0].elements()[2].elements()[1].tap()

Upvotes: 2

Related Questions