sitespeedio / sitespeedio/sitespeed.io

VisualMetrics not capturing metrics for all transactions. Reporting 0ms for few transactions

Open
#4,443 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5k
Forks
624
Avg merge
4h 8m
Merged PRs (30d)
2

Description

Your question

Tool versions - sitespeed 35.7.2 , browsertime - 23.4.3 ,coach -8.0.2.
Browser used - Chrome 131.0.6778.109
OS used - Windows 11. Not using docker
URL used -https://cdev4-dev-ed.develop.lightning.force.com iteration
Issue - VisualMetrics doesnt appear for few transactions. It shows 0ms. Please let us know how to resolve this.
Script (without username /password) is below
Execution logs - Highlighted transaction that are reporting visual metrics with 0ms below.
Script -
/**

  • @param {import('browsertime').BrowsertimeContext} context
  • @param {import('browsertime').BrowsertimeCommands} commands
    */
    export default async function (context, commands) {
    const seleniumWebdriver = context.selenium.webdriver;
    const By=seleniumWebdriver.By;
    const seleniumDriver = context.selenium.driver;
    const Key={RETURN: '\uE006'}

/Launch/
await commands.navigate('https://cdev4-dev-ed.develop.lightning.force.com');

/Login*/
const usernameElement=await seleniumDriver.findElement(By.xpath('//input[@type="email" and @name="username"]'));
usernameElement.sendKeys('');
const passwordElement=await seleniumDriver.findElement(By.xpath('//input[@type="password" and @name="pw"]'));
passwordElement.sendKeys('
');
const loginElement= await seleniumDriver.findElement(By.xpath('//input[@type="submit" and @value="Log In"]'));
await commands.measure.start('Login');
await loginElement.click();
await commands.wait.byPageToComplete();
await commands.measure.stop();

/* Change Console*/
await commands.wait.byTime(2000);
const waffElement=await seleniumDriver.findElement(By.xpath('//div[@class="slds-icon-waffle"]'));
waffElement.click();
await commands.wait.byTime(2000);
const SalesconsoleElement=await seleniumDriver.findElement(By.xpath('//span/p[text()="Sales Console"]'));
SalesconsoleElement.click();
await commands.measure.start('changeconsole');
await commands.wait.byPageToComplete();
await commands.measure.stop();

/* Account search*/
await commands.wait.byTime(5000);
const Searchtextarea=await seleniumDriver.findElement(By.xpath('//button[@aria-label="Search"]'));
Searchtextarea.click();
await commands.wait.byTime(2000);
const Searchval1=await seleniumDriver.findElement(By.xpath('//span[@title="TestAccount01"]'));
Searchval1.click();
await commands.measure.start('AccounttSearch');
//await commands.wait.byXpath('//h2/a[text()="Contacts"]',20000);
await commands.wait.byPageToComplete();
await commands.measure.stop();

/Contact Search/
await commands.wait.byTime(5000);
const glblSearch=await seleniumDriver.findElement(By.xpath('//button[@aria-label="Search"]'));
glblSearch.click();
await commands.wait.byTime(1000);
const Searchval=await seleniumDriver.findElement(By.xpath('//span[@title="Test Perf01"]'));
Searchval.click();
await commands.measure.start('ContactSearch');
await commands.wait.byPageToComplete();
await commands.measure.stop();

/*New case*/

const casebutton= await seleniumDriver.findElement(By.xpath('//button[@name="Global.NewCase"]'));
casebutton.click();
await commands.measure.start('Newcase');
await commands.wait.byPageToComplete();
await commands.measure.stop();

/Cancel/
await commands.wait.byTime(2000);
const cancelval=await seleniumDriver.findElement(By.xpath("//button[@class='slds-button slds-button_neutral cuf-publisherCancelButton uiButton--default uiButton--brand uiButton']"));
cancelval.click();
await commands.measure.start('Cancel');
await commands.wait.byPageToComplete();
await commands.measure.stop();

 /****Logout****/  

const btnUserProfile=await seleniumDriver.findElement(By.xpath('//button[contains(@class,"userProfile-button")]'));
btnUserProfile.click();
await commands.wait.byTime(1000);
const btnLogout=await seleniumDriver.findElement(By.xpath('//a[text()="Log Out"]'));
btnLogout.click();
await commands.measure.start('Logout');
await commands.wait.byPageToComplete();
await commands.measure.stop();

}

Execution
Ran the test without skipping HAR . Following are the execution log. Few transactions highlighted are reported as 0ms.

C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\bin>node sitespeed.js withsel1.mjs --multi --browsertime.iterations 1 --visualMetrics

(node:24460) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
[2025-02-13 12:02:18] INFO: Versions OS: win32 10.0.22631 nodejs: v21.1.0 sitespeed.io: 35.7.2 browsertime: 23.4.3 coach: 8.0.2
[2025-02-13 12:02:19] INFO: Running tests using Chrome - 1 iteration(s)
 
DevTools listening on ws://127.0.0.1:9222/devtools/browser/892fda64-3297-41a8-9460-4a1a242cb688
[24124:16732:0213/120221.787:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1
[24124:16732:0213/120222.093:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1
[24124:16732:0213/120222.139:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1
[2025-02-13 12:02:23] INFO: Navigating to url https://cdev4-dev-ed.develop.lightning.force.com iteration 1
Created TensorFlow Lite XNNPACK delegate for CPU.
Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors (tensor#-1 is a dynamic-sized tensor).
[2025-02-13 12:02:30] INFO: Start to measure Login
[2025-02-13 12:02:44] INFO: Take after page complete check screenshot
[2025-02-13 12:02:46] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:02:47] INFO: Take largest contentful paint screenshot
[2025-02-13 12:02:53] INFO: Start to measure changeconsole
[2025-02-13 12:03:03] INFO: Take after page complete check screenshot
[2025-02-13 12:03:04] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:03:05] INFO: Take largest contentful paint screenshot
[2025-02-13 12:03:15] INFO: Start to measure AccounttSearch
[2025-02-13 12:03:24] INFO: Take after page complete check screenshot
[2025-02-13 12:03:25] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:03:26] INFO: Take largest contentful paint screenshot
[2025-02-13 12:03:35] INFO: Start to measure ContactSearch
[2025-02-13 12:03:44] INFO: Take after page complete check screenshot
[2025-02-13 12:03:45] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:03:46] INFO: Take largest contentful paint screenshot
[2025-02-13 12:03:49] INFO: Start to measure Newcase
[2025-02-13 12:03:55] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view has been tested before within the same run, it will get an extra query parameter named browsertime_run. Make sure to use alias to keep track of the URLs
[2025-02-13 12:03:58] INFO: Take after page complete check screenshot
[2025-02-13 12:03:59] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:04:00] INFO: Take largest contentful paint screenshot
[2025-02-13 12:04:05] INFO: Start to measure Cancel
[2025-02-13 12:04:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view has been tested before within the same run, it will get an extra query parameter named browsertime_run. Make sure to use alias to keep track of the URLs
[2025-02-13 12:04:13] INFO: Take after page complete check screenshot
[2025-02-13 12:04:14] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:04:16] INFO: Take largest contentful paint screenshot
[2025-02-13 12:04:19] INFO: Start to measure Logout
[2025-02-13 12:04:29] INFO: Take after page complete check screenshot
[2025-02-13 12:04:30] INFO: Take cumulative layout shift screenshot
[2025-02-13 12:04:31] INFO: Take largest contentful paint screenshot
[24448:22940:0213/120434.487:ERROR:command_buffer_proxy_impl.cc(331)] GPU state invalid after WaitForGetOffsetInRange.
[2025-02-13 12:04:36] INFO: Use the visual metrics portable script
[2025-02-13 12:04:36] INFO: Get visual metrics from the video
[2025-02-13 12:04:44] INFO: Use the visual metrics portable script
[2025-02-13 12:04:44] INFO: Get visual metrics from the video
[2025-02-13 12:04:50] INFO: Use the visual metrics portable script
[2025-02-13 12:04:50] INFO: Get visual metrics from the video
[2025-02-13 12:04:55] INFO: Use the visual metrics portable script
[2025-02-13 12:04:55] INFO: Get visual metrics from the video
[2025-02-13 12:04:59] INFO: Use the visual metrics portable script
[2025-02-13 12:04:59] INFO: Get visual metrics from the video
[2025-02-13 12:05:03] INFO: Use the visual metrics portable script
[2025-02-13 12:05:03] INFO: Get visual metrics from the video
[2025-02-13 12:05:07] INFO: Use the visual metrics portable script
[2025-02-13 12:05:07] INFO: Get visual metrics from the video
[2025-02-13 12:05:12] ERROR: Could not add meta data to the HAR, miss page 3
[2025-02-13 12:05:12] ERROR: Could not add meta data to the HAR, miss page 4
[2025-02-13 12:05:12] ERROR: Could not add meta data to the HAR, miss page 5
[2025-02-13 12:05:12] ERROR: Could not add meta data to the HAR, miss page 6
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/setup/SetupOneHome/home 35 requests, TTFB: 799ms, firstPaint: 978ms, firstVisualChange: 133ms, FCP: 978ms, DOMContentLoaded: 1.62s, LCP: 2.81s, CLS: 0.0403, TBT: 2.27s, CPUBenchmark: 84ms, Load: 1.67s, speedIndex: 2.05s, visualComplete85: 4.20s, lastVisualChange: 5.67s
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/page/home 38 requests, TTFB: 382ms, firstPaint: 602ms, firstVisualChange: 44ms, FCP: 602ms, DOMContentLoaded: 801ms, LCP: 2.00s, CLS: 0.831, TBT: 522ms, CPUBenchmark: 92ms, Load: 846ms, speedIndex: 1.60s, visualComplete85: 1.87s, lastVisualChange: 3.11s
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Account/001ak00000tXpYlAAK/view 19 requests, TTFB: 382ms, firstPaint: 602ms, firstVisualChange: 79ms, FCP: 602ms, DOMContentLoaded: 801ms, LCP: 2.00s, CLS: 0.831, TBT: 1.11s, CPUBenchmark: 92ms, Load: 846ms, speedIndex: 307ms, visualComplete85: 1.03s, lastVisualChange: 1.38s
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view TTFB: 382ms, firstPaint: 602ms, firstVisualChange: 40ms, FCP: 602ms, DOMContentLoaded: 801ms, LCP: 2.00s, CLS: 0.831, TBT: 1.59s, CPUBenchmark: 78ms, Load: 846ms, speedIndex: 91ms, visualComplete85: 119ms, lastVisualChange: 277ms
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view?browsertime_run=2 TTFB: 382ms, firstPaint: 602ms### , ### firstVisualChange: 0ms, FCP: 602ms, DOMContentLoaded: 801ms, LCP: 2.00s, CLS: 0.831, TBT: 1.64s, CPUBenchmark: 97ms, Load: 846ms, speedIndex: 0ms, ### visualComplete85: 0ms, lastVisualChange: 0ms
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view?browsertime_run=3 TTFB: 382ms, firstPaint: 602ms, ### firstVisualChange: 0ms, FCP: 602ms, DOMContentLoaded: 801ms, LCP: 2.00s, CLS: 0.831, TBT: 1.64s, CPUBenchmark: 89ms, Load: 846ms, speedIndex: 0ms, ### visualComplete85: 0ms, lastVisualChange: 0ms
[2025-02-13 12:05:12] INFO: https://cdev4-dev-ed.develop.my.salesforce.com/ TTFB: 103ms, firstPaint: 246ms, firstVisualChange: 436ms, FCP: 246ms, DOMContentLoaded: 282ms, LCP: 246ms, CLS: 0.0005, TBT: 389ms, CPUBenchmark: 86ms, Load: 395ms, speedIndex: 874ms, visualComplete85: 1.26s, lastVisualChange: 1.26s
[2025-02-13 12:05:13] ERROR: Could not find the right index 3 for har for url https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view
[2025-02-13 12:05:13] ERROR: There are pages that misses data. This is in almost all cases caused by that you try to measure a page view but you do not navigate to a new page. Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:282:29)
[2025-02-13 12:05:13] ERROR: Could not generate coach data Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:533:35)
[2025-02-13 12:05:13] ERROR: Could not find the right index 4 for har for url https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view?browsertime_run=2
[2025-02-13 12:05:13] ERROR: There are pages that misses data. This is in almost all cases caused by that you try to measure a page view but you do not navigate to a new page. Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:282:29)
[2025-02-13 12:05:13] ERROR: Could not generate coach data Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:533:35)
[2025-02-13 12:05:13] ERROR: Could not find the right index 5 for har for url https://cdev4-dev-ed.develop.lightning.force.com/lightning/r/Contact/003ak00000GZnmDAAT/view?browsertime_run=3
[2025-02-13 12:05:13] ERROR: There are pages that misses data. This is in almost all cases caused by that you try to measure a page view but you do not navigate to a new page. Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:282:29)
[2025-02-13 12:05:13] ERROR: Could not generate coach data Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:533:35)
[2025-02-13 12:05:13] ERROR: Could not find the right index 6 for har for url https://cdev4-dev-ed.develop.my.salesforce.com/
[2025-02-13 12:05:13] ERROR: There are pages that misses data. This is in almost all cases caused by that you try to measure a page view but you do not navigate to a new page. Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:282:29)
[2025-02-13 12:05:13] ERROR: Could not generate coach data Error: PageIndex out of range
at module.exports.pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\har\harCutter.js:18:11)
at pickAPage (C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\node_modules\coach-core\lib\index.js:85:12)
at BrowsertimePlugin.processMessage (file:///C:/Tools/node-v21.2.0-win-x64latest/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:533:35)
[2025-02-13 12:05:18] INFO: HTML stored in C:\Tools\node-v21.2.0-win-x64latest\node_modules\sitespeed.io\bin\sitespeed-result\withsel1_mjs\2025-02-13-12-02-18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Browsertime script with VisualMetrics enabled and compare the execution log with the generated transaction metrics. Trace the VisualMetrics portable-script output and HAR page matching for the repeated Contact URL; done means affected transactions report valid visual metrics and the HAR metadata errors are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.