Could anyone help me understand why I am getting this PageIndex out of range error? This script was able to finish if I took the measure out. So I think sth. was wrong at commands.measure. I saw ERROR: Could not add meta data to the HAR, miss page 0 Is it because Sitespeed.io can only measure right after navigate?
[2022-02-01 22:44:44] INFO: Versions OS: linux 5.10.76-linuxkit nodejs: v14.17.6 sitespeed.io: 19.4.2 browsertime: 14.2.1 coach: 6.4.3
[2022-02-01 22:44:45] INFO: Running tests using Chrome - 1 iteration(s)
[2022-02-01 22:44:45] INFO: Navigating to url https://test.salesforce.com/ iteration 1
[2022-02-01 22:45:15] INFO: ***Logging in...***
[2022-02-01 22:45:15] INFO: Navigating to url https://qasvetlana2--lexcall.lightning.force.com/lightning/o/Account/list?filterName=AllAccounts iteration 1
[2022-02-01 22:45:33] INFO: ***Locating the first professional account...***
[2022-02-01 22:45:35] INFO: ***Click record a call button
[2022-02-01 22:45:35] INFO: Start to measure
[2022-02-01 22:45:53] ERROR: Could not add meta data to the HAR, miss page 0
[2022-02-01 22:45:53] INFO: https://qasvetlana2--lexcall.lightning.force.com/lightning/r/Account/00146000006dwxdAAA/view TTFB: 269ms, firstPaint: 305ms, firstVisualChange: 0ms, FCP: 392ms, DOMContentLoaded: 385ms, LCP: 18.00s, CLS: 0.082, TBT: 1.23s, Load: 647ms, speedIndex: 0ms, visualComplete85: 0ms, lastVisualChange: 0ms
[2022-02-01 22:45:53] ERROR: Could not find the right index 0 for har for url https://qasvetlana2--lexcall.lightning.force.com/lightning/r/Account/00146000006dwxdAAA/view
[2022-02-01 22:45:53] ERROR: Caught error from Browsertime Error: PageIndex out of range
at module.exports.pickAPage (/usr/src/app/node_modules/coach-core/lib/har/harCutter.js:18:11)
at Object.pickAPage (/usr/src/app/node_modules/coach-core/lib/index.js:84:12)
at Object.processMessage (/usr/src/app/lib/plugins/browsertime/index.js:263:31)
Below is the javascript.
let login = "https://test.salesforce.com/";
let test = "https://abc.lightning.force.com/lightning/o/Account/list?filterName=AllAccounts";
let username = "xxx";
let passwd = "xxx";
module.exports = async function(context, commands) {
await commands.navigate(login);
try {
await commands.addText.byId(username, "username");
await commands.addText.byId(passwd, "password");
await commands.click.byIdAndWait("Login");
await commands.wait.byTime(1000);
context.log.info("***Logging in...***");
await commands.navigate(test);
await commands.wait.byTime(5000);
context.log.info("***Locating the first professional account...***");
await commands.click.byXpath('(//td[@role="gridcell" and span/span[@title="Professional"]]/preceding-sibling::th[1]/span/a)[1]');
await commands.wait.byTime(2000);
context.log.info("***Click record a call button")
await commands.measure.start();
await commands.click.byXpathAndWait('//runtime_platform_actions-action-renderer[@apiname="Record_a_Call"]');
return commands.measure.stop();
context.log.info("***Done***")
} catch (e) {
throw e;
}
};