Selenium + Python · Lesson 42 of 43
Module 42: Selenium Debugging
Your task
Implement format_console_log(level, message):
Write it in the editor, then press Check answer (Ctrl + Enter).
breakpoint() directly inside your test code to drop into an interactive PDB session while the browser remains open.for entry in driver.get_log("browser"):
if entry["level"] == "SEVERE":
print(f"Browser Console Error: {entry['message']}")When an automated test fails unexpectedly, diagnosing it quickly saves countless hours. In this lesson, you will master reading browser console logs, using Python's built-in breakpoint(), and inspecting dynamic elements. Let's master debugging!
Part of the Selenium + Python course (Selenium with Python). Practice this concept live in the Selenium Online Compiler or explore our free automation practice form.
Calling breakpoint() halts Python execution and gives you an interactive shell where you can query driver.page_source or inspect the open browser window.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___