|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Vb and HTML
i have a internet control in my form to load a webpage (online not offline) which has login textfields (uid/pwd) and submit button. i need to pass the uid/pwd from the vb form to the html text boxes and if possible autoclick the submit button.. sort of form autofill and autologin.. not able to pass the uid and password from text boxes on the form to those one the webpage.. the webpage has only 2 text boxes... tried sendkeys ("TAB") to scroll to the text boxes but aint working ?? any other way ??
|
|
#2
|
|||
|
|||
|
Post some of your code.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
if someone can tell me how to get the button to auto-click my work is almost done.. just one more query .. like one the pages that load has a frameset and both left and right pages are generated by jsp.. when i try to load the source to retrieve info it does the obvious retrieve the source of the frameset and notthe right sided page.. is there any way to get the source of the right sided page when its not a direct html link but generated by jsp.. the file is generated in internet temp folder but i am not able to connect to it .. as if the file doesnt even exist
Last edited by ssk : January 2nd, 2005 at 01:40 AM. Reason: Half of the work figured out |
|
#4
|
|||
|
|||
|
Quote:
this is the html code Code:
<form name="form2" method="post" action="http://www1.pacenet-india.com:7001/...WebApp/MemLogin"> <div align="right"><font face="Verdana" size="2" color="#000066"> <input type="hidden" name="type" value="user"> </font> <input type="text" name="userId" size="12" class= box> <br> <br> <input type="password" name="password" size="12" class= box> <br> <br> <input type="image" src=buttons/login_home.gif name="Submit2" value="Submit" align="middle" width="75" height="22"> </div> </form> this is the vb code Code:
Dim fs As New FileSystemObject
Private Sub Command1_Click()
Set strm = fs.OpenTextFile("c:\form.txt")
Do Until (AtEndOfStream)
On Error GoTo skip
If strm.Line = 6 Then
Text1 = Text1 & vbCrLf & " <input type=""text"" name=""userId"" value = """ & Text2 & """ size=""12"" class= box>"
strm.ReadLine
Else
If strm.Line = 9 Then
Text1 = Text1 & vbCrLf & " <input type=""password"" name=""password"" value = """ & Text3 & """ size=""12"" class= box>"
strm.ReadLine
Else
If strm.Line = 1 Then Text1 = strm.ReadLine Else Text1 = Text1 & vbCrLf & strm.ReadLine
End If
End If
Loop
skip:
strm.Close
DoEvents
DoEvents
DoEvents
fs.DeleteFile ("c:\form.txt")
fs.CreateTextFile ("C:\form.txt")
Set strm = fs.OpenTextFile("c:\form.txt", ForWriting)
strm.Write Text1
strm.Close
DoEvents
Name "C:\form.txt" As "c:\form.htm"
DoEvents
Web.Navigate ("c:\form.htm")
using the above 2 codes i was able to load the username and password to the text boxes of the html page but am still unable to click the submit button. |
|
#5
|
|||
|
|||
|
I'd start by inserting some response.write "got to here" type statements in my asp page for debugging purposes. You can then figure how far through the page your code gets.
If you have any on error resume next statements, take them out. And use <% Option Explicit %> |
|
#6
|
|||
|
|||
|
forget the stupid code in the post above.. i figured it out.
Code:
Dim fs As New FileSystemObject 'needs refernce to scrrun.dll Dim load As Boolean Private Sub Command1_Click() 'navigate to the page and mark load = true for identifying it as start page (as per your needs) Web.Navigate (App.Path & "\form.htm") 'web is microsoft internet control load = True End Sub Private Sub Web_DownloadBegin() Me.Caption = "Loading" End Sub Private Sub Web_DownloadComplete() ' when the form loads then scroll to the text box (as per your needs) pass the uid/pwd and use vbcr to press submit Me.Caption = Web.Locationname If load = True Then Web.SetFocus SendKeys vbTab SendKeys Text2 SendKeys vbTab SendKeys Text2 SendKeys vbCr load = False Else 'else code to do whatever you want with the page that loads after pressing submit End If End Sub this code will help you scroll to text boxes on a page, pass the details there are even press "Enter" on the submit button if properly tabbed using vbsendkeys only thing i need to know, is how to load left and right pages in a frameset coz the site im trying generates pages using jsp no html so i cant directy link using web.navigate. only logic i feel is to access to the page from the temp internet folder.. but then when i use filesystem's fileexists function i get a false.. any way to figure that out ?? or does anyone know a way to copy the entire text content from a webpage that loads in the internet conrol.. i can then sort out the details i need |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Vb and HTML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|