|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help to Italyfill fields automatically in a WEB page and then submit the request. I really need it for getting automatically rates from low cost airline but I am testing it with Google. I am writing the following code in VB.net AxWebBrowser1.Navigate("http://www.google.com") doc = Me.AxWebBrowser1.Document 'Get htmldocument Dim ricerca As mshtml.HTMLInputTextElement = doc.getElementsByName("q").item(, 0) 'get inputbox ref ricerca.value = "Italy" 'Input value Dim submitButton As mshtml.HTMLInputButtonElement = doc.getElementsByName("btng").item(, 0) submitButton.click() 'click the button I get this error on the last line: An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication1.exe Additional information: Object reference not set to an instance of an object Is there anyone who can help me? Thanks in advance. Luca This error message means that the object reference is set to Nothing.
So for example if I do this. Dim myClassInstance As MyClassType then myClassInstance.MyMethod I will get the same error because I did not instantiate a new object of Type MyClassType or set myClassInstance to reference for an existing object of that type. Looking at your code doc.getElementsByName("btng").item(, 0) You have probably made a mistake with the line here perhaps the name "btng" is incorrect and it does not return an object. HTH Show quoteHide quote "Luca" <vi***@tin.it> wrote in message news:1139763295.711051.263190@g44g2000cwa.googlegroups.com... > Hello from Naples Italy, I need help to develop an application that > fill fields automatically in a WEB page and then submit the request. I > really need it for getting automatically rates from low cost airline > but I am testing it with Google. I am writing the following code in > VB.net > > AxWebBrowser1.Navigate("http://www.google.com") > > doc = Me.AxWebBrowser1.Document 'Get htmldocument > > Dim ricerca As mshtml.HTMLInputTextElement = > doc.getElementsByName("q").item(, 0) 'get inputbox ref > ricerca.value = "Italy" 'Input value > Dim submitButton As mshtml.HTMLInputButtonElement = > doc.getElementsByName("btng").item(, 0) > submitButton.click() 'click the button > > I get this error on the last line: An unhandled exception of type > 'System.NullReferenceException' occurred in WindowsApplication1.exe > Additional information: Object reference not set to an instance of an > object > > Is there anyone who can help me? > Thanks in advance. > Luca > Thanks Terry but btng is how google calls the button, you can see it in
html page of google so my question is: why my instruction does not return anything? Can you help with this Its a bit difficult without actually working on it. Suffice to say that this
is not returning the object and thats where you need to concentrate. Show quoteHide quote "Luca" <vi***@tin.it> wrote in message news:1139782264.155595.174790@f14g2000cwb.googlegroups.com... > Thanks Terry but btng is how google calls the button, you can see it in > html page of google so my question is: why my instruction does not > return anything? > Can you help with this > Thanks Terry, I really apologize to bother you, I usually work with VB
and I am not very familiar with .net,I am getting crazy with this. I am looking for a way to fill fields in a WEB page and update in an Access table the result. Please give me a line to follow and I will offer you a good pizza when you come to Naples.
Is there a difference between passing "" and passing Nothing to a Windows API ?
Moving a project from 2003 to 2005 Time? UI Design question 2003 0r 2005 Several TexBox in a form of an array Using GetOleDbSchemaTable and Visual Basic .NET for MS-Access and SQL Server Express TCP/IP Socket communication from multiple clients Need help with LastIndexOf vb 2005 email |
|||||||||||||||||||||||