Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging to authenticated website

Status
Not open for further replies.

dyan24

Technical User
Sep 7, 2004
56
CA
Hello,

I am posting again my question because i am really desperate to find a solution to this problem. My vbscript is working but not when i schedule it to run on task scheduler and the session is not active. Please HELP!!!!

Here's a snapshot of the script:
set WshShell = CreateObject("WScript.Shell")
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.navigate " wscript.sleep 100
objExplorer.Visible=True

wscript.sleep 3000
WshShell.SendKeys "username"
WshShell.SendKeys "{tab}"
WshShell.SendKeys "password"
WshShell.SendKeys "{enter}"

If sendkeys really would not work on batch job. How do i get around to logging in to this website?

Thanks in advance,
AMA
 
Get to the controls of the webpage and set their text/passward values and then simulate click event or submit event by script. Forget above sendkeys.
 
silly me

graph.cfm?username=mrmovie&password=helloworld
 
Hi tsuji, Can you please expound on how to get controls of the webpage and set the username/passwd values? I am a newbie on vbscript.

Hi mrmovie, thanks for your suggestion but i've tried that before and does not work. The pop-up screen for authentication is still coming up. Do you have any other idea?

Please help. Thanks in advance.
 
what authentication? m$ windows domain authentication?

in the past i wrote something for a bod at work. all i did was watch the 'address' control in IE when after one has supplied username and password to see which page is loaded and what query string is passed to it.

anyway, sorry that is about all the knowledge i have on the subject, not really a waxer web dude
 
>Can you please expound on how to get controls of the webpage and set the username/passwd values?

Suppose the webpage client-side expose a textbox input for username, that control can be accessed by objExplorer.document parent container through document object model (dom) such as:
[tt]objExplorer.document.forms("formname").elements("usernametextbox").value = "username"[/tt]
If you understand the above line, the rest is the same.
 
I explored a similar situation a while back and am sorry to report that you will be unsuccessful in your endeavors.

The security screen you are seeing is being promoted by the web server and is not a part of the web pages themselves. Hence you can not do what was suggested and identify the field names.

The first problem lies in the focus not being set to the login box.

Execute your code to just have the script open the web site and try typing without clicking in the security box and you will see that it does not have the focus Set. This can be overcome by sending Alt Tab and Shift Alt Tab which are:
%{tab}
+%{tab}

Add that after opening and you will see that you now have the focus and can type in the box without clicking.

OK, I've shown you that for academic reasons. Now for the bad news, this type of security box does not allow sendkeys. I can't find my reference to this on the Microsoft web site, but I did find documentation that confirmed this when I was battling the issue.



I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top