mercredi 4 juillet 2018

Appium: Unable to tap Allow permission button in notification

enter image description here

I'm trying to tap on 'ALLOW' button in two ways:

1) When I add permissions:

caps.setCapability("autoGrantPermissions", true);
caps.setCapability("autoAcceptAlerts", true);
......
driver.switchTo().alert().accept();

nothing happens((

2) When I try to find it by XPath:

driver.findElement(MobileBy.xpath("//*[@class='android.widget.Button'][2]")).click();

I get an error:

Exception in thread "main" org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {message=no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class='android.widget.Button'][2]"}

I found this post:Unable to tap the link after tap on Allow button of permission alert in Appium? but it didn't help me.

Aucun commentaire:

Enregistrer un commentaire