猿问

Web应用程序中的Appium:无法在通知弹出窗口中点击“允许”按钮

当我打开Web应用程序时,我会弹出一个窗口。我试图以两种方式单击“允许”按钮:


1)当我添加权限时:


caps.setCapability("autoGrantPermissions", true);

caps.setCapability("autoAcceptAlerts", true);

......

driver.switchTo().alert().accept();

没发生什么事((


2)当我尝试通过XPath查找它时:


driver.findElement(By.xpath("//android.widget.Button[@text='Allow']")).click();

我收到一个错误:


Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//android.widget.Button[@text='Allow']"}

这是我从UI Automator Viewer截取的屏幕截图:

江户川乱折腾
浏览 269回答 3
3回答
随时随地看视频慕课网APP

相关分类

Java
我要回答