Jmeter-Webdriver Webdriver Sampler - How to execute a script in HtmlUnitDriver?

927 views Asked by At

My Jmeter-webdriver webdriver sampler script is executed finely on chrome browser, whereas when same script is executed the on htmlunitdriver it throws an error.

To configure a HtmlUnitdriver followed the steps:-

Thread Group > Add > Listener > jp@gc- HtmlUnitDriver Config

2016/12/23 14:26:51 ERROR - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function addEventListener in object [object Window]. (https://test.html
Build info: version: '2.52.0', revision: '4c2593d28', time: '2016-02-11 11:22:43'
System info: host: 'EN09', ip: '192.168.254.2', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: driver.version: HtmlUnitDriver  

Please let me know how to run Webdriver sampler script on Htmlunitdriver successfully

1

There are 1 answers

1
Dmitri T On

Quick checklist:

  1. Are you able to run something "minimal" successfully, i.e.:

    WDS.sampleResult.sampleStart()
    WDS.browser.get('http://example.com')
    WDS.sampleResult.sampleEnd()
    

    If the answer is "No" - it may be installation issue, I would recommend reinstalling the Selenium/WebDriver Support plugins bundle via JMeter Plugins Manager:

    Selenium JMeter Plugins Manager

  2. Are you able to execute your test using HtmlUnitDriver from Java code (without JMeter)?

    If the answer is "No" - check if the issue is present here: https://sourceforge.net/p/htmlunit/bugs/ and if not - report it.

  3. If you can run your test scenario from Java and not able to run it with JMeter - report it to JMeter Plugins forum

The viable workaround for headless Selenium tests execution using JMeter is PhantomJS Driver