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 Answer 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:
If you cannot use it for some reason most probably your WebDriver Sampler plugin installation is broken somewhere somehow, the easiest workaround would be:
- Install clean latest stable JMeter version
Install latest Selenium/WebDriver Support plugin using JMeter Plugins Manager
- Execute the above script. It should be successful
- Integrate the above solution into your own script.
-
Okay !! Thank you, I will definitely check it again by tomorrow and will update my selenium/Webdriver also.Rajan– Rajan2020年04月14日 15:27:11 +00:00Commented Apr 14, 2020 at 15:27