IOS -Can not handle pop up location permission from failed previous test when create new test

1- one test failed from appium IOS
2-rerun the new test with full reset capability
3- the pop up of previous test is still appear and block the new test although i made accept all alert auto and all permissions to true because this alert from failed previous test

how to handle it ?

I would handle it in the cleanup. Although you have autoAccept set to true, in this case may need to code it to accept any pop up remaining before quitting. This is a decent writeup on how to handle this in Java:

If you get the source as it says, you should be able to see if there is a remaining notification pop up and do:

if notification {

Thanks for your reply but
1- is this require to put in block try and catch as it may be not appeared and in this case will through exception ? and this will delay time of test
2-second point if i interrupt test by stop button of eclipse can this code will clean all pop up windows before running new test ?

  1. as written it wouldn’t need that. if notification guarantees that it would have a notification or code block doesn’t execute. You need to write that code by referencing the link I shared and getting source as I said. Use examples from link.
  2. no idea. I don’t use eclipse.

Here is a link to how if statements work in Java:

i made this code
can you help me to get the same implementation without exception if the alert did not appear

try {
if(driver.findElementByXPath(“/XCUIElementTypeButton[label == ‘Change to Always Allow’]“).isDisplayed()) {
/XCUIElementTypeButton[label == ‘Change to Always Allow’]”).click();
catch(Exception e34) {“The notification of location did not appear”);

That could be your notification method, sure. Question for you though: Will it always be this notification?

If you dump the screen as specified in the first link I provided (driver.getPageSource()), then you can just check for the string in there (say with a regular expression). Or, much simpler, look for element XCUIElementTypeAlert, which will always be present if there is an alert. I encourage you to check for that, as it’s the simplest solution. Note that XCUIElementTypeAlert is only for iOS.