Rank: Newbie Groups: Member
Joined: 3/9/2015 Posts: 1
|
Through Windows app i want to login into website using webcontrol automatically and i need to search and browse the web pages .. here is my eg: In load event Quote: Dim webAddress As String = "http:XXXXXXXx" ' WebControl2.WebView.Url = webAddress WebControl2.WebView.LoadUrlAndWait(webAddress) WebControl2.WebView.EvalScript("document.getElementsByName('username')[0].value = 'xxxxxx';") WebControl2.WebView.EvalScript("document.getElementsByName('password')[0].value = 'yyyyy';") WebControl2.WebView.EvalScript("document.getElementsByName('username')[0].focus();") WebControl2.WebView.EvalScript("document.getElementsByName('password')[0].focus();") WebControl2.WebView.SetFocus() SendKeys.Send("{TAB}") SendKeys.Send(ControlChars.Cr) it works fine but i could't access the page which i have loged in, i have to download a link from the redirected page, How to do it?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
The code you have is fine, I do not understand you what you meant by "I couldn't access the page which I have logged in" though. If you can explain in details, we might be able to provide some additional information for you.
Another method to do automatic login is to use LoadRequest. You simply create a Request object, add the post data item, then use LoadRequest to load the request. This is more reliable than SendKeys and Focus since sometimes focus can not be successfully set.
Thanks!
|