【问题标题】:WebDriverException when clicking the OK button on a Anyline dialog单击 Anyline 对话框上的确定按钮时出现 WebDriverException
【发布时间】:2022-01-24 12:30:27
【问题描述】:

所以我要做的就是单击仅在 iOS 模拟器上弹出的对话框(iOS 14.5,Appium Java-Client 7.3.0)。

对话框来自 Anyline,因为我当然在模拟器上没有摄像头。 如果有任何方法可以隐藏此对话框,它也可以解决我的问题,我尝试使用功能但它不起作用。

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

选择对话框没问题,我可以检查对话框在这里:

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

看起来是这样的:

所以下一步就是单击它在开始时工作的 ok 按钮,但现在我什至无法在 Appium Inspector 中选择它了。在我刚刚使用这个之前:

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

我不知道为什么它不再工作了,但我仍然可以在 TestProject 的帮助下选择它。 我测试了很多不同的选择器,但没有奏效。 (这个工具也推荐使用accessibility="OK")

我总是遇到这个异常,不知道怎么解决,try catch 也不管用:

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

我试用了 on this page 的东西,并且我还得到了 OK 按钮作为这段代码 sn-p 显示的唯一按钮。

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

同样来自同一个站点,我尝试了同样的结果。

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

也许这是具体的,但如果有人知道我如何解决它,我将非常感激。

【问题讨论】:

    标签: java appium appium-ios anyline


    【解决方案1】:

    您提到的 iOS 错误已在 Appium 1.22.1 和 2.0.0-beta 中修复。确保您正在运行其中一个版本,您应该没问题。

    【讨论】:

      猜你喜欢
      • 2018-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-29
      相关资源
      最近更新 更多