Selenium + Java · Lesson 43 of 44
Module 43: Selenium Debugging
Your task
Implement formatLogEntry:
Write it in the editor, then press Check answer (Ctrl + Enter).
$x("//button[text()='Submit']")$$("button.submit-btn")import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogType;
LogEntries logs = driver.manage().logs().get(LogType.BROWSER);
logs.forEach(entry -> System.out.println(entry.getLevel() + ": " + entry.getMessage()));When tests fail, finding the root cause quickly saves hours of frustration. In this lesson, you will master browser developer tools inspection, evaluating XPath in the Console, capturing browser logs, and diagnosing timing discrepancies. Let's master debugging!
Part of the Selenium + Java course (Selenium with Java). Practice this concept live in the Selenium Online Compiler or explore our free automation practice form.
You can set an IDE breakpoint in IntelliJ / Eclipse, or temporarily invoke a debugger statement.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___