🚨 Troubleshooting

Troubleshooting: 🚨 Common Errors & How to Fix Them Wrong locator, element not yet loaded (dynamic content), or element is inside an iframe.

🚨 Common Errors & How to Fix Them

Wrong locator, element not yet loaded (dynamic content), or element is inside an iframe.

The DOM was refreshed (page reload, AJAX, React re-render) and the old element reference is no longer valid.

WebDriverWait timed out before the condition was met. Element never appeared or locator is wrong.

Another element (overlay, modal, cookie banner, sticky nav) is on top of the target element.

The fixture is not defined in conftest.py or the scope is incompatible.

FAILED = assertion failed (test ran but expected result not met). ERROR = unexpected exception (in setup/teardown or test body).

🎬 How to Read a Traceback? Start from the BOTTOM, Not the Top

Bottom: Actual Error + Line

Exact Location Found

A traceback looks like a scary wall of red text at first glance. But there IS an order to it, and that order works on the SAME logic as a Java stack trace. This film watches how to read it in the right order.

Step 1 — the traceback's VERY TOP starts with "Traceback (most recent call last):" and shows the FIRST step of the call chain — usually the test function itself. Starting here sends you down the WRONG path, because this line is not the PROBLEM, just the STARTING point.

Step 2 — the MIDDLE lines show the call chain: `test_login` → `login_page.submit()` → `wait_for_element()`, tracing the path deeper and deeper INTO the code. This ANSWERS "where did the error come FROM" but not yet "what IS the actual error."

Step 3 — the VERY BOTTOM of the traceback shows the ACTUAL error, the exact line number, and the exception type: `TimeoutException: element not found within 10s`. The "start here" rule for QA engineers is EXACTLY this line — you FIND the root cause here.