Enable Extended Debugging in your Selenium test script to collect console logs and HTTP Archive (HAR) files generated during testing for use in diagnosing flaky tests or performance degradation.
Extended Debugging generates additional assets that impact test performance and is not intended for everyday testing.
- Google Chrome (no older than 3 versions from latest) as the test browser or
- Firefox browser (versions 53 and above)
Extended Debugging is not supported with Headless.
To generate the JS console logs and HAR files, add the
extendedDebugging capability to the desired capabilities of your test and set it to true. Here are some example scripts in both W3C WebDriver Protocol and legacy JSON Wire Protocol that show Extended Debugging enabled.
For more information and additional examples, see our Extended Debugging Example GitHub repo.
When a test with extended debugging enabled completes, you can access the logs and files through the Sauce Labs application or with the REST API.
If you're testing on a Firefox browser, edit the Firefox
about:config file to configure your profile as follows to allow Extended Debugging:
The JS console collects security errors, warnings, and messages that are explicitly logged by the browser. You can use these logs to find out which components of your web application failed to load or ran into an error, what warnings were logged by the browser, and get more information about application performance. The console log information is associated with the URL where it occurred, and is composed of four types of information: Log, Info, Warning, and Error. In this example, you can see how an error was generated for the URL
https://pbs.twimg.com/profile_images/477099293250052097/fMFjb8gu_400x400.jpeg when a resource failed to load:
Access the JS Console logs (
console.json) under the Logs tab of the Test Details page in the Sauce Labs application, or through the REST API by calling the assets endpoint:
HTTP Archive Format (HAR) files collect all network requests and responses made and received by the browser during testing. HAR files offer useful debugging information, such as:
- Identifying browser requests that time out
- Pinpointing requests slowing down the loading process
- Locating faulty API calls
You a HAR viewer to read HAR files. Sauce Labs provides a React Network Viewer HAR viewer for your convenience. For step-by-step usage instructions, see our Visualize HAR Files with the New React Network Viewer blog article.
Alternatively, some other commonly used HAR viewers include:
To download HAR files from the Sauce Labs application:
- From your Sauce Labs dashboard, navigate to Live > Test Results.
- Select the applicable test.
- Click the Metadata tab.
You can also download a HAR file programmatically using the following API request: