jmeterselenium-chromedriverpage-load-time

Why do I see a big difference in loadtime between jMeter and user experience when browsing?


My problem is that I see the load time for a web page element on a test in jMeter @ 200 miliseconds and when browsing, most of the time I get 3 or 4 seconds, in the condition where the size in bytes is @ 331000.

I must mention that I cleared the cache and cookies for each iteration and I inserted also the constant timer between the steps.

The searching an id is the actual case described previously.

var pkg = JavaImporter(org.openqa.selenium); 
var wait_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait);
var wait = new wait_ui.WebDriverWait(WDS.browser, 5000);

WDS.sampleResult.sampleStart()

var searchBox = WDS.browser.findElement(pkg.By.id("140:0;p"));

searchBox.click();
searchBox.sendKeys("1053606032");
searchBox.sendKeys(org.openqa.selenium.Keys.ENTER);

WDS.sampleResult.sampleEnd()

I expected to see the same load time results, but maybe an option would be if I wait until some elements on the search results page are visible. But I cannot bring an argument why is this difference. I had another case where the page loads in 10 seconds in Chrome and in jMeter Test Results 300 miliseconds.


Solution

  • Please try with wait until for a specific element which loads as close as the page load.

    Below is another try for the same. Use the below code and check if this helps:-

    WDS.sampleResult.sampleStart()
    WDS.browser.get('http://jmeter-plugins.org')
    
    //(JavascriptExecutor)WDS.browser.executeScript("return document.readyState").toString().equals("complete")
    WDS.browser.executeScript("return document.readyState").toString().equals("complete")
    WDS.sampleResult.sampleEnd()
    

    For me without execute script page loads in 3 sec and with executeScript it loads in 7 sec..while in browser that loads in around 7.57sec..

    Hope this helps.