Geek Culture
Published in

Geek Culture

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

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.




A new tech publication by Start it up (

Recommended from Medium

Advantages of API First Approach In App Development

Ambab- Advantages-of-API-First

The Framework of Building a Computer From Scratch

How Do Open Source Companies Make Money?

Coding Bootcamps vs. Computer Science Degrees: What Employers Want and Other Perspectives

Javascript Testing in 2019

Building a health endpoint

Search & Sort: A Algorithm Ride

Cocoapods : What It Is And How To Install?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Dhoundiyal

Abhishek Dhoundiyal

Principal QA Manager at MakeMyTrip

More from Medium

How to actually create a Github repository for your existing project

JavaScript vs Nodejs: The Key Differences That You Must Know

Github Branching

Browser Automation for Everyone: Free Tools You Can Use RIGHT NOW To Get Work Done Fast