Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Sending input to an HTML form when controlling IE

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,79
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Sending input to an HTML form when controlling IE
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Sending input to an HTML form when controlling IE - 6/1/2001 11:31:34 AM   
  winkumpel

 

Posts: 11
Score: 0
Joined: 5/23/2001
From: Netherlands
Status: offline
I want to automate the logon proces for a website. I can open IE from vbscript and make it load the page I want but I can't use the sendKeys function to input text into the username box. Does anyone have a way of getting the text in the HTML form and submiting it?
 
 
Post #: 1
 
 Re: Sending input to an HTML form when controlling IE - 6/1/2001 11:32:34 AM   
  varcesi

 

Posts: 12
Score: 0
Joined: 5/23/2001
From: Italy
Status: offline
Not really sure what you want to do but I just made a Login page. The receiving page has to be .ASP

On your login page in the form have two text boxes and a Submit button.
I called my text boxes Login and Password.

here is the form code for that.
-----------------------------------
<form action="page_your_calling.asp" method=get>
<p align="center"><font size="5">Test Login Form</font></p>
<p align="center"> Login <input type="text" name="login" size="20"></p>
<p align="center">Password <input type="text" name="password" size="20"></p>
<p align="center"><input type="submit" value="Submit" name="LoginButton"><input type="reset" value="Reset" name="B2">
</p>
</form>

-------------------------------

On the recieving page here is the code to check the login in SQL database.
---------------------------------
'the request.querystring("login") is the exact same name as the text box on the previous pages form.


<%login=request.querystring("login")%>
<%pass=request.querystring("password")%>

<br>
<%
Set Conn = server.CreateObject("ADODB.Connection")
Conn.Open "driver=SQL Server;server=yourserver.com;uid=yyyy;pwd=xxx;database=yourdatabase;"
Set RS1 = Conn.Execute("SELECT * From Customers Where [WEBLogin] = '" & login & "' AND [WEBPassword] ='" & pass & "'")
<%
If Not RS1.EOF Then%>
' Now if the have a vaild login then do what ever here

<%Else
' have a link to take them back and try again
Response.Write("Sorry Invalid Login")%>
<a href="login.asp">Retry Login</a>
<%Response.Write("Or Call whoever at 1-999-999-9999 for a Login")
End If
%>


---------------------------------------------------

The following is passed in the Address from the first page to the second when thye click the submit button.
------------------
http://www.yoursite.com/page_your_calling.asp?login=login_they_keyed_in&password=password_they_keyed_in&LoginButton=Submit
-----------------------
Which is simply the name of the .ASP you are calling and a ? mark and the exact names of the textboxes
then = sign then what was keyed in the textbox then & ampersand and the next textbox and so forth.
The login in button name is passed but I'm not doing anything with it.

(in reply to winkumpel)
 
 
Post #: 2
 
 Re: Sending input to an HTML form when controlling IE - 6/1/2001 11:33:51 AM   
  winkumpel

 

Posts: 11
Score: 0
Joined: 5/23/2001
From: Netherlands
Status: offline
Not quite what I wanted to know!!

Right i'll tell you what i've got.

I use this line to open up IE:

Set ie = Script.CreateObject "InternetExplorer.Application")

I then use this line to make IE open the page I want:

ie.Navigate "http://www.mypage.com";

I then wait for my page to open. Once the page is open I want to be able to put some text into the input boxes. SendKeys seems the most likely call to use but I get errors saying sendKeys is not supported.

SO my question to all you lot out there is what can I use to put the text into the input box. (NO ASP ANSWERS PLEASE)

(in reply to winkumpel)
 
 
Post #: 3
 
 Re: Sending input to an HTML form when controlling IE - 6/1/2001 11:35:20 AM   
  adminkoe

 

Posts: 117
Score: 0
Joined: 12/23/2000
From:
Status: offline
Don't use sendkeys, use the IE object to control the web page:

Set ie = Script.CreateObject "InternetExplorer.Application")
ie.Navigate "http://www.mypage.com";

do while ie.busy
'wait for document to finish loading
loop
ie.document.forms(0).UserName.value="springy"
ie.document.forms(0).Password.value="pwd"
ie.document.forms(0).submit



Regards,
Andi Zain

(in reply to winkumpel)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Sending input to an HTML form when controlling IE Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts