We have been using appium for testing both iOS as well as Android applications.
Regarding iOS, is there some work being done to handle Safari View Controller? Or is there some pre-existing way to automate stuff for them? (Similar to Mobile Safari)
I would be interested in learning more about this well. I’ve currently hit a snag in automating an iOS app. It appears to be an error happening because the app has opened a Safari View Controller.
Hi there, although testing of safari view controllers might not be officially supported by Appium, I managed to create a filthy workaround for Xcode 8 AND Xcode 9 safari view controller.
Let’s say I want to fill in a UITextField in bei safariVC:
Xcode 8 / iOS 10: you can actually retrieve the coordinates of the requested element from the view tree like this (for example by xpath) and send
MobileElement myTextField = (MobileElement)driver.findElementByXpath(“myXpathToElement”);
Point elementPoint = myTextField.getCoordinates().inViewPort();
(new TouchAction(driver)).tap(elementPoint.x + 10, elementPoint.y + 10).perform();
myTextField.sendKeys(“Hello World”);
Xcode 9 / iOS 11: you have no access to the desired UI element in the view tree, therefore you need to have
to hardcode the coordinates of the desired mobile element for every device screen type and send the keys to a XCUIElementTypeOther element, with which interactions are available. It is recommended to try out all XCUIElementOther-candidates in Appium inspector mode in order to find the “correct one”. If it works in inspector, it will work in your step defintion
MobileElement otherElement = (MobileElement) driver.findElementByXpath("//XCUIElementTypeApplication[@name=“MyApplicationName”]/XCUIElementTypeWindow[2]/XCUIElementTypeOther);
(new TouchAction(driver)).tap(200, 250).perform();
otherElement.sendKeys(“Hello World”);