0

Previous to my post see the logs and selenium script written using javascript in Jmeter. I want to use the WebDriverWait in my script i.e. written in javascript and I have tried a lot but always get an error and the errors I have recieved at var wait = new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 10) :

2020-04-13 15:25:42,689 ERROR c.g.j.p.w.s.WebDriverSampler: TypeError: org.openqa.selenium.support.ui.WebDriverWait is not a function in <eval> at line number 6 2020-04-13 15:25:42,690 ERROR c.g.j.p.w.s.WebDriverSampler: TypeError: org.openqa.selenium.support.ui.WebDriverWait is not a function in <eval> at line number 6 2020-04-13 15:25:44,002 ERROR c.g.j.p.w.s.WebDriverSampler: TypeError: org.openqa.selenium.support.ui.WebDriverWait is not a function in <eval> at line number 6

Can anyone please help me how can I achieve this using JavaScript in my selenium Script ?

1

You were given the code in the previous answer which demonstrates the usage of the WebDriverWait class, to wit:

WDS.sampleResult.sampleStart()
WDS.browser.get('http://example.com')
var wait = new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 10)
var conditions = org.openqa.selenium.support.ui.ExpectedConditions
wait.until(conditions.elementToBeClickable(org.openqa.selenium.By.linkText('More information...')))
WDS.sampleResult.sampleEnd()

Here is the evidence of its work:

enter image description here

If you cannot use it for some reason most probably your WebDriver Sampler plugin installation is broken somewhere somehow, the easiest workaround would be:

  1. Install clean latest stable JMeter version
  2. Install latest Selenium/WebDriver Support plugin using JMeter Plugins Manager

    enter image description here

  3. Execute the above script. It should be successful
  4. Integrate the above solution into your own script.
1
  • Okay !! Thank you, I will definitely check it again by tomorrow and will update my selenium/Webdriver also. – Rajan Apr 14 '20 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.