|
-
Sep 6th, 2009, 10:28 AM
#1
Thread Starter
New Member
Webbrowser Session maintaining problem
I have created an application for automated form filling in a website.Basically i have to through 2 pages Login page and then the form filling page.Instead of going through two different pages,two times,I have prefered navigating the second page itself.That way if i am not logged in, the login page automatically comes up and then after filling in my credentials it auto redirects me to my page.
Now the problem is sometimes some sites dont redirect,so to deal with it I kept a timer for this purpose.After 6 secs after the login page I forcibly navigate to the second page via wb.navigate("http://abc.com/page2.htm")
Sometimes randomly,it again takes me to the login page although it previously shows I am logged in.....
I tried finding the solution to this but everywhere i found some answers of how to maintain session between 2 new windows.I have only ONE IE mshtml WEBBROWSER I am navigating all sites through that.
Now what could be the problem???
It seems as if the session is breaking when i forcibly navigate the second time,even though i am using one webbrowser.Moreover sometimes it works,sometime it doesnt 
Part of my code
VB2008 Code:
wb.Navigate(CPath) '1st page navigation
WaitTillLoad()
If LoginPresent Or LoginPresent1 Or LoginPresent2 Or LoginPresent3 Then
DirectCast(GetCurrentWebForm(index1).item(Username), mshtml.HTMLInputElement).value = TextBox1.Text
DirectCast(GetCurrentWebForm(index1).item(Password), mshtml.HTMLInputElement).value = TextBox2.Text
If RememberMe <> "" Then
DirectCast(GetCurrentWebForm(index1).item(RememberMe, 0), mshtml.HTMLOptionButtonElement).checked = True
End If
If Login <> "" Then
DirectCast(GetCurrentWebForm(index1).item(Login, 0), mshtml.HTMLButtonElement).click()
Else
GetCurrentWebForm(index1).submit()
End If
pause(5000) 'Waiting 5secs to redirect
wb.Navigate(CPath) 'Redirecting to 2nd page forcibly irrespective it redirected succesfully or not
WaitTillLoad()
End If
Anyone has better logic,please contribute
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|