Here’s how I would approach it:
You could put the next step after your login in an Exception Handling, and if it succeeds, you know you don’t have to try logging in again. If it fails, you can attempt your log-in again in the “If an exception occurred” section and hope it works there (you’ll want to put the first step after logging in into this section as well, so you don’t attempt it twice if the log in works the first time).
This would only work if you only want to try logging in twice. If you want to attempt logging in over and over until it’s a success, you’ll need to set up a boolean variable and do a while loop until something triggers your boolean to true.