@@ -0,0 +1,2720 @@
+package com.seleniumtests.core;%0A%0Aimport com.seleniumtests.webelements.HtmlElement;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.WebElement;%0Aimport org.openqa.selenium.logging.LogEntries;%0Aimport org.openqa.selenium.logging.LogEntry;%0Aimport org.openqa.selenium.logging.LogType;%0Aimport org.openqa.selenium.support.events.AbstractWebDriverEventListener;%0A%0Aimport java.util.logging.Level;%0A%0A/**%0A * Created by tarun on 12.07.16.%0A */%0Apublic class CustomEventListener extends AbstractWebDriverEventListener %7B%0A%0A%0A    private void logErrors(String url, LogEntries logEntries) %7B%0A        if (logEntries.getAll().size() == 0) %7B%0A            TestLogging.log(%22********* No Severe Error on Browser Console *********%22, true);%0A        %7D else %7B%0A            for (LogEntry logEntry : logEntries) %7B%0A                if (logEntry.getLevel().equals(Level.SEVERE)) %7B%0A                    TestLogging.log(%22URL: %22+url);%0A                    TestLogging.logWebStep(%22Time stamp: %22 + logEntry.getTimestamp() + %22, %22 +%0A                            %22Log level: %22 + logEntry%0A                            .getLevel() + %22, Log message: %22 + logEntry.getMessage(), true);%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A    private void logErrors(String event, WebElement element, LogEntries logEntries) %7B%0A        if (logEntries.getAll().size() == 0) %7B%0A            TestLogging.log(%22********* No Severe Error on Browser Console *********%22, true);%0A        %7D else %7B%0A            for (LogEntry logEntry : logEntries) %7B%0A                if (logEntry.getLevel().equals(Level.SEVERE)) %7B%0A                    TestLogging.log(%22Sever Console Error on Browser %22+event+%22 clicking %22 +%0A                            %22element: %22 +((HtmlElement)element).getBy());%0A                    TestLogging.logWebStep(%22Time stamp: %22 + logEntry.getTimestamp() + %22, %22 +%0A                            %22Log level: %22 + logEntry%0A                            .getLevel() + %22, Log message: %22 + logEntry.getMessage(), true);%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A    private LogEntries getBrowserLogs(WebDriver webDriver) %7B%0A        return webDriver.manage().logs().get(LogType.BROWSER);%0A    %7D%0A%0A    @Override%0A    public void beforeNavigateTo(String url, WebDriver webDriver) %7B%0A        logErrors(url, getBrowserLogs(webDriver));%0A%0A    %7D%0A%0A    @Override%0A    public void afterNavigateTo(String url, WebDriver webDriver) %7B%0A        logErrors(url, getBrowserLogs(webDriver));%0A    %7D%0A%0A    @Override%0A    public void beforeClickOn(WebElement element, WebDriver driver) %7B%0A        logErrors(%22before%22, element, getBrowserLogs(driver));%0A    %7D%0A%0A    @Override%0A    public void afterClickOn(WebElement element, WebDriver driver) %7B%0A        logErrors(%22after%22, element, getBrowserLogs(driver));%0A    %7D%0A%7D%0A

add CustomEventListener