Also, handle different scenarios: what if the app crashes? The script might need to detect that and fail the test.