Sign in to follow this  
Followers 0
Swatcat

AutoIT to Run on remote Desktop

2 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

My one of the friend is also facing the same problem, I am also joined many forums for him to search the solution but unable to found.

 

Dear whenever you get the solution do post here.

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • Trisha
      By Trisha
      I tried (using AutoIt) to automate a scenario where i  have to open IE with specific URL on my extranet(Xen Desktop or Citrix ) ,from there i need to download  file and then through WinSCP; I  have to move that file to another location that can be access from my Local system using VMWare.
      I did as far as the above step. Now i want to navigate from my extranet to my local desktop system. But i am not able to move  from there.Mouse click is also not working.Please find the below screenshot highlighted in YELLOW.
       


    • bbk4163
      By bbk4163
      Hi, 
      I am getting "array variable has incorrect number of subscripts dimension range exceeded" error while executing exe. Not sure what is wrong here. 
      #include <MsgBoxConstants.au3> SelectWindowBasedOnTitle() Func SelectWindowBasedOnTitle()     $winList = WinList()     $wTitle = CheckWindows($winList)    IF $wTitle == "Choose File to Upload" Then             IE()    ElseIf $wTitle == "Open" Then             Chrome()    Else             FireFox()    EndIf EndFunc Func CheckWindows($aArray)     For $i = 1 To Ubound($aArray) - 1         If WinActive($aArray[$i][1]) Then $wTitle= $aArray[$i][0] ;MsgBox(0, "Window Check", $aArray[$i][0] & " is active.")     Next     Return $wTitle EndFunc Func Example()     $wText = WinGetText("[ACTIVE]") EndFunc Func IE()     ControlFocus("Choose File to Upload","","Edit1")     ControlSetText("Choose File to Upload","","Edit1",$CmdLine[1])     ControlClick("Choose File to Upload","","Button1") EndFunc Func Chrome()     ControlFocus("Open","","Edit1")     ControlSetText("Open","","Edit1",$CmdLine[1])     ControlClick("Open","","Button1") EndFunc Func FireFox()     ControlFocus("File Upload","","Edit1")     ControlSetText("File Upload","","Edit1",$CmdLine[1])     ControlClick("File Upload","","Button1") EndFunc  
    • TheWizEd
      By TheWizEd
      How do I work with 2D arrays.  I've tried this but get errors.
      Local $aTest[4][4] = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
      ;$aTest[0][] = [10,11,12]  ; Error at []
      Local $sTest = ""
      For $i = 0 To UBound($aTest)-1
        Local $aExtract = _ArrayExtract($aTest,$i,$i)
        $sTest = $sTest & MyTest($aExtract)
      Next
      Func MyTest($aTemp)
        _ArrayDisplay($aTemp)
        ; Error at    v $aTemp
        Return String($aTemp[0]) & " - " & String($aTemp[1]) & " - " & String($aTemp[2]) & @CRLF
      EndFunc
       
       
    • Valnurat
      By Valnurat
      Hi.
      If I use this code:
       
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $sServiceTAG = "9S1Y3J2" Local $oIE = _IECreate("http://www.dell.com/support/home/uk/en/ukbsdt1/product-support/servicetag/" & $sServiceTAG & "/warranty?ref=captchasuccess",Default,0,0) _IELoadWait($oIE) Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If StringStripWS($oTd.innertext, 7) = "NBD ProSupport" Then $sShipdate = StringStripWS($oTd.NextElementSibling.InnerText, 7) ExitLoop EndIf Next _IEQuit($oIE) MsgBox($MB_SYSTEMMODAL, "Warranty", $sShipdate) My messagebox is empty, but if I use the link first:
      http://www.dell.com/support/home/uk/en/ukbsdt1/product-support/servicetag/9S1Y3J2/warranty?ref=captchasuccess
      and then use my code I get results.
      Can someone help so I don't need to use the link first.
    • Valnurat
      By Valnurat
      Hi.
      I have this:
      november 08, 2015
      How can I convert it to:
      08/03/2015
      I don't see any convert option from month name to a number.
      Thank  you