Dibya Sarothi
Dibya Sarothi
Automation & BotsProduction ReadySeptember 2026

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.

Gym Class Booking Bot overview
Project Overview

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.

Problem Statement

Selenium scripts frequently fail under locked Chrome profile folders, flaky slow connections, duplicate logins, or silent click failures without post-action proof.

Engineering Rationale

Production browser bots need idempotency, retry wrappers, and explicit post-action verification rather than optimistic fire-and-forget clicks.

Engineering Objectives

Reuse persistent Chrome profiles via --user-data-dir and clean lingering Chrome processes via Windows CIM.
Implement a custom retry() resilience wrapper handling TimeoutException across slow networks.
Filter recurring timetable days and timeslots, handling Book Class vs. Join Waitlist transitions.
Cross-check confirmed reservations on My Bookings against expected action totals.
Architecture Blueprint

System Architecture

Single-module Selenium 4 orchestrator combining process cleanup, WebDriverWait state machine transitions, and post-booking DOM reconciliation.

01

Process & Profile Hygiene

Queries Win32_Process via PowerShell CIM to terminate stale Chrome instances holding the user-data-dir lock before startup.

02

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

Engine / Tier: Persistent Chromium Profile Store

Stores cookies, local storage, and session tokens locally inside an isolated automation profile.

Core Models & Entities
ScheduleSlotBookingActionVerificationSummary

Authentication & Security Controls

Auth Model: Session cookies persisted in dedicated Chrome profile directory
  • Process isolation between automation browser instance and personal browser sessions.

Engineering Challenges & Technical Decisions

Key Challenges Solved

Challenge: Stale headless/detached Chrome processes locking the custom --user-data-dir profile on Windows.
Engineering Solution: Added a preflight Win32_Process PowerShell inspection cleanup hook prior to launching WebDriver.

Trade-Off Decisions

Decision: Explicit State Verification on My Bookings
Architectural Rationale: Guarantees silent UI failures are flagged immediately rather than assumed successful.

Testing & Verification Methodology

Frameworks & Approach: Selenium WebDriverWait Assertions
  • Verified button text mutation and reservation count reconciliation.

Results & Engineering Takeaways

Applied systems reliability patterns (retries, idempotency, closed-loop audit checks) to Selenium browser automation.