The 7 Golden Rules of Selenium with Python
1. Never use time.sleep: Always use explicit condition synchronization (WebDriverWait).
2. Isolate Every Test: Never let tests depend on the execution order or shared state of previous tests.
3. Encapsulate in Page Objects: Keep locators and page mechanics inside page classes.
4. Assert in Tests: Page objects provide state; test functions assert outcomes.
5. Always Clean Up with quit(): Use fixtures and context managers to guarantee teardown.
6. Prefer By.ID and unique data-testid attributes: Avoid brittle absolute XPaths.
7. Write Pythonic Code: Use list comprehensions, f-strings, and type hints for readability.