I am using this code to detect console errors logged while executing automated UI tests with ChromeDriver:
public static List<LogEntry> getJavaScriptErrors(Level level) {
return getDriver().manage().logs().get(LogType.BROWSER).filter(level);
}
Prior to executing a step I would like to clear the console log, so I only see errors which were caused by the particular action I am looking to test and not earlier errors during the test setup.
How can I explicitly clear errors from logs?