如何在使用 Xamarin.UITest 访问 iOS 照片所需的权限对话框中点击“确定"按钮? [英] How to tap OK button in permission dialog that required to access to photos on iOS using Xamarin.UITest?

查看:25
本文介绍了如何在使用 Xamarin.UITest 访问 iOS 照片所需的权限对话框中点击“确定"按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Xamarin.UITest 在 iOS 应用上执行自动化.

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:

  • 使用 tree 命令不会显示该对话框的层次结构,因此我无法找到要自动化的 UI 元素

  • Using tree command does not show hierarchy of that dialog, so that i can not locate UI element to automate

使用iOSApp.InvokeUia("UIATarget.localTarget().frontMostApp().alert().buttons()[\"OK\"].tap()");这显示错误:UIATarget.localTarget().frontMostApp().alert().buttons()["OK"] 可以由于元素不可见而不会被点击 tap@[native code]

是否有解决此问题的解决方案?谢谢.

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

推荐答案

权限的系统对话框超出了应用程序的范围,不会出现在 tree 或任何其他查询中通过 UITest 做.相反,这些通常由葫芦自动处理.自动"行为是接受出现的任何权限对话框.

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.

您的对话框是否使用其他语言,而OK"可能会以非英语语言显示?如果是这样,我们可能需要针对该特定语言环境提交问题,以便实施.

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.

另外,请确保您拥有最新的 UITest 版本.在此处查看 iOS 10 和 InvokeUia 的更改.

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

这篇关于如何在使用 Xamarin.UITest 访问 iOS 照片所需的权限对话框中点击“确定"按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆