I want to capture log for any js event trigger or error Using selenium and java.Any type of help or suggestion will be appreciated? I tried this code but it's not working properly
public void HomePageConsole () throws InterruptedException {
driver.findElement(By.id("drop-down")).click();
driver.findElement(By.xpath(".//*[@id='js-top-currency']/li[4]/a")).click();
LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER);
for (LogEntry entry : logEntries) {
// System.out.println(new Date(entry.getTimestamp()) + " " + entry.getLevel() + " " + entry.getMessage());
//System.out.println("Checking ExitUnit: 5th Line will be true ");
Thread.sleep(10000);
System.out.println("Exit Unit Open : "+entry.getMessage().contains("has been triggered!"));
}}