Capturing browser logs with Selenium WebDriver using Java

后端 未结 9 1987
闹比i
闹比i 2020-11-28 03:01

Is there a way to capture browser logs while running automated test cases with Selenium? I found an article on how to capture JavaScript errors in Selenium. But that is just

9条回答
  •  感情败类
    2020-11-28 03:46

    Starting with Firefox 65 an about:config flag exists now so console API calls like console.log() land in the output stream and thus the log file (see (https://github.com/mozilla/geckodriver/issues/284#issuecomment-458305621).

    profile = new FirefoxProfile();
    profile.setPreference("devtools.console.stdout.content", true);
    

提交回复
热议问题