Browser Metrics
Monitor and optimize browser performance by capturing CPU and memory metrics for desktop browsers.
Understand the performance footprint of your web application during automated tests to deliver fast, responsive experiences. With Browser Metrics on BrowserStack Automate, track CPU and memory usage across popular browsers and operating systems to catch performance regressions and resource bottlenecks.
Use cases
Browser Metrics lets you:
- Detect CPU-intensive operations that slow down your application.
- Track memory usage over time to identify leaks or inefficient memory use.
- Improve app responsiveness by diagnosing and optimizing slow pages.
Browser profiling
Browser profiling helps you track where your web application is making inefficient use of resources, such as the CPU, and memory.
Supported browsers:
The following Browser-OS combination is supported for browser metrics:
Browsers | Description |
---|---|
Chrome (v89+), Edge (v89+) | Windows, macOS |
Safari (v14+) | macOS |
Enable Browser Metrics
To enable Browser Metrics for your test builds, set the following capability to true
in your test script:
Capability | Description | Values |
---|---|---|
browserProfiling |
Enable detailed browser performance profiling. |
true , false Default: false |
Example
Depending on your preferences, use the capability as below:
- Selenium 4 W3C
- Selenium Legacy JSON
Set the browserProfiling
in your code snippet as shown in the following sample code:
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("browserProfiling", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
'bstack:options' : {
"browserProfiling" : "true",
}
}
desired_cap = {
'bstack:options' : {
"browserProfiling" : "true",
}
}
capabilities = {
'bstack:options' => {
"browserProfiing" => "true",
}
}
Dictionary<string, object> bstackOptions = new Dictionary<string, object>();
ChromeOptions capabilities = new ChromeOptions();
bstackOptions.Add("browserProfiling", "true");
Set the browserstack.browserProfiling
in your code snippet as shown in the following sample code:
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("browserProfiling", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
'bstack:options' : {
"browserProfiling" : "true",
}
}
desired_cap = {
'bstack:options' : {
"browserProfiling" : "true",
}
}
capabilities = {
'bstack:options' => {
"browserProfiing" => "true",
}
}
Dictionary<string, object> bstackOptions = new Dictionary<string, object>();
ChromeOptions capabilities = new ChromeOptions();
bstackOptions.Add("browserProfiling", "true");
View performance metrics
To access Browser Profiling, follow these steps:
- Navigate to the Automate dashboard.
- Locate the desired build.
You can find the build in the builds list or you can search for the build. - Click the build and then click the desired session.
- Select the Performance tab to download the browser metrics.
Metrics shown
Browser Metrics displays the following graphs and metrics:
- CPU usage: Tracks CPU utilization (%) during the test session. High CPU usage may indicate inefficient scripts or rendering bottlenecks.
- Memory usage: Monitors browser memory consumption (in MB) to detect memory leaks or high usage patterns across test runs.
Each chart provides a timeline view so you can correlate usage spikes with specific steps or events in your test.
Metrics are sampled periodically during the test session. Short test runs may not capture sufficient data for accurate analysis.
Browser profiling REST API
Refer to the Browser metrics REST API docs.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!