How to use try catch for a website sign in process?

Dear Experts

I have a request as below:

  1. Open browser and relative website - Done
  2. Key in IT Code/Password/Verification Code(use OCR to indentify) - Done
  3. If the Verification Code input is incorrect, then the webpage will show [Capcha error] after you click [Sign in]
  4. I need the robot to rethrow this process until correct Verification Code is input and [Sign in] successfully

I use [Try Catch] for it but the process never rethrow. It just directly end the process
May I know what I need to do to make it happen?

PS: I try several exception types in [Cathces] but none of them succeed

image

Thanks for your kind help in advance

Ivan

@yangyq10 Put your try catch inside a while loop in the the loop have a boolean condition sign in successful if it is you break the loop if it is not you retry again

May I know how to use variable to show [Sign in] successfully?

Hey @yangyq10

After Click Activity of Sign In button,

  1. Add Element Exist activity and indicate Error pop-up, output of this activity will be boolean, pass that in If Activity.
  2. If Activity → True → then Throw Activity property will be New Exception("Login Error")
  3. False → Else → Log Message → “Logged In Sucessfully”

Remaining activities are correct!

Regards,
Ajay Mishra

@yangyq10

Something like this

image
image

this will continue looping until you sign in successfully. You would need to get text of the captcha error element.

Alternatively, You could also indicate an element on the home page and reverse the conditions

Thank you for the detail guidance.
I debug just now. If error popup, it can now retry
But even though it successfully sign in, it still run into the new loop.
May I know if its anything wrong about the condition?


image

Ivan

@yangyq10

Add this condition as well and let me know

image

this is within the loop.

Also if you still face some challenge enable this property in your get text property

image

Thank you for staying with me. It finally works!!

Best regards

Thank you for your advise. I will take a try on it

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.