使用普通 JavaScript 的 UIA 调用,不知道如何访问 DOM-Tree

UIA calls with plain JavaScript, don't know how to access DOM-Tree

我目前正在尝试自动化一个 iOs 应用程序,其中有一个 SFSafariViewController,我想在其中单击一个文本字段,它在 HTML 中有一个 ID,并且还有来自 App 的 AccessibilityIdentifier。 我现在的问题是如何编写正确的 uia 命令,因为正常的 tap_mark 或触摸没有帮助,因为由于 SFSafariViewController 而找不到 AccessibilityIdentifier。 我的 uia 命令现在看起来像这样: uia("UIATarget.localTarget().frontMostApp().document.getElementById('Identifier').click()")

这是我在执行命令时得到的错误:

RuntimeError: uia action failed because: Input:
UIATarget.localTarget().frontMostApp().document.getElementById('Identifier').click(). 
Error: TypeError: undefined is not an object (evaluating 'UIATarget.localTarget().
frontMostApp().document.getElementById')  eval code

您可以将 UIWebView 用于网络元素,但 Calabash 尚不支持 SFSafariViewController see this:

touch "UIWebView css:'#Identifier'"

并且Xamarin suggests用WKWebKit或者UIWebView替换它

Because the SFSafariViewController class is tailored for displaying a single page of web content, you should consider using it to replace any WKWebKit or UIWebView controls within your existing Xamarin.iOS apps.