YUI 中抛出异常:“Sizzle”没有定义!
我们将 HTML Unit v2.6 与 Web-Harvest 结合使用,并扩展其功能来创建新元素。
<web session="sess1" browser="firefox2">
<web-getpage url="https://www.linkedin.com/secure/login"/>
<web-setinput name="uname">username</web-setinput>
<web-setinput name="pwd">password</web-setinput>
<web-clickinput name="login"/>
</web>
当我们运行此元素时,我们会在元素加载指定的 URL 时遇到异常。详细信息如下:
引起:net.sourceforge.htmlunit.corejs.javascript.EcmaError:TypeError:无法在对象 net.sourceforge.htmlunit.corejs.javascript.EcmaError 中找到函数 hasOwnProperty:ReferenceError:“Sizzle”未定义。 在net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3651) 在 net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3629) 在 net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3657) 在net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3676) 在net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3740) 在net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2249) 在net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2216) 在net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1501) 在net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845) 在net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164) 在net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:427) 在 com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:263) 在net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3058) 在net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:175) 在 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:415) 在 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:520) ... 42 更多
看来是“Sizzle”(出现在 YUI3 中)导致了这种情况。然后我们在 Firefox 和 IE 中进行了相同的检查,但是这两个浏览器都没有显示任何“Sizzle”未定义的错误。
我们还尝试使用 htmlunit 的最新快照,但遇到了同样的问题。
这是 HTML Unit JavaScript 引擎的限制(错误)吗?
或者
是否有配置 HTML 单元来处理此异常?
如果有人已经遇到过此类问题,请告诉我们。
非常感谢任何帮助。
提前致谢 !
We are using HTML Unit v2.6 with Web-Harvest and extended its functionality to create a new element
<web session="sess1" browser="firefox2">
<web-getpage url="https://www.linkedin.com/secure/login"/>
<web-setinput name="uname">username</web-setinput>
<web-setinput name="pwd">password</web-setinput>
<web-clickinput name="login"/>
</web>
When we run this we get an exception while the element loads the URL specified. The details are as below:
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot find function hasOwnProperty in object net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "Sizzle" is not defined.
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3651)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3629)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3657)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3676)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3740)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2249)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2216)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1501)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:427)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:263)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3058)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:415)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:520)
... 42 more
As it appears that 'Sizzle' (present in YUI3) is causing this. We then checked the same in Firefox and IE but neither of the browsers showed any error of 'Sizzle' not being defined.
Also we tried to use latest snapshot of htmlunit, but had same issue.
Is this a limitation(bug) of HTML Unit JavaScript engine?
OR
Is there anyway to configure HTML Unit to handle this exception?
If anyone has already had such an issue, please do let us know.
Any help is very much appreciated.
Thanks in advance !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Sizzle 是 jQuery 的选择器引擎。它不包含在 YUI 3 中。
Sizzle is jQuery's selector engine. It is not included in YUI 3.