eggplant

EggPlant Script Hanging on If-Statement


I have a simple script to open the Apple Maps app and then click the "Allow" option that appears if you haven't allowed the app your location in Settings.

Click "AppIcon_Maps"
If ImageFound(text:"Allow") then click it
PressHomeButton

However, when I run my script, Eggplant clicks on the Apple Maps icon and then never completes the if-statement. In fact, while running the script, the Apple Maps app never opens at all! When I abort the script it does open, though. Any ideas for why this happens? Maybe I don't understand how the ImageFound() works yet.


Solution

  • Well...I don't think there's a happy answer here. It appears the ImageFound() freezes the SUT as it searches the screen, and I need to define a very long wait (12 seconds) to give the SUT ample time to open the app so that when ImageFound() freezes the screen, the text could appear.

    It still requires a different approach, though, because when the text "Allow" is not on the screen, it takes about 10 minutes to reach this conclusion. Looks like OCR may not be a great approach on app, because it only takes a few seconds to determine than an image isn't present.

    Unfortunate that OCR is so slow in this context, because it's so useful for cross-platform scripts, but it's problematic in this instance.