This is part 2 of our series, and this time we focus on edge cases readers asked about. Most flaky Selenium tests are timing problems in disguise. The element exists, just not yet, and a fixed sleep is either too short on a slow day or wastes time on a fast one.
Step by step
Character encodings still cause trouble. Decode responses using the charset the server declares, and normalise text before comparing or storing it.
Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot.
Treat HTTP 429 responses as a signal, not an obstacle. Read the Retry-After header, back off, and resume at a slower pace.
A practical approach
Store raw responses alongside parsed output while you are developing. When a parser breaks, you can replay the saved HTML instead of hitting the site again.
Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.
Key takeaway
Replace sleeps with explicit waits for a specific condition: element visible, text present, or network idle, with a sensible timeout.