Results 1 to 6 of 6
  1. #1

    Launching IE session in “Run As” mode

    <font color="blue">
    I’m looking to find-out a way to replicate the scenario of launching the Internet Explorer running in different user other than the one who had logged into the console using “Run As” in QTP.

    What I have tried is the combined usage of “SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE","","C:\Program Files\Internet Explorer","runas"” and using sendKeys submitting the dialogue with Domain/username/password. And it works well. I also looked into http://www.sqaforums.com/showflat.ph...;Number=478291
    This hangs there without the solution.

    Is there any way easier than above.

    ~ thankS.


  2. #2

    Re: Launching IE session in “Run As” mode

    There are few 3rd party utils that allow you to do this. So you can may be use that.

  3. #3

    Re: Launching IE session in “Run As” mode

    Thanks for the update Tarun. However, we may not relay on 3rd party tools when we have our customized test suite. May be if you can spell few 3rd party tools that you aware of, I could probably analyse what they are doing and try to replicate the same within scripting or combination of other scritping languages like Perl [ that could be controlled within QTP ].

    Also - do you aware of any open source [Open GL licensed] tools I'm checking for the same and will update the post if I find one !!


  4. #4

  5. #5

    Re: Launching IE session in “Run As” mode

    Solution: I'm able to code a 3 liner solution by using Wscript.Shell object. Here is the code piece

    Set objShell = CreateObject("WScript.Shell")
    objShell.run "%comspec% /K runas /user:&lt;domain&gt;\&lt;username&gt; C:\PROGRA~1\INTERN~1\IEXPLORE.EXE"
    objShell.sendkeys "&lt;Password&gt;{ENTER}EXIT{ENTER}"

    It will launch the console, run IE as the user specified with password provided and get killed by itself [img]/images/graemlins/smile.gif[/img]


  6. #6

    Re: Launching IE session in “Run As” mode

    Sub runascommand (a1,a2,a3)
    On Error Resume Next
    dim WshShell,oArgs,FSO

    set oArgs=wscript.Arguments


    set WshShell = CreateObject("WScript.Shell")
    set WshEnv = WshShell.Environment("Process")
    WinPath = WshEnv("SystemRoot")&amp;"\System32\runas.exe"
    set FSO = CreateObject("Scripting.FileSystemObject")

    rc=WshShell.Run("runas /user:" &amp; sUser &amp; " " &amp; CHR(34) &amp; sCmd &amp; CHR(34), 2, FALSE)
    Wscript.Sleep 30 'need to give time for window to open.
    WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to
    WshShell.SendKeys sPass 'send the password to the waiting window.

    set WshShell=Nothing
    set oArgs=Nothing
    set WshEnv=Nothing
    set FSO=Nothing
    End Sub

    runascommand "username", "pass","C:\Program Files\Internet Explorer\iexplore.exe"



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:43 PM.

Copyright BetaSoft Inc.