0
votes

I have a JMeter Web Driver Test plan. Where I have:

  • a Thread group with 3 users
  • a Web Driver Sampler,
  • Firefox Driver Config
  • and View Results in Tree listener.
  • Also I have a CSV Data Set Config wherein I have mapped it to a CSV file to receive Username and Passwords.

In the Web Driver Sampler we have just written a Simple code which invokes Firefox browser, passes the url to it, passes Username and Passwords to it. Then makes a search for a term and logs out.

Once I run this test with 3 users, the test runs fine for first and second user and fails for the third one.

And when I run the test again, First and Third user passes but fails for the second.

When I go and check on the Response message, it says it was unable to locate element.

Whereas it would have ran fine for the next user.

I'm not sure why the test is behaving like this, Can someone Help me on this issue.

1
Can you show your test plan. and zoom on Webdriver sampler ? thxUBIK LOAD PACK

1 Answers

0
votes

Elements may not appear in DOM immediately after WebDriver get() request, I would suggest to add an extra step which will ensure that specified element is present in DOM and may be interacted with prior to clicking/typing by something like:

var pkg = JavaImporter(org.openqa.selenium)
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)

wait.until(support_ui.ExpectedConditions.presenceOfElementLocated(pkg.By.id('element_id')))
var element=WDS.browser.findElement(pkg.By.id('element_id')) 
element.click()

See Using Selenium with JMeter's WebDriver Sampler guide for more details on Selenium scripting in JMeter