Micro Focus QTP (UFT) Forums
How to execute RunAs command in QTP? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to execute RunAs command in QTP? (/Thread-How-to-execute-RunAs-command-in-QTP)



How to execute RunAs command in QTP? - ashokghali - 03-03-2008

The AUT opens as Loggged on user. But I want to invoke the AUT as different user and run my BPT. I tried creating the below VB script but what is happening is when I run the VBS from QTP, AUT opens but QTP is recognising AUT as window object instead of Web. Any idea to get rid of this?

VBS Code
Code:
set oShell= Wscript.CreateObject("WScript.Shell")
oShell.Run "runas /user:<UserName> ""c:\Program Files\Internet Explorer\IEXPLORE.EXE <AUT URL>"""
WScript.Sleep 1000
oShell.Sendkeys "<Password>"
Wscript.Quit



RE: How to execute RunAs command in QTP? - Ankur - 03-04-2008

I didn't get that... why don't you simply record the login screen and replay whenever required...whats the problem you are facing in that case?


RE: How to execute RunAs command in QTP? - ashokghali - 03-07-2008

Ankur,
Actually the AUT logs in with logged in system user credentials. There will be no login box for the AUT. To run my script for different users i need to log in as different user and it is not feasible to get installed QTP in all those users profile and test. Appreciate if there is any other approach to do that.

Thanks,
Ashok