當我打開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截取的屏幕截圖:
添加回答
舉報
0/150
提交
取消