Once a file is uploaded to the website, a loading screen appears depending on the file size. I am interested in measuring how long this loading screen remains active. As a novice in jmeter and programming, I'm unsure if there's a more efficient method than what I currently have.
Here is my current approach:
var node = implicitFind(pkg.By.xpath("//div[id]")); //xpath of the loading screen
var increment = 1;
while (node != null) {
if (increment == 1)
var before = new Date().getTime(); //gets current time of test
increment++;
}
var after = new Date().getTime();
WDS.log.info('------- Time taken for loading screen = ' + (after - before) + ' ms');
/*
The reason why I added an increment was so the before time can be recorded only on the
first loop rather than every loop. The loop ends when xpath no longer exist, which is
when the after time is recorded.
*/
The problem with this code is that jmeter does not break the loop even when the condition is false. The xpath corresponds to a text displayed during the loading process. I would appreciate any help or suggestions for improving my code. Thank you!