无法单击带有硒/钠的警报 [英] Unable to click on Alert with Selenium/Appium

查看:91
本文介绍了无法单击带有硒/钠的警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要单击确定按钮的警报,但是我尝试过的任何方法似乎都无法解决。我的代码可以识别警报,但是一旦尝试执行操作,它似乎就会与警报后面的屏幕进行交互。

I have an alert with a OK button that I need to click, but nothing I've tried seems to work on it. My code can identify the alert, but as soon as I try to perform an action it, it seems to interact with the screen behind the alert.

这是一个本机iOS应用程序我正在一起工作。我尝试了以下选项:

It's a native iOS app that I'm working with. I've tried the following options:

1. driver.switchTo().alert().accept();
2. driver.switchTo().alert().dismiss;
3. driver.switchTo().alert();
   driver.findelement(By.id("OK")).click();
4. TouchAction touchAction = new TouchAction(driver).tap(xCoordinates, yCoordinates);
    touchAction.perform();

有人知道单击此警报的另一种方法吗?

Does anyone know of another way to click on this alert?

推荐答案

添加功能 capabilities.setCapability ( autoGrantPermissions,是),在您的功能列表中!它将允许自动接受或确定。我的同一个问题已解决!

Add a capability capabilities.setCapability("autoGrantPermissions", true); in appium your capabilities list! It will allow to accept or OK automatically. My same issue was resolved!

这篇关于无法单击带有硒/钠的警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆