Driver manager logs can be used to get console logs from browser and it will help to identify errors appears in console.
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
public List<LogEntry> getBrowserConsoleLogs()
{
LogEntries log= driver.manage().logs().get("browser")
List<LogEntry> logs=log.getAll();
return logs;
}