一个爬虫方法报错了,
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException 信息: Caught script exception ======= EXCEPTION START ======== Exception class=[net.sourceforge.htmlunit.corejs.javascript.EvaluatorException] com.gargoylesoftware.htmlunit.ScriptException: Invalid negative index: -1 (http://www.youdao.com/scripts/tgl.js#1) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:601) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:555) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1082) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:399) at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:260) at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:276) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:680) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:639) at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1170) at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1072) at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3074) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2041) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:918) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:897) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:243) at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:188) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:434) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:309) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:363) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:350) at com.spider.main.web.EmailSpder.main(EmailSpder.java:92) Caused by: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: Invalid negative index: -1 (http://www.youdao.com/scripts/tgl.js#1) at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.runtimeError(StrictErrorReporter.java:81) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1028) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1075) at com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.item(StyleSheetList.java:118) at com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.get(StyleSheetList.java:145) at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:2358) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectIndex(ScriptRuntime.java:1518) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectIndex(ScriptRuntime.java:1509) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.doGetElem(Interpreter.java:2302) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1267) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:405) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:275) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3031) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:546) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:654) ... 31 more Enclosed exception: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: Invalid negative index: -1 (http://www.youdao.com/scripts/tgl.js#1) at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.runtimeError(StrictErrorReporter.java:81) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1028) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1075) at com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.item(StyleSheetList.java:118) at com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.get(StyleSheetList.java:145) at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:2358) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectIndex(ScriptRuntime.java:1518) at net.sour
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
写爬虫的童鞋可以试试神箭手云爬虫,自带JS渲染、代理ip、验证码识别等功能,还可以发布和导出爬取的数据,生成图表等,都在云端进行,不需要安装开发环境。