com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47)

Jenkins JIRA | Pavel Baranchikov | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Jenkins has its own HtmlUnit module, that is downloaded throught Maven as dependency to jenkins test harness. But the module is rather old (2.6). This causes error while running JUnit tests {code} Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 19.895 sec <<< FAILURE! - in hudson.plugins.git.ui.ChangeSetListTest test1(hudson.plugins.git.ui.ChangeSetListTest) Time elapsed: 17.864 sec <<< ERROR! com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3652) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3630) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3658) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3677) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3741) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2249) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2216) {code} The method querySelectorAll() support has been added since 2.9 according to [HtmlUnit change log|http://htmlunit.sourceforge.net/changes-report.html#a2.9]. Simple substitution of new HtmlUnit causes failure in WebClient (Jenkins') constructor, as BrowserVersion has been changed: {code} Tests in error: FailedTest.org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite » NoSuchField PreBuildMergeOptionsTest.exporting:48 » NoSuchField FIREFOX_2 GitSCMTest>HudsonTestCase.runBare:296->HudsonTestCase.runTest:440- >testConfigRoundtripURLPreserved:1229->HudsonTestCase.configRoundtrip:888- >HudsonTestCase.createWebClient:1617 » NoSuchField GitSCMTest>HudsonTestCase.runBare:296->HudsonTestCase.runTest:440- >testConfigRoundtrip:1240->HudsonTestCase.configRoundtrip:888- >HudsonTestCase.createWebClient:1617 » NoSuchField {code}

    Jenkins JIRA | 2 years ago | Pavel Baranchikov
    com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47)
  2. 0

    Jenkins has its own HtmlUnit module, that is downloaded throught Maven as dependency to jenkins test harness. But the module is rather old (2.6). This causes error while running JUnit tests {code} Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 19.895 sec <<< FAILURE! - in hudson.plugins.git.ui.ChangeSetListTest test1(hudson.plugins.git.ui.ChangeSetListTest) Time elapsed: 17.864 sec <<< ERROR! com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3652) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3630) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3658) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3677) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3741) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2249) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2216) {code} The method querySelectorAll() support has been added since 2.9 according to [HtmlUnit change log|http://htmlunit.sourceforge.net/changes-report.html#a2.9]. Simple substitution of new HtmlUnit causes failure in WebClient (Jenkins') constructor, as BrowserVersion has been changed: {code} Tests in error: FailedTest.org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite » NoSuchField PreBuildMergeOptionsTest.exporting:48 » NoSuchField FIREFOX_2 GitSCMTest>HudsonTestCase.runBare:296->HudsonTestCase.runTest:440- >testConfigRoundtripURLPreserved:1229->HudsonTestCase.configRoundtrip:888- >HudsonTestCase.createWebClient:1617 » NoSuchField GitSCMTest>HudsonTestCase.runBare:296->HudsonTestCase.runTest:440- >testConfigRoundtrip:1240->HudsonTestCase.configRoundtrip:888- >HudsonTestCase.createWebClient:1617 » NoSuchField {code}

    Jenkins JIRA | 2 years ago | Pavel Baranchikov
    com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47)

    Root Cause Analysis

    1. com.gargoylesoftware.htmlunit.ScriptException

      TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47)

      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError()
    2. HtmlUnit Core JS
      ScriptRuntime.getPropFunctionAndThis
      1. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3652)
      2. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3630)
      3. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3658)
      4. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3677)
      5. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3741)
      6. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2249)
      7. net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2216)
      7 frames