How only 1 thing that will change the way you debug your Selenium Automation Report

Abhishek Dhoundiyal
Jun 9, 2021 · 3 min read

Common mistakes & Creating powerful Debuggable report for Selenium

When you create test automation with selenium, you only rely on the screenshot and the errors mention on the report but what would happen if you get the below scenarios. 🤔


  1. You got a selenium test report on email with 1 or more error.
  2. You have checked the attached screenshot and found a blank page.
  3. you checked the exception and it was either AssertionError, NoSuchElementException or TimeoutException.

Error on Report Level:

AssertionError Image
NoSuchElementException Image

Are you able to identify the issue???? 🤔

Then how would you identify the issue? 🤔

If not what is the use of the automation report then?

All the automation engineers forget when writing their test scripts. They add all the fashionable and good looking reports but they forget the basic fundamentals.

Adding console and network logs are also important to debug your issue further.

Let’s imagine if you have the console or network logs as below!!! How easy it would be for you to debug the issue. It clearly indicates that the issue is with the API (As it is giving 502 bad gateway or might be some other issue in your case).

Now let's learn how to obtain the logs!!!

How to obtain native logger in Selenium WebDriver:

Enable Logging on chrome level:

ChromeOptions chromeOptions = new ChromeOptions();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.PERFORMANCE, Level.SEVERE);
logPrefs.enable(LogType.BROWSER, Level.SEVERE);
logPrefs.enable(LogType.DRIVER, Level.SEVERE);
chromeOptions.setCapability( "goog:loggingPrefs", logPrefs );

Capturing browser logs with Selenium


* get logger: Get log from browser console
* @param driver
public static void getLogger(WebDriver driver, String url) {
try {
String formattedDate = new SimpleDateFormat(DATE_FORMAT).format(new Date());
LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER);
for (LogEntry entry : logEntries) {
String debugLevel = entry.getLevel().toString().trim();
String debugMessage = entry.getMessage().trim();
APP_LOGS.debug(formattedDate + LINE_BREAK + debugLevel + LINE_BREAK + debugMessage);
} catch (Exception ex) {



  1. Take Screenshots For Every Failure
  2. Capturing error with proper messaging.
  3. Logging Console Log For Every Failure.

Geek Culture

Proud to geek out. Follow to join our +1.5M monthly readers.