Jmeter 5.6.3 Selenium/WebDriver 4.13.0.0 - ExpectedConditions.invisibilityOfElementLocated

58 views
Skip to first unread message

Avinash Kumar

unread,
Apr 2, 2024, 10:18:36 AMApr 2
to jmeter-plugins
Hi all,

Jmeter 5.6.3 (latest)
Selenium/WebDriver 4.13.0.0 (latest)
Chromedriver - 123 (latest)

When I run following command in Jmeter, I get  TimeoutException  error. Can someone please help.

WebDriverWait wait = new WebDriverWait(WDS.browser,java.time.Duration.ofSeconds(50));

wait.until(ExpectedConditions.invisibilityOfElementLocated(org.openqa.selenium.By.xpath("//span[text()='Single user - automatic notification']"))).equals(true);

Thread.sleep(5000);

WDS.browser.findElement(org.openqa.selenium.By.xpath("//label[@for='enable-config-button-app2']//span[@class='ui-button-text']")).click();

Error =

javax.script.ScriptException: javax.script.ScriptException: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.13.0', revision: 'ba948ece5b*'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.21'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [9088752b12499bb0a79db83cba76cee9, findElement {using=xpath, value=//span[text()='Single user - automatic notification']}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 123.0.6312.86, chrome: {chromedriverVersion: 123.0.6312.58 (6b4b19e9dfbb..., userDataDir: C:\Users\XXXX\AppData\Lo...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:63283}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(autodetect), se:cdp: ws://localhost:63283/devtoo..., se:cdpVersion: 123.0.6312.86, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 9088752b12499bb0a79db83cba76cee9
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)
at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.sample(WebDriverSampler.java:101)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268)
at java.base/java.lang.Thread.run(Thread.java:834)

Dmitri T

unread,
Apr 2, 2024, 10:57:45 AMApr 2
to jmeter-plugins
It looks like you're using wrong ExpectedCondition, you're waiting for element to become invisible (i.e. hidden by CSS styles) and it appears that the element is removed completely from DOM

So maybe you should use the following condition instead:

wait.until(ExpectedConditions.not(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[text()='Single user - automatic notification']"))));

Avinash Kumar

unread,
Apr 2, 2024, 11:36:36 AMApr 2
to jmeter-plugins
I tried what you suggested, and it fails in both Jmeter + Eclipse.
(What I am doing is coding in Eclipse then copy/paste the calls in JMeter as it makes it easy to debug the issue)

I tried the following in Eclipse, and it works; but in JMeter it fails again with timeout exception.

wait.until(ExpectedConditions.invisibilityOfElementLocated(org.openqa.selenium.By.xpath("//span[text()='Single user - automatic notification']"))).equals(true);

Avinash Kumar

unread,
Apr 2, 2024, 2:15:52 PMApr 2
to jmeter-plugins
**Correction**.. Earlier I was using ChromeDriver.exe in Jmeter, but I was using the jars file in Eclipse to test.
Now I have added jar files for ChromeDriver in my JMeter and all is running well; and not using ChromeDriver.exe in my Jmeter.
Apologies for not bringing this info up front earlier.

Reply all
Reply to author
Forward
0 new messages