Sauce Labs
All commands are only supported on Chrome using Sauce Labs Extended Debugging capabilities. You can enable these by setting the following Sauce options:
{
browserName: 'Chrome',
browserVersion: 'latest',
platformName: 'Windows 10',
'sauce:options': {
extendedDebugging: true
}
}
getPageLogs
Get webpage specific log information based on the last page load.
Sauce Labs command. More details can be found in the official protocol docs.
Usage
browser.getPageLogs(type)
Parameters
Name | Type | Details |
---|---|---|
type | string | log type (e.g. sauce:network', 'sauce:performance') |
Examples
// Get Network Logs
console.log(browser.getPageLogs('sauce:network'));
/**
* outputs:
* [{
* "url": "https://app.saucelabs.com/dashboard",
* "statusCode": 200,
* "method": "GET",
* "requestHeaders": {
* ...
* },
* "responseHeaders": {
* ...
* },
* "timing": {
* ...
* }
* }, {,
* ...
* }]
*/
// Get Performance Logs (needs capturePerformance capability see: https://wiki.saucelabs.com/display/DOCS/Measure+Page+Load+Performance+Using+Test+Automation#MeasurePageLoadPerformanceUsingTestAutomation-EnableYourScript)
console.log(browser.getPageLogs('sauce:performance'));
/**
* outputs:
* {
* "speedIndex": 1472.023,
* "timeToFirstInteractive": 1243.214,
* "firstMeaningfulPaint": 892.643,
* ...
* }
*/