VB script

Posted by Shivanichhabra4u under Others on 3/12/2009 | Views : 3243 | Status : [Member] | Replies : 1
Dim wShell
Dim IE


Set IE = CreateObject("InternetExplorer.Application")
set wShell= WScript.CreateObject("WScript.Shell")
IE.Navigate "http://localhost/"
IE.Visible = True
Wscript.Sleep 6000
IE.Document.All.Item("Username").Value = "m10623"
IE.Document.All.Item("Password").Value = "Swetha03"
wShell.AppActivate "IE"
wShell.SendKeys "{ENTER}"


--I am getting following error please help me out
---------------------------
Windows Script Host
---------------------------
Script: D:\Documents and Settings\m10688\Desktop\How to run acc.vbs
Line: 10
Char: 1
Error: Object required: 'Document.All.Item(...)'
Code: 800A01A8
Source: Microsoft VBScript runtime error

---------------------------
OK
---------------------------




Responses

Posted by: Vuyiswamb on: 3/18/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
try this

Dim wShell

Dim IE
Set IE = CreateObject("InternetExplorer.Application")
set wShell= WScript.CreateObject("WScript.Shell")
IE.Navigate "http://localhost/"
IE.Visible = True
Wscript.Sleep 6000
IE.d ocument.a ll.i tem("Username").Value = "m10623"
IE.d ocument.a ll.i tem("Password").Value = "Swetha03"
wShell.AppActivate "IE"
wShell.SendKeys "{ENTER}"


Please Look at the Bolded part. Be carefull about case sensetivity.
Just a guess: the login button is not named "Login". Your seventh line
of code references a control in the All collection by name:
All.Item("Login"). If that is not the name of the button object, it
would return Nothing, and you would get an "Object Required" error when
you tried to invoke its Click method.

Hope it help. Looking forward for you reply

Thank you for posting at Dotnetfunda
[Administrator]

Shivanichhabra4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response