Jump to content

AutoIT to Run on remote Desktop


Recommended Posts

Hi All,

So I need Help.

I am developing code to handle Authentication Popup For IE. The issue I am facing is that this code runs smoothly on unlock desktop but fails on VM machine and when machine is locked. So could you suggest what should I do to make it work. My automation Tool is a Selenium Based tool and is able to launch the script, but the AutoIT Script is unable to pass the username and password on the authentication popup.

Below is the code.

I am passing the values through Command line arguments.

#include <Array.au3>


Local $browser, $BAuthMode, $BWinAuthUserName, $BWinAuthPassword, $BChromeClaimsURL, $BChromePolicyURL, $BIEPolicyURL, $BIEClaimsURL;
$browser = $CMDLine[1]
$BAuthMode = $CMDLine[2]
$BWinAuthUserName = $CMDLine[3]
$BWinAuthPassword = $CMDLine[4]
$BChromeClaimsURL = ""
$BChromePolicyURL = ""
$BIEURL = ""
;$BIEClaimsURL = ""




If $browser = "chrome" And $BAuthMode = "m"  Then
   If WinExists($BChromeClaimsURL,"") Then
   WinWaitActive($BChromeClaimsURL) ; set control to the window for proxy authentication
   Sleep(500)
   Send("{ESCAPE}")

   ElseIf WinExists($BChromePolicyURL,"") Then
   WinWaitActive($BChromePolicyURL) ; set control to the window for proxy authentication
   Sleep(500)
  Send("{ESCAPE}")

   EndIf

ElseIf $browser = "ie" And $BAuthMode = "m"  Then
   If WinExists($BIEPolicyURL,"") Then
   WinExists($BIEPolicyURL) ; set control to the window for proxy authentication
   Sleep(500)
   Send("{ESCAPE}")

   ElseIf WinExists($BIEClaimsURL,"") Then
   WinWaitActive($BIEClaimsURL) ; set control to the window for proxy authentication
   Sleep(500)
  Send("{ESCAPE}")

   EndIf

ElseIf $browser = "ie" And $BAuthMode = "w"  Then
   WinWaitActive($BIEURL,"","20")
   if(WinExists($BIEURL)) Then
   Sleep(500)
      Send($BWinAuthUserName & "{TAB}") ; send username and press TAB
   Sleep(100)
   Send($BWinAuthPassword & "{ENTER}") ; send the password and press enter
   Sleep(100)
   EndIf




ElseIf $browser = "chrome" And $BAuthMode = "w"  Then

  If WinExists($BChromeClaimsURL,"") Then
   WinWaitActive($BChromeClaimsURL) ; set control to the window for proxy authentication
   Sleep(500)
   Send($BWinAuthUserName & "{TAB}") ; send username and press TAB
   Send($BWinAuthPassword & "{ENTER}") ; send the password and press enter

   ElseIf WinExists($BChromePolicyURL,"") Then
   WinWaitActive($BChromePolicyURL) ; set control to the window for proxy authentication
   Sleep(500)
   Send($BWinAuthUserName & "{TAB}") ; send username and press TAB
   Send($BWinAuthPassword & "{ENTER}") ; send the password and press enter

   EndIf

 EndIf
   WinSetState("[ACTIVE]", "", @SW_RESTORE)
    Sleep(500)
   WinSetState("[ACTIVE]", "", @SW_MAXIMIZE)

 

 

 

 

Edited by Melba23
Added code tags
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...