Mrugson Posted June 9, 2009 Posted June 9, 2009 Hello,I am writing a simple VBS script that should, as one of its functions, open IE, go to a certail website and log user on to it with username and password saved within the script (password does not have to be encrypted in any way as the only purpose of the script is automation and it will be used by a single user only).So far I 've got somthing like this:Set wshShell = WScript.CreateObject ("WSCript.shell") Set IE = CreateObject("InternetExplorer.Application") IE.visible = 1 IE.navigate ("<logon website address>")The username and password for the website is not the same as credentials for Windows domain logon.Any help much appriciated...
vaska94 Posted June 9, 2009 Posted June 9, 2009 try Set wshShell = WScript.CreateObject ("WSCript.shell") Set IE = CreateObject("InternetExplorer.Application") IE.visible = 1 IE.navigate ("http://user:password@somesite.com")
Mrugson Posted June 14, 2009 Author Posted June 14, 2009 It's not working for this particular website, thanks though.Tried to get the script to find 'input' fileds and fill them out but got lost as could not get names of the filedsfrom the site and finally managed to log in using 'wshshell.sendkeys' which is kind of primitive...Maybe you can advise something more universal?Thanks in advance.
CoffeeFiend Posted June 14, 2009 Posted June 14, 2009 IE.navigate ("http://user:password@somesite.com")That only works for sites using basic authentication (most aren't these days).For other sites, you have to know in advance the url the login http form posts to (which you'd find out by looking at the page source), you need to know which fields are on the said page (varies from a site to another), you'll also have to url encode the login & password (in case they contain "special" chars), then finally you make the http post using a XMLHttpRequest object.
Mrugson Posted July 12, 2009 Author Posted July 12, 2009 Hi,Finally got it to work with IE.navigate("http://website?username=username&passwor=password")...CoffeeFiend, your method seems better but I hev some difficulties getting it to work properly eventhough I got the source code of the webiste.Any simple example code maybe to set me onto right track?Cheers anyway!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now