The final boss level! The real world and real websites often have networking and other issues. Can your bot handle them? This step is the most difficult.
Step 1: Setup the chaos
Log in as admin
Click "Clear all Bookings" (if you click "Reset All Data", you have to manually register your student account again)
Enable "Network Simulation"
Set failure rate to 50% (brutal!)
Reset to "Real Time"
Setting the failure rate to 50% will make half of your login and booking attempts fail.
Think about what you might do "retry" an action like logging in or booking a class.
Make your bot unstoppable:
Create a "retry" wrapper function, that can take other functions as an input:
def retry(func, retries=7, description=None):
Put all the steps that relate to login into a single login() function
Use your login function and your retry function together and run your script multiple times to see if it logs into the gym website successfully even when it has to retry multiple times. Get this working before trying to tackle the other parts of your Selenium script.
Put all the steps that relate to booking a class into a book_class() function and combine it with the retry wrapper function. Have a think how Selenium might know clicking the booking button has worked successfully. What would you check for?
Do the same for retrieving all your bookings from the My Bookings page with a get_my_bookings() function to make that part resilient too.
This is a hard challenge. Have a look here if you need a partial Solution & Hint
Here's how your script might behave like if everything is working:

If you got this far, bravo! 👏👏👏 You've built a robust gym booking bot that can:
Handle authentication and login
Book multiple classes of your choice intelligently
Verify its own work
Survive a crappy gym website in the wild =)
Now you'll never miss leg day again! (Unless you want to... I won't judge 🦵)