Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am facing an issue with the Web driver sampler in Jmeter.

I have written a simple code in web driver sampler where I have given a url and pass a few credentials to login.

When I run the test.. the browser gets invoked, the url is passed onto the address bar and then the browser gets closed or crashes. Sometimes the browser gets crashed after passing the passwords. Pls have a look at the below code and let me know if i am missing on something.

Code:

var pkg=JavaImporter(org.openqa.selenium) //import java selenium package
var support_ui=JavaImporter(org.openqa.selenium.support.ui.WebDriverWait) //import WebDriverWait Package
var ui=JavaImporter(org.openqa.selenium.support.ui) //import Selenium Support UI package
var wait=new support_ui.WebDriverWait(WDS.browser,20000) // wait 5 seconds until page loads
WDS.sampleResult.sampleStart() 

WDS.browser.get('https://web2qa.westlaw.com/signon/default.wl?bhcp=1&fn=_top&newdoor=true&rs=WLW14.07&vr=2.0') 

var Onepass=WDS.browser.findElement(pkg.By.id('OnePassHeaderLink')) //define login submit button
Onepass.click()// 

var usernameField = WDS.browser.findElement(pkg.By.id('pwd')) //define username field
usernameField.sendKeys(['pwd1']) // types word pwd1 in field
var passwordField = WDS.browser.findElement(pkg.By.id('clientid')) //define username field
passwordField.sendKeys(['pwd2']) // types word pwd2 in field
var loginButton=WDS.browser.findElement(pkg.By.id('login_submit')) //define login submit button
loginButton.click() //click on the login button
WDS.log.info(WDS.name + ' has logged an entry') //log message
WDS.sampleResult.sampleEnd()
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.