Need some help in knowing why I am seeing different console output/logs during runtime and debug time in the automation framework. Using selenium dev tools dependency, I have managed to capture response 302 in debug mode, but 302 do not getting displayed in console/log during runtime mode. Seems I am missing some configuration in chrome dev tools to enable network logs using selenium devtools during runtime. Not sure what and where.
In Debug mode, I see following output showing 302 but not during runtime
INFO: <- {"method":"Network.responseReceivedExtraInfo","params":{"requestId":"BABA0D5682BA50EB143A5DF45AD69CBB","blockedCookies":[],"headers":{"Access-Control-Allow-Origin":"*","Cache-Control":"no-cache, no-store, must-revalidate, pre-check=0, post-check=0","Content-Length":"0","Date":"Mon, 15 Jan 2024 01:43:46 GMT","Expires":"-1","Location":"/update-action-prf/qaa_wf_lyd_payables_tenant/paymentrequest- confirm/ckcrN3dMWEVYRU5YQVBxZjFTMHJSdG1XRHlrSjQrZTJSQWNWQzRZZTZ6Yz0%3D","Pragma":"no-cache","X-Robots-Tag":"noindex","X-XSS-Protection":"1; mode=block"},"resourceIPAddressSpace":"Private","statusCode":302,"headersText":"HTTP/1.1 302 Found\r\nContent-Length: 0\r\nDate: Mon, 15 Jan 2024 01:43:46 GMT\r\nAccess-Control-Allow-Origin: *\r\nCache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0\r\nExpires: -1\r\nLocation:
In terms of logging, I have following config in serenity.config file
perfLoggingPrefs {
enableNetwork: true,
enablePage: true,
traceCategories: "browser,devtools.timeline,devtools"
}
excludeSwitches = ["enable-automation", "load-extension"]
}
"goog:loggingPrefs" {
browser = ALL
driver = ALL
performance = ALL
}
and ChromeOptions.java class contains following code
@Override
public void apply(EnvironmentVariables environmentVariables, ChromiumOptions\<?\> options) {
HashMap\<String, Object\> chromePrefs = new HashMap\<String, Object\>();
chromePrefs.put("download.default_directory", DOWNLOAD_FOLDER);
chromePrefs.put("profile.default_content_setting_values.javascript", ENABLEJS);
options.setExperimentalOption("prefs", chromePrefs);
}
Comparing runtime and debugger console, have noticed following INFO gets logged only during debug time but not during runtime. What config am I missing here? Any help on this will be very much appreciated?
Jan 14, 2024 2:40:44 AM org.openqa.selenium.devtools.Connection
handle
INFO: Method Network.requestWillBeSent called with 2 callbacks
available
Jan 14, 2024 2:40:44 AM org.openqa.selenium.devtools.Connection
lambda$handle$3
INFO: Matching Network.requestWillBeSent with
Network.responseReceived
Jan 14, 2024 2:40:44 AM org.openqa.selenium.devtools.Connection
lambda$handle$3
INFO: Matching Network.requestWillBeSent with Network.requestWillBeSent
So far, I have tried this
- Making sure all browser, performance and driver logs were enabled and set to ALL in serenity.conf
- Try running test in browser mode as well as in headless mode
- Adding thread.sleep just in case if there was not enough time to log the entries
- Adding --verbose in goog:chromeOptions in serenity.conf