0

I have the following code: enter image description here

When I run it I face with the followings:

2020-07-08 12:47:49,053 ERROR c.g.j.p.w.s.WebDriverSampler: Expected condition failed: waiting for presence of element located by: By.name: identifier (tried for 15 second(s) with 500 milliseconds interval)

2020-07-08 12:47:49,084 INFO o.a.j.t.JMeterThread: Thread is done:Browser 1-1

2020-07-08 12:47:49,084 INFO o.a.j.t.JMeterThread: Thread finished: Browser 1-1

2020-07-08 12:47:49,663 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test

2020-07-08 12:47:49,664 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, local)

Can anyone help me out with this error?

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
  • @harshwardhengupta Please try to avoid pasting your code as image. Paste it as code. Please update your question with the related piece of code. – Peter Csala Jul 08 '20 at 08:53

1 Answers1

1

When I open your https://somatus-dev-uat.azurewebsites.net URL I'm getting the following page:

enter image description here

which doesn't contain any element with the name attribute of identifier, most probably this is the reason for your test failure.

So before running your test in headless mode make sure that it's running fine in GUI mode.

If this is something you cannot do for any reason, consider taking a screenshot in case of failure, something like:

var exception = null
try
{
    wait.until(pkg.ExpectedConditions.presenceOfElementLocated(pkg.By.name('identifier')))
}
catch (err)
{
    WDS.log.error(err.message)
    var screenshot = WDS.browser.getScreenshotAs(pkg.OutputType.FILE)
    screenshot.renameTo(new java.io.File('screenshot.png'))
    exception = err
}
finally
{
    throw (exception)
}

More information: The WebDriver Sampler: Your Top 10 Questions Answered

Dmitri T
  • 159,985
  • 5
  • 83
  • 133