JavaScript code to stay on a browser page using JMeter Web driver sampler

I have written a Javascript code in JMeter Web driver sampler, which working fine for me. But my requirement is to open diffrent browsers using diffrent credentials & stay on a perticular page.

Below code executes correctly and closed the browser. How can I make the browsers remain open.

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

WDS.sampleResult.sampleStart(); 
WDS.sampleResult.getLatency();
WDS.log.info("Sample started");
WDS.browser.get('http://192.168.11.47/Webi2i/CustomerA'); 
var wait = new support_ui.WebDriverWait(WDS.browser, 5000);
var user = WDS.browser.findElement(pkg.By.id('userName'));
user.sendKeys(['user1@rdtltd.com']);
WDS.log.info("user1 entered");
var password=WDS.browser.findElement(pkg.By.id('Password'));
password.sendKeys(['0125602']);
WDS.log.info("password entered");
var btnlogin =WDS.browser.findElement(pkg.By.id('btnLogin'));
btnlogin.click();
WDS.log.info("button clicked ");

var livepage = WDS.browser.findElement(pkg.By.xpath('//*[@id="navbar-large- 
device"]/ul/li[2]/a/div'));
livepage.click();
WDS.log.info("Live page clicked");

1 answer