5

I have an iOS5 iPad app that uses CLLocationManager that I'm testing with UIAutomation.

Before I run my test script, I manually press "OK" on the dialog that iOS presents when I use CLLocationManager.

Occassionally, my test scripts will fail to start. I press the "Play" icon in Instruments, and nothing happens for 12 seconds. Then, I get the following exception:

Target app is not frontmost

Once this happens, I usually have to restart to get instruments to work again.

I used to get this same exception when I left the CLLocationManager dialog in front of my application. Does anyone have any idea about how to fix this?

Heath Borders
  • 30,998
  • 16
  • 147
  • 256

2 Answers2

2
    //Handling Externally Generated Alerts
UIATarget.onAlert = function onAlert(alert) {
    var title = alert.name();
    UIALogger.logWarning("Alert with title ’" + title + "’ encountered!");
    if (title == "Add Something") {
        alert.buttons()["Add"].tap();
        return true; // bypass default handler
    }
    return false; // use default handler
}

Use this code to handle location alert 
PK86
  • 1,218
  • 2
  • 14
  • 25
1

This happens when an alert view pops up before the app finishes launching fully. It's a bug with automation.

gurooj
  • 2,100
  • 4
  • 21
  • 25
  • Handle alert to remove this error, refer Automating_User_Interface_Testing_With_Instruments pdf – PK86 Sep 05 '13 at 14:05