How to press "OK" for location popup on iOS Appium
I understood that you are asking for the device location alert. You can identify and use the Xpath of OK button to click. I have used the following code (in java) for an alert appears in the app.
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[7]/UIAAlert[1]/UIACollectionView[1]/UIACollectionCell[1]/UIAButton[1]")).click();
I am trying to automate my mobile web app.Every time it loads, it will ask "___ would like to use your location". User can either hit "don't allow" or "OK."
I am using self.driver.switch_to.alert.accept(), but it is accepting the default, which is "don't allow." How can I accept the "OK" instead of "don't allow"?