Web Driver related error stating "ERROR o.a.j.s.SampleResult:sampleStart called twice" when it is used only 1 time in the sampler
Expected behavior
We expect the script to run without the error
Actual behavior
We are creating the selenium like script in JMeter and we are using web driver sampler We have used only 1 time the sampleStart and sampleEnd methods in the sampler and on replay we notice the error stating sampleStart called twice is misleading.
Version of various Technology stack related to JMeter used in the exercise :
- JMETER :: apache-jmeter-5.6.3
- Chrome Driver :: chromedriver-131.0.6778.69(r1368529)
- JMeter Plugin Manager :: jmeter-plugins-manager-1.10
Error stack trace: ERROR o.a.j.s.SampleResult:sampleStart called twice java.lang.Throwable: Invalid call sequence at org.apache.jmeter.samplers.SampleResult.sampleStart(SampleResult.java:1186) [ApacheJMeter_core.jar:5.6.3] at org.apache.jmeter.samplers.SampleResult$sampleStart.call(Unknown Source) [ApacheJMeter_core.jar:?] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)[groovy-3.0.20.jar:3.0.20] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)[groovy-3.0.20.jar:3.0.20] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)[groovy-3.0.20.jar:3.0.20] at Script1.run(Script1.groovy:4)[Script:?]
Steps to reproduce the problem
Version of various Technology stack related to JMeter used in the excercise :
- JMETER :: apache-jmeter-5.6.3
- Chrome Driver :: chromedriver-131.0.6778.69(r1368529)
- JMeter Plugin Manager :: jmeter-plugins-manager-1.10
Steps:
- Add the chrome driver config element
- Provide the path of the chrome driver in the Path section of the chrome driver config element
- Add the Web driver sampler
- Created the selenium like request to launch the URL enclosed between WDS.SampleResult.sampleStart() and WDS.SampleResult.sampleEnd()
- Clicked the Run button
Expected output: Script should launch the Url and should not throw error sampleStart called twice
Actual output: Script execution launched the Url but also displayed below error in the logs: Error stack trace: ERROR o.a.j.s.SampleResult:sampleStart called twice java.lang.Throwable: Invalid call sequence at org.apache.jmeter.samplers.SampleResult.sampleStart(SampleResult.java:1186) [ApacheJMeter_core.jar:5.6.3] at org.apache.jmeter.samplers.SampleResult$sampleStart.call(Unknown Source) [ApacheJMeter_core.jar:?] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)[groovy-3.0.20.jar:3.0.20] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)[groovy-3.0.20.jar:3.0.20] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)[groovy-3.0.20.jar:3.0.20] at Script1.run(Script1.groovy:4)[Script:?]
JMeter Version
5.6.3
Java Version
JDK17
OS Version
Microsoft Windows
Note : Today we downgraded the version of selenium webdriver from 4.13.0.2 to 4.13.0.0 version and tested the scenario and found issue was not occuring so it appears like issue is introduced after 4.13.0.0 version
This issue has been fixed in version 4.13.0.2. However, for existing scripts created prior to 4.13.0.2, you'll have to manually comment out (or delete) all "WDS.sampleResult.sampleStart()" and "WDS.sampleResult.sampleEnd()" lines in the WebDriver Samplers.
Hi Robert,
Thanks for the update,
Regards, Srikanth KL
On Thu, Jul 3, 2025 at 10:59 AM Robert Bourgault du Coudray < @.***> wrote:
rbourga left a comment (apache/jmeter#6380) https://github.com/apache/jmeter/issues/6380#issuecomment-3030818311
This issue has been fixed in version 4.13.0.2. However, for existing scripts created prior to 4.13.0.2, you'll have to manually comment out (or delete) all "WDS.sampleResult.sampleStart()" and "WDS.sampleResult.sampleEnd()" lines in the WebDriver Samplers.
— Reply to this email directly, view it on GitHub https://github.com/apache/jmeter/issues/6380#issuecomment-3030818311, or unsubscribe https://github.com/notifications/unsubscribe-auth/BM43EWHKAUSVDTEXTTDAGN33GS5ULAVCNFSM6AAAAABRWKKSIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMZQHAYTQMZRGE . You are receiving this because you authored the thread.Message ID: @.***>
HI, the errors:
Hi Srikanthkldia,
I faced the same problem of Robert, and tried your workaround but it doesn't work.
So I tried starting from scratch installation:
- Install JMETER : apache-jmeter-5.6.3 on Windows pc
- Installed WebDriver Sampler 4.13.0.2 from Plugin manager -Create a new project adding a WebDriver sampler with following script with Groovy as "Script language": WDS.sampleResult.sampleStart() WDS.log.info("This is an info message"); WDS.sampleResult.sampleEnd()
Run and I still have the same problems: 2025-07-04 14:35:59,378 ERROR o.a.j.s.SampleResult: sampleStart called twice --2025-07-04 14:35:59,456 ERROR o.a.j.s.SampleResult: sampleEnd called twice
Hi Salvo, I am not sure what you are doing. When I add a new WebDriver Sampler with 4.13.0.2, the two "WDS.sampleResult..." lines are automatically commented out and the sampler works fine:
// WDS.sampleResult.sampleStart() WDS.browser.get('http://jmeter-plugins.org') // WDS.sampleResult.sampleEnd()
Have you removed the comments?
Yes I removed. If I run these lines:
- WDS.sampleResult.sampleStart()
- WDS.log.info("This is an info message");
- WDS.sampleResult.sampleEnd()
The exceptions are raised.
Yes, as said before, if you keep the WDS.sampleResult lines, it will fail. In 14.13.0.2, you need to remove these lines in your script as the plugin will now automatically timestamp the sampler for you without you having to call the timestamp functions. If you keep the timestamp functions in your script, it will conflict with the automatic timestamp and fail. The reasons we left the timestamp functions is for backwards compatibility, in case you want to run your script with an older version of the plugin. Hope this helps.