Seeking advice on capturing logs for any JavaScript event triggers or errors using Selenium and Java. Any suggestions would be greatly appreciated. I have attempted the following code, but it does not seem to be working as intended:
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!"));
}}