2

I'm currently trying to get a test running on Katalon Studio, and the specific outcome is determined by certain messages showing up in the browser console. I've managed to extract the console logs and can parse them easily enough, but I'm currently only being given the Severe and Warning messages, while the information I need is in the Info messages.

I've managed to figure out what settings I need to apply, but not in a format that I can easily apply via Katalon. The settings I need are, I believe, as follows:

DesiredCapabilities caps = DesiredCapabilities.chrome()
LoggingPreferences logPrefs = new LoggingPreferences()
logPrefs.enable(LogType.BROWSER, Level.INFO)
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs)

Specifically, I need to set the log level to INFO. However, I can't figure out how to correctly apply this through Katalon's Execution settings, which take on a rather different format to most of the code-based variants I've seen elsewhere. I've currently got{"CHROME_DRIVER":{"LoggingPrefs":{"LogType":"BROWSER","Level":"INFO"}}} set in the com.kms.katalon.core.webui.chrome preferences file, and have tried different variants of this, but to no avail.

Just in case this is an extraction problem rather than a setup issue, I'm currently obtaining the logs as follows:

I obtain the webdriver using DriverFactory.getWebDriver(), and extract the logs using LogEntries logs = driver.manage().logs().get("browser")

How do I get the Info-level logs out of this?

Thanks for your time and help,

1 Answers1

0

You can use KeywordLogger.

Following class is needed: import com.kms.katalon.core.logging.KeywordLogger

KeywordLogger log = new KeywordLogger()
log.logInfo("yourLogMsg")

You can use logFailed, logWarning, etc. too.

plaidshirt
  • 3,973
  • 12
  • 55
  • 140