The goal
End-to-end automated purchase flow on Dell.com via the guest checkout route — add products, fill shipping + payment, submit — reliably, despite anti-bot detection, iframe payment widgets, and shifting overlays.
The solution
A Python/Selenium orchestrator (main2.py) that runs add-to-cart + guest checkout from a single CLI, with modular --step atc/--step checkout, shipping/payment from .env/JSON/demo, a humanization layer, iframe-aware payment form filling, overlay dismissal, BrightData SSL cert handling, MongoDB run history, and automatic failure artifacts (DOM snapshot + failed_steps.json).
Highlights
- Humanization layer defeats Dell's anti-bot fingerprinting
- Iframe + Shadow DOM traversal for Dell's payment widget
- Automatic failure artifacts cut debugging from hours to minutes
- Modular CLI steps (atc / checkout / full)
The challenge
Dell detects webdriver flags, uniform typing speeds, and rapid scrolling and throws CAPTCHA/SSL interstitial.
Dedicated humanization layer: type_slowly() keystroke jitter, human_pause() normal-distributed sleeps, human_scroll() simulating reading, fingerprints.py locking a consistent profile, and bypass_ssl_interstitial_if_present() clicking through.
Dell's credit-card fields are inside nested iframes that vary by locale and page version — naive find_element fails.
switch_into_context_with(predicate) walks all frames until one contains a matching element; deep_find() recurses Shadow DOMs; every field wrapped with ensure_visible_and_focus + js_set_value() fallback.
Dell injects promotional modals, chat widgets and cookie banners that intercept clicks.
try_dismiss_overlays() runs before every critical click; click_safely() catches ElementClickInterceptedException and retries after an overlay sweep.
Silent failures on remote machines need full DOM state for post-mortem.
save_artifacts() dumps DOM snapshot HTML plus failed_steps.json entries with step/URL/selector/error — repo already contains artifacts showing the mechanism worked in real runs.
What was delivered
- main2.py CLI orchestrator
- dell_guest_checkout.py core flow
- actions.py + utils.py humanized action layer
- shipping_demo.py + payment_demo.py demo profiles
- fingerprints.py consistent browser profile
- integrations/db.py Mongo connector
- BrightData SSL cert bundle + README
- requirements.txt pinned deps
Results
ATC → shipping → payment → submit
Flow
4 (.env/JSON/demo/CLI)
Input modes
HTML + JSON artifacts
Observability
MongoDB
History
What it taught me
- Defensive click/overlay handling matters as much as the happy path — 80% of flakes come from modals at the wrong moment
- Failure artifacts (HTML + JSON step log) cut debugging from hours to minutes when site layout shifts
- Swappable shipping/payment profiles (.env/JSON/demo) keep the same code safe in dev and real runs
