I am relatively new to Selenium and WDS in Jmeter, so I could use some assistance. I'm having trouble writing code that waits for the entire page to load. I came across something like "return document.readyState
", but I can't seem to implement it in my code. That's why I admit - I still have a lot to learn in this area.
In my code, I have a "wait
" statement but it doesn't seem to be sufficient.
var pkg = JavaImporter(org.openqa.selenium); //WebDriver classes
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait); //WebDriver classes
var wait = new support_ui.WebDriverWait(WDS.browser, 10000);
var conditions = org.openqa.selenium.support.ui.ExpectedConditions;
WDS.sampleResult.sampleStart(); //captures sampler's start time
WDS.sampleResult.getLatency();
WDS.log.info("Sample started");
WDS.browser.get('https://somethingsomething');
wait.until(conditions.elementToBeClickable(pkg.By.xpath("//a[@href='x']")));
WDS.log.info("Sample ended - navigated to somethingsomething");
WDS.sampleResult.sampleEnd();