问题描述
限时送ChatGPT账号..Appium v1.6.4-betaXcode 8.2macOS 塞拉利昂 10.12
Appium v1.6.4-beta Xcode 8.2 macOs Sierra 10.12
我想自动将照片保存在我的设备中.但在第一次我必须给予许可.我使用了接受警报",但无法接受允许访问照片库的警报.它以绿色显示测试通过,当我执行测试时,但此弹出窗口仍然出现在视图中并且没有保存照片.
I want to automate to save photo in my device. But in first time I have to give permission. I have used "accept alert", but cannot accept the alert for allow to access the photo library. It shows the test passed in green , when I execute the test, but this popup still appear in view and photo is not saved.
这是我的剧本
//Check Save
driver.findElement(By.id("Save")).click();
driver.switchTo().alert().accept();
也使用了功能,
capabilities.setCapability("autoAcceptAlerts", true);
这是我想要的
如何接受这个提醒?我已经很好地尝试了 xpath sa,但没有运气
How to accept this alert? I have tried with xpath sa well, but no luck
推荐答案
下面的代码将起作用.尝试使用OK"和Ok".这是因为如果您想尝试用文本标识元素,您可以使用accessibilityID 或ID.
Below code will work.Give it a try with "OK" and "Ok". This is because if you want to try to identify the element with the text you can use accessibilityID or ID.
driver.findElement(By.id("OK")).click();
以下代码不适用于移动自动化中的警报,如网络警报.
Below code won't work for alerts coming in mobile automation like web alerts.
driver.switchTo().alert().accept();
这篇关于如何在 appium 中接受此警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论