Menu

#1536 Html unit not compatible with jquery 2.0.3

2.12
closed
None
1
2015-02-26
2013-08-20
PEROT
No

Hello,

Hello,

With jquery v1.10.0 all my tests are ok. I tried to update to jquery 2.0.3 but when I run my tests with maven, I have the error below. It seems that htmlunit is not compatible with jquery 2.0.3. Can you confirm me this incompatibility and do you plan to support jquery 2.0.3 ?

Regards,
Christophe

[ERROR] Failed to execute goal com.github.searls:jasmine-maven-plugin:1.3.1.2:test (default) on project ui-js: The jasmine-maven-plugin encountered an exception:
[ERROR] java.lang.RuntimeException: org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Impossible de trouver la fonction addEventListener dans lobjet {1}
. (http://localhost:54173/src/resources/external/scripts/jquery.min.js#4)
[ERROR] Build info: version: '2.32.0', revision: '6c40c187d01409a5dc3b7f8251859150c8af0bcb', time: '2013-04-09 10:39:28'
[ERROR] System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_30'
[ERROR] Driver info: driver.version: HtmlUnitDriver
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:39)
[ERROR] at com.github.searls.jasmine.mojo.TestMojo.executeSpecs(TestMojo.java:78)
[ERROR] at com.github.searls.jasmine.mojo.TestMojo.run(TestMojo.java:43)
[ERROR] at com.github.searls.jasmine.mojo.AbstractJasmineMojo.execute(AbstractJasmineMojo.java:386)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:597)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR] Caused by: org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Impossible de trouver la fonction addEventListener dans lobjet {1}. (http://localho
st:54173/src/resources/external/scripts/jquery.min.js#4)
[ERROR] Build info: version: '2.32.0', revision: '6c40c187d01409a5dc3b7f8251859150c8af0bcb', time: '2013-04-09 10:39:28'
[ERROR] System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_30'
[ERROR] Driver info: driver.version: HtmlUnitDriver
[ERROR] at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:367)
[ERROR] at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:346)
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:30)
[ERROR] ... 24 more
[ERROR] Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Impossible de trouver la fonction addEventListener dans lobjet {1}. (http://localhost:54173/src/resources/external/scripts/
jquery.min.js#4)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:601)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:555)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1082)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:399)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:260)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:276)
[ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:676)
[ERROR] at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
[ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:635)
[ERROR] at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1170)
[ERROR] at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1072)
[ERROR] at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
[ERROR] at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330)
[ERROR] at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3074)
[ERROR] at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2041)
[ERROR] at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:918)
[ERROR] at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
[ERROR] at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
[ERROR] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:892)
[ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:241)
[ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:187)
[ERROR] at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
[ERROR] at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
[ERROR] at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:434)
[ERROR] at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:309)
[ERROR] at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)
[ERROR] at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:359)
[ERROR] ... 26 more
[ERROR] Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Impossible de trouver la fonction addEventListener dans lobjet {1}. (http://localhost:54173/src/resources/external/s
cripts/jquery.min.js#4)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3603)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3587)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3608)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3624)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3688)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2207)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2189)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1333)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:275)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3031)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:546)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:654)
[ERROR] ... 55 more
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Discussion

  • Chris Pimlott

    Chris Pimlott - 2013-09-25

    I have seen this problem as well, through using the jasmine-maven-plugin like the reporter. From my testing, I couldn't get HtmlUnit to work with any version of jQuery 2.x, and only some versions of 1.x, depending on the BrowserVersion constant used:

    • CHROME: None worked [1.8.0-2.0.3]
    • FIREFOX_3_6: Worked for [1.8.0-1.8.3]. Failed for [2.0.0-2.0.3].
    • FIREFOX_17: Same as FIREFOX_3_6
    • INTERNET_EXPLORER_8: Worked for [1.8.0-1.10.2]. Failed for [2.0.0-2.0.3]
    • INTERNET_EXPLORER_9: Same as INTERNET_EXPLORER_8
     
  • Ahmed Ashour

    Ahmed Ashour - 2013-09-26

    I recently looked into jQuery 1.10.2 test suite, and it seems to have many failures (http://htmlunit.sourceforge.net/jquery/test/)

    I didn't look into 2.x, as I thought it won't be used much (because of IE8 current market share).

    Anyhow, you can help by providing minimal test cases, please read http://htmlunit.sourceforge.net/submittingJSBugs.html

     

    Last edit: Ahmed Ashour 2013-09-26
  • PEROT

    PEROT - 2013-09-26

    Hello,

    So you don't plan to support jquery 2.X for the moment and you don't plan to support it ?

    Regards,

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-09-26

    As of now, jQuery 1.8.2 tests pass.

    Users are the drivers to support which version, if 2.x is more important, then let it be 2.x.

    Because of the very limited time/resources we have, it is much appreciated if minimal test cases are provided, so the developers focus on fixing the issues, not also discovering the root cause.

     
  • Chris Pimlott

    Chris Pimlott - 2013-09-26

    It appears that the fix for 1545 may have solved this issue as well; at least, jQuery 2.0.3 loads successfully in a modified version of the 1545 test (for CHROME and FIREFOX).

    The test in 1546 works in jQuery 2 as well!

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-09-26

    Cool!

    As always, minimal test cases are much better to pin-point the issue.

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-09-26
    • status: open --> closed
    • assigned_to: Ahmed Ashour
     
  • PEROT

    PEROT - 2013-12-02

    Hello,

    I tried with the last htmlunit version and jquery 2.0.3 and it seems there is an other issue:

    com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:899)
    [ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:242)
    [ERROR] at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:188)
    [ERROR] at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
    [ERROR] at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
    [ERROR] at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:437)
    [ERROR] at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
    [ERROR] at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376)
    [ERROR] at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:366)
    [ERROR] ... 26 more
    [ERROR] Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Impossible de trouver la fonction getComputedStyle dans lobjet {1}. (http://localhost:50567/src/resources/external/scripts/jquery.min.js#5)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3603)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3587)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3608)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3624)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3688)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2207)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2189)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1333)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
    [ERROR] at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:309)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3031)
    [ERROR] at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
    [ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:561)
    [ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
    [ERROR] ... 55 more
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

    I attached a zip file to reproduce the issue.

    Should I open a new issue ?

    Regards,
    Christophe

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-12-02

    Can you provide a project that uses 2.14-SNAPSHOT, without jasmine-maven-plugin.

     
  • PEROT

    PEROT - 2013-12-12

    Hello,

    Sorry for the delay.
    I created a sample project with what you asked and an html file also.
    I need that htmlunit works with jquery 2.0.3 and INTERNET_EXPLORER_9 because my real jasmine tests work only with this browser profile.

    I have the following error when I execute mvn clean install on the test I attached:


    T E S T S

    Running com.axway.AppTest
    dÚc. 12, 2013 4:40:12 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError
    Grave: runtimeError: message=[An invalid or illegal selector was specified (selector: ',:x' error: Invalid selector: :x).] sourceName=[http://localhost/commonui/js/src/main/resources/external/scripts/jquery.min.js] line=[1504] lineSource=[null] lineOffset=[0]
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.796 sec <<< FAILURE!

    Results :

    Tests in error:
    testLengthOfTheUniqueKey(com.axway.AppTest): TypeError: Impossible de trouver la fonction addEventListener dans lobjet {1}. (http://localhost/commonui/js/src/main/resources/external/scripts/jquery.min.js#834)

    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

    Thanks,
    Christophe

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-12-13
    • status: closed --> accepted
     
  • Ahmed Ashour

    Ahmed Ashour - 2013-12-13
    • status: accepted --> closed
     
  • Ahmed Ashour

    Ahmed Ashour - 2013-12-13
    • Thanks for reporting, fixed in SVN
    • This was due to node and window.addEventListener() incorrectly handled for IE9
    • If you have any further issue with jQuery, please open a new ticket
     

Log in to post a comment.