Alright I have a script that logs into live.com
, through this:
WebBrowser1.Document.GetElementById("login").SetAttribute("value", txtUsername.Text)
WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", txtPassword.Text)
WebBrowser1.Document.GetElementById("SI").InvokeMember("Click")
It's pretty basic, but now what I need is to find out if the user has typed a correct or wrong account credentials. So this would require an error message saying "Could not log in", but if it is successful I'll just redirect the webbrowser to a new page. Now i'm not familiar with IF statements on VB, but I do know that there is 2 ways this can be done, but don't know how to do it. So the 1st way is to read the URL it goes to after hitting the submit button, this would be pretty nice and work (so when someone type's incorrect account credentials it would send them to a error page, but when you type in the right one it would send you to the right page). But the main way I want to do it is through reading the content. If the page reads "That Microsoft account doesn't exist. Enter a different email address or get
" after submitting, then message box "Wrong Account Credentials
", then vice versa. I am not good with this because I have never really worked with the WebBrowser, but if anyone can lead me into the right way i'd be very thankful.