简体   繁体   English

如何解雇警报弹出是android使用appium

[英]How to dismiss alert popup is android using appium

What i am trying to do: 我想做什么:

  1. I get an alert popup , i need to dismiss that and proceed further 我得到一个警告弹出窗口,我需要解雇它并继续进行
  2. on iOS it works fine using "capabilities.setCapability("autoAcceptAlerts", true);", Dismiss the alert popup and proceed with doing other element click etc 在iOS上它使用“capabilities.setCapability(”autoAcceptAlerts“,true);”,“关闭警报弹出窗口并继续执行其他元素点击等工作正常

Problem: 问题:

  1. With Android its not dismissing the alert, it just ignores that line of code and progress further and error is thrown Android没有解除警报,它只是忽略了那行代码并进一步发展并抛出了错误

I did try with below its still not dismissing the alert popup: capabilities.setCapability("autoDismissAlerts", true); 我确实试过下面仍然没有解雇警报弹出:capabilities.setCapability(“autoDismissAlerts”,true); and driver.switchTo().accept().alert(); 和driver.switchTo()。accept()。alert();

More info: 更多信息:

The alert popup here is asking user permission to use location to use the app. 此处的警报弹出窗口要求用户使用位置来使用该应用程序的权限。

As of now i don't want to accept that alert,i just want to ignore in my script and proceed further. 截至目前,我不想接受该警报,我只想在我的脚本中忽略并继续进行。

Using Appium 1.5.3ver for windows ,trying to automate for android device app Android OS 6.0,Samsung S5 使用Appium 1.5.3ver for windows,尝试自动化Android设备应用Android OS 6.0,三星S5

If autoDismissAlerts is not working then you can use click method to click on "No"/"Not Now" button to ignore the pop-up in Android. 如果autoDismissAlerts不起作用,那么您可以使用单击方法单击“否”/“不立即”按钮忽略Android中的弹出窗口。 You don't need to use switchTo() method. 您不需要使用switchTo()方法。 It directly clicks on the button. 它直接点击按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM