Hi!
Here is my code that should fill in "user" and "password" fields on a webpage ("http://forgarden.ee/tellimus") and then click the button "submit" in webbrowser. But it doesn't work!
It gives me error:Object reference not set to an instance of an object.
Source code from webpage user and pass fields and button:
HTML Code:... <li> <label for="email" class="required"><em>*</em>E-posti aadress</label> <div class="input-box"> <input name="login[username]" value="" id="email" class="input-text required-entry validate-email" title="E-posti aadress" type="text"> </div> </li> <li> <label for="pass" class="required"><em>*</em>Salasõna</label> <div class="input-box"> <input name="login[password]" class="input-text required-entry validate-password" id="pass" title="Salasõna" type="password"> </div> </li> </ul> <p class="required">* Nõutud väljad</p> </div> </div> </div> <div class="col2-set"> <div class="col-1 new-users"> <div class="buttons-set"> </div> </div> <div class="col-2 registered-users"> <div class="buttons-set"> <a href="http://forgarden.ee/tellimus/index.php/customer/account/forgotpassword/" class="f-left">Salasõna läks meelest?</a> <button type="submit" class="button" title="Logi sisse" name="send" id="send2"><span><span>Logi sisse</span></span></button> </div> </div> ...
And here is my VB code:
Code:Private Sub WebBrowser_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser.DocumentCompleted 'Dim ForgardenURL As String 'Dim Pass As String 'Dim User As String 'User = My.Settings.ForgardenUser 'Pass = My.Settings.ForgardenPass 'ForgardenURL = My.Settings.ForgardenURL 'WebBrowser.Document.GetElementById("login[username]").SetAttribute("value", User) 'WebBrowser.Document.GetElementById("login[password]").SetAttribute("value", Pass) 'WebBrowser.Document.GetElementById("send").InvokeMember("click") End Sub
What has gone wrong here?




Reply With Quote