Cannot set property "innerHTML" of null to...

Help
2009-03-01
2013-04-26
  • Hi,
    i having some throuble trying to load an webpage, im using JAVA language. Unfortunately Rhino dont provide a cool messages...

    im trying to load this webpage:
    http://www.receita.fazenda.gov.br/Aplicacoes/ATCTA/cpf/ConsultaPublica.asp
    don't worry about captcha, im breakin it up...just help me to solve this problem.
    A pice of code:

      URL imageURL = new URL("http://www.receita.fazenda.gov.br/Aplicacoes/ATCTA/cpf/ConsultaPublica.asp");
      URL captchaURL = null;
      WebConversation wc =new WebConversation();
      WebRequest  wr = new GetMethodWebRequest(imageURL.toString());
      WebResponse wp = wc.getResponse(wr);

    Here is the error message on NetBeans 6.5 using Ubuntu 8.10:
    run:
    org.mozilla.javascript.EcmaError: TypeError: Cannot set property "innerHTML" of null to "<img class="menuBackGrndImg" id="menuBackGrndImgId0" src="/images/menu/g1_botoes.gif" style=" "><div class="barraMenu barraMenuGrupo1" style=""><a class="botaoMenu Grupo1" HREF="/Grupo1/PF.asp" >Pessoa Física   </a><a class="botaoMenu Grupo1" HREF="/Grupo1/PJ.asp" >Pessoa Jurídica  </a><a class="botaoMenu Grupo1" HREF="/Grupo1/Aduana.asp" >Aduana e Comércio Exterior</a></div>" (httpunit#12)
            at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
            at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
            at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3563)
            at org.mozilla.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3589)
            at org.mozilla.javascript.ScriptRuntime.undefWriteError(ScriptRuntime.java:3611)
            at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1505)
            at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3063)
            at script.MontaMenu(httpunit:12)
            at script.x(httpunit)
            at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
            at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
            at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
            at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
            at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
            at com.meterware.httpunit.javascript.ScriptingEngineImpl.doEventScript(ScriptingEngineImpl.java:131)
            at com.meterware.httpunit.scripting.ScriptableDelegate.doEventScript(ScriptableDelegate.java:70)
            at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:819)
            at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:80)
            at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEngineFactory.java:62)
            at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44)
            at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:159)
            at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
            at captchabreaker.Form1.jButton1ActionPerformed(Form1.java:104)
            at captchabreaker.Form1.access$000(Form1.java:40)
            at captchabreaker.Form1$1.actionPerformed(Form1.java:74)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6134)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5899)
            at java.awt.Container.processEvent(Container.java:2023)
            at java.awt.Component.dispatchEventImpl(Component.java:4501)
            at java.awt.Container.dispatchEventImpl(Container.java:2081)
            at java.awt.Component.dispatchEvent(Component.java:4331)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
            at java.awt.Container.dispatchEventImpl(Container.java:2067)
            at java.awt.Window.dispatchEventImpl(Window.java:2458)
            at java.awt.Component.dispatchEvent(Component.java:4331)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    com.meterware.httpunit.ScriptException: Event 'javascript: MontaCabecalho(); MontaMenu(); onLoad()' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot set property "innerHTML" of null to "<img class="menuBackGrndImg" id="menuBackGrndImgId0" src="/images/menu/g1_botoes.gif" style=" "><div class="barraMenu barraMenuGrupo1" style=""><a class="botaoMenu Grupo1" HREF="/Grupo1/PF.asp" >Pessoa Física   </a><a class="botaoMenu Grupo1" HREF="/Grupo1/PJ.asp" >Pessoa Jurídica  </a><a class="botaoMenu Grupo1" HREF="/Grupo1/Aduana.asp" >Aduana e Comércio Exterior</a></div>" (httpunit#12)
            at com.meterware.httpunit.javascript.ScriptingEngineImpl.handleScriptException(ScriptingEngineImpl.java:64)
            at com.meterware.httpunit.javascript.ScriptingEngineImpl.doEventScript(ScriptingEngineImpl.java:135)
            at com.meterware.httpunit.scripting.ScriptableDelegate.doEventScript(ScriptableDelegate.java:70)
            at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:819)
            at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:80)
            at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEngineFactory.java:62)
            at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44)
            at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:159)
            at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
            at captchabreaker.Form1.jButton1ActionPerformed(Form1.java:104)
            at captchabreaker.Form1.access$000(Form1.java:40)
            at captchabreaker.Form1$1.actionPerformed(Form1.java:74)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6134)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5899)
            at java.awt.Container.processEvent(Container.java:2023)
            at java.awt.Component.dispatchEventImpl(Component.java:4501)
            at java.awt.Container.dispatchEventImpl(Container.java:2081)
            at java.awt.Component.dispatchEvent(Component.java:4331)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
            at java.awt.Container.dispatchEventImpl(Container.java:2067)
            at java.awt.Window.dispatchEventImpl(Window.java:2458)
            at java.awt.Component.dispatchEvent(Component.java:4331)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    BUILD SUCCESSFUL (total time: 12 seconds)

    Tank-you,
    Vinicius