Is there a way to capture network logs while running an automated test on Firefox? I tried to use
LogEntries logs = driver.manage().logs().get(LogType.BROWSER);
This does not work.
CodePudding user response:
Try this
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "FFLogs.txt");
After refreshing the project folder, we shall get the FFLogs.txt file where the logs shall be captured.
OR.... Follow the official docs
Official Docs: https://firefox-source-docs.mozilla.org/testing/geckodriver/geckodriver/TraceLogs.html
Here's the Java example in the documentation above. You can specify the logging level by including it in the .setLogLevel
method of FirefoxOptions
class.
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(FirefoxDriverLogLevel.TRACE);
WebDriver driver = new FirefoxDriver(options);
You can refer to the documentation for the different levels of logging
.
CodePudding user response:
you can use: System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "FFLogs.txt");
After refreshing the project folder, we shall get the FFLogs.txt file where the logs shall be captured.