Search code examples
javaappiumappium-iosanyline

WebDriverException when clicking the OK button on a Anyline dialog


So all I want to do is clicking on dialog that only pops up on the iOS Simulator (iOS 14.5, Appium Java-Client 7.3.0).

The dialog comes from Anyline because of course I have no camera on the simulator. If there is any way to hide this dialog it would solve my problem too, I tried this with capabilities but it doesn't worked.

cap.setCapability("autoAcceptAlerts", false);
cap.setCapability("autoDismissAlerts", false);

Selecting the dialog is no problem, i can check that the Dialog is here:

@iOSXCUITFindBy(accessibility = "Anyline SDK cutout UI")
public IOSElement anylineDialog;

This is how it looks like:

enter image description here

So the next step would be to just click the ok button it worked at the beginning but now I can't even select it in the Appium Inspector anymore. Before I just used this:

@iOSXCUITFindBy(accessibility = "OK")
public IOSElement okButton;

I don't know why it doens't work anymore, but I can still select it with the help of TestProject. I tested a lot of different selectors but it doesn't worked. (the one with accessibility = "OK" is also recommended in this tool)

I always get this exception and I don't know how to fix it, try catch also doesn't work:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil

I tried out the stuff on this page and I also get the OK button as the only button as this code snippet shows.

HashMap<String, String> args = new HashMap<>();
args.put("action", "getButtons");
List<String> buttons = (List<String>)driver.executeScript("mobile: alert", args);

Also from the same site, I tried this with the same result.

args.put("action", "accept");
args.put("buttonLabel", "OK");
driver.executeScript("mobile: alert", args);

Maybe this is to specific but if someone has an idea how I could solve it, I would be very thankful.


Solution

  • The iOS bug you mentioned has been fixed in Appium 1.22.1 and 2.0.0-beta. Be sure you are running one of those versions and you should be fine.