How to enable Network Logs to Selenium Cloud Tests?
Overview
In this tutorial, we will learn the steps to enable Network logs to Selenium Cloud Tests using LambdaTest cloud service.
Tools used
Tools and services used in this tutorial:
- Latest Selenium Webdriver for Java
- LambdaTest Cloud Service.
- Eclipse IDE, TestNG Framework
Network Logs
Automation logs enable the Engineer or Tester to know more information or to debug automation test failures. QA Lab tests mostly do not involve network factor when we run tests on local QA Selenium Grid, or on in-house staging environment grids.
In reality, production environment where the web app lives involves network payload between the web app and the end user. So, its important to know or enable network logs during the tests.
Enable Network Logs
When network logs are not set to the automation capabilities, we can notice empty network tabs in the automation logs.
It is simple to enable network logging with DesiredCapabilities(). We can set flags to enable console, network, visual and video logs for the cloud tests.
Sample code listing to enable logs to the cloud test:
DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platform", "Windows 10"); capabilities.setCapability("browserName", "Chrome"); capabilities.setCapability("version", "87.0"); capabilities.setCapability("resolution","1024x768"); capabilities.setCapability("build", "TestingDocs Test"); capabilities.setCapability("name", "Sample Test with Logs enabled"); capabilities.setCapability("network", true); // This is to enable network logs capabilities.setCapability("visual", true); // This is to enable screenshots capabilities.setCapability("video", true); // This is to enable video recording capabilities.setCapability("console", true); // This is to capture console logs
Verification
Cloud test run using the capabilities set will display the automation logs. Log on to the LambdaTest cloud service account.
Click on the Automation Dashboard.
Select the automation tests that have logs enabled.
Check the Automation Logs >> Network tab.
We can now check the logs for different components of the web application.
- JavaScript
- Images
- CSS, etc
LambdaTest is a cloud based a SaaS (Software as a Service) platform, To know more information visit the official website: