Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always log Browser's console messages/errors on failed test #199

Open
mreiche opened this issue Jan 24, 2022 · 1 comment
Open

Always log Browser's console messages/errors on failed test #199

mreiche opened this issue Jan 24, 2022 · 1 comment
Labels
enhancement New feature or request selenium4 Feature/issue to support Selenium 4

Comments

@mreiche
Copy link
Collaborator

mreiche commented Jan 24, 2022

Implement reading console log messages that comes from the browser when a test failed.

Proposal

public List<String> getJavaScriptLog() {
    List<String> list = new LinkedList<>();
    LogEntries logEntries = this.getWebDriver().manage().logs().get(LogType.BROWSER);
    for (LogEntry entry : logEntries) {
        list.add(new Date(entry.getTimestamp()) + " " + entry.getLevel() + " " + entry.getMessage());
    }
    return list;
} 
@mreiche mreiche added the enhancement New feature or request label Jan 24, 2022
@martingrossmann martingrossmann added the selenium4 Feature/issue to support Selenium 4 label Jan 24, 2022
@martingrossmann
Copy link
Contributor

With Selenium 4 we get native support of Chrome DevTools: https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request selenium4 Feature/issue to support Selenium 4
Projects
None yet
Development

No branches or pull requests

2 participants