Gym Class Booking Bot
Selenium Scheduler with Persistent Chrome Profiles & Auto-Retry
Resilient browser automation with PowerShell Chrome lock cleanup, idempotent login state, retry loops, and My Bookings verification.
An automated gym class scheduling bot built with Python and Selenium WebDriver. Launches a persistent Chrome profile, filters recurring Tuesday and Thursday 6:00 PM timetable cards, books open slots or joins waitlists, retries transient timeouts, and verifies totals on My Bookings.
Selenium scripts frequently fail under locked Chrome profile folders, flaky slow connections, duplicate logins, or silent click failures without post-action proof.
Production browser bots need idempotency, retry wrappers, and explicit post-action verification rather than optimistic fire-and-forget clicks.
Engineering Objectives
System Architecture
Single-module Selenium 4 orchestrator combining process cleanup, WebDriverWait state machine transitions, and post-booking DOM reconciliation.
Process & Profile Hygiene
Queries Win32_Process via PowerShell CIM to terminate stale Chrome instances holding the user-data-dir lock before startup.
Closed-Loop Booking Verification
Navigates to My Bookings after scheduling and reconciles actual listed classes against expected newly booked plus existing reservations.
Core & Backend Implementation
- Custom retry() decorator/wrapper catching TimeoutException with bounded retries.
- Idempotent session check avoiding duplicate login submissions when cookies remain valid.
- Dynamic button state polling (Book Class -> Booked, Join Waitlist -> Waitlisted).
Client & Interface Layer
- Structured console audit logs summarizing booked, waitlisted, and verified slots.
Data & Schema Design
Stores cookies, local storage, and session tokens locally inside an isolated automation profile.
Authentication & Security Controls
- Process isolation between automation browser instance and personal browser sessions.
Engineering Challenges & Technical Decisions
Key Challenges Solved
Trade-Off Decisions
Testing & Verification Methodology
- Verified button text mutation and reservation count reconciliation.