Forum Discussion

jaredjamieson's avatar
Occasional Contributor
2 years ago

Handling Inconsistent popups

I am writing a script test that performs a login using Apple ID.  In the app the user selects 'login with Apple Id' then they are brought to Apple's login browser which pops up over the app.  This is all expected. 


The issue is that sometimes This browser does not load and a system notification is shown stating 'The app did not load correctly'.  This is an Android specific popup that was not implemented by my tested app. 


I am able to incorporate logic that if this popup is on screen then it will click 'continue' and go about as expected.  My issue is when this popup does not occur, my script will present an error saying the popup is not found then continue with the logic as expected.  I am using the .Visible, .VisibleOnScreen, and .Exists attributes but they still all run causing the attached error.  


I can see in the logs that either way the script continues and in the end will output correctly.  But since sometimes the popup does not occur, the if check is ran and produces an error causing the executed script to error.  Is there any way to handle a sometimes occurring element without producing any errors in the logs?  

4 Replies

  • AlexKaras's avatar
    Champion Level 3



    Can you provide relevant piece of code that errors out?

    I hope that I know the reason, but would like to double-check.


    • jaredjamieson's avatar
      Occasional Contributor

      app = Aliases.Device.my_app_name;


      if (app.FindElementById("android:id/aerr_close").Exists)


      Remember, I have also tried .Visible and VisibleOnScreen properties.