javascriptioscalabash-iosuia

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


I'm currently trying to automate an iOs App, which has an SFSafariViewController in it, where I would like to click on a textfield, which has an ID in HTML and also has an AccessibilityIdentifier from the App. My question now is how to write the right uia-command, because a normal tap_mark or touch is not helping, because the AccessibilityIdentifier are not found because of the SFSafariViewController. My uia command looks like this right now: uia("UIATarget.localTarget().frontMostApp().document.getElementById('Identifier').click()")

This is the error I get when I execute the command:

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

Solution

  • You can use UIWebView for web element but SFSafariViewController is not yet supported by Calabash see this:

    touch "UIWebView css:'#Identifier'"
    

    And Xamarin suggests to replace it with WKWebKit or 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.