markp24 Posted August 2, 2017 Share Posted August 2, 2017 Hello, I am trying to automate a vpn pop test I am able to get all the automation working except with IE11 (required for cisco vpn pop, does not work with ff or chrome) i am able to request the username, password, store them as variables, then launch the vpn pop address get past the Certificate warning screen, then the username and password prompt appear. I have tried send and controlsend but they either do not send to that window, ot send to the address bar in that window. any ideas on how to get it to write to the username and password field would be great. here is the code so far.... (IE picture attached #include <Constants.au3> #include <IE.au3> ; ; AutoIt Version: 3.0 ; Language: English ; Platform: Windows 10x 64 with IE 11 ; Author: Mark ; ; Script Function: ; Opens a designated VPN POP connection, rund a Pingtest powershell script, then disconnects the CPNpop and connects to the next vpn POP in the list. ; $title = "Nielsen - Sign In - Internet Explorer" $username_field = "userName" ;that's how it's named in the standard Internet Explorer credentials window $password_field = "passwordDisplayed" ;that's how it's named in the standard Internet Explorer credentials window ; Prompt the user to run the script - use a Yes/No prompt with the flag parameter set at 4 (see the help file for more details) Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "VPN POP Testing", "This script will run the VPN POP testing. Do you want to run it?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $iAnswer = 7 Then MsgBox($MB_SYSTEMMODAL, "AutoIt", "OK. Bye!") Exit EndIf ; progess bar ProgressOn("Load Program", "Open Program", "0%") For $i = 10 To 10 Step 10 Sleep(10) ProgressSet($i, $i & "%") Next ProgressSet(100, "Full Load", "Complete") Sleep(500) ProgressOff() ; obtain users credentials $name = InputBox ("/username", "Please enter your Username", "", "*M") Do $pass = InputBox ("Password", "Please enter your password", "", "*M") $ConfirmPass = InputBox ("Password", "Please Confirm your password", "", "*M") If $pass <> $ConfirmPass Then MsgBox (48, "Error", "Passwords do not match!!") Until $pass = $ConfirmPass ; open the list of VPN POPS $fh=FileOpen("c:\utils\vpnpop.txt") ; connect and Test through all listed POP connctions for $i=1 to 5 $POP=FileReadLine($fh) ; verify variable values (TO BE REMOVED in FINAL VERSION) ; msgbox(0, "values", "the vaules of name are "& $name) ; msgbox(0, "values", "the vaules of pass are "& $pass) ; msgbox(0, "values", "the vaules of pop are "& $POP) ; run IE with VPNPOP address ;ShellExecute ("iexplore", $POP) $O_IE = _IECreate($POP) _IELinkClickByText ($O_IE, "Continue to this website (not recommended).", 0, 0) ; Sleep(200) ; ControlSend($title, "", $username_field, "^A") ; select the text ; ControlSend($title, "", $username_field, $name) ; ControlSend($title, "", $password_field, "^A") ; select the text ; ControlSend($title, "", $password_field, $pass) ; ControlSend($title, "", $password_field, "{ENTER}") ; press enter ControlSend("Cisco - Sign In - Internet Explorer", "", "", "$name{TAB}$Pass{ENTER}") ;Send("name") ;Send("{TAB}") ;Send("pass") ;Send("{ENTER}") ; Send($name) ;Send($pass) ;Sleep(500) ; WinWait ( "title" [, "SSL Network Extender - Internet Explorer"]) ; Run the powershell ping test script ; Run("C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell_ise.exe C:\utils\PowerShell-Scripts\pingtest with logging .ps1") ; Wait for powershell to complete WinWaitActive("[CLASS:Powershell_ise]") WinWaitClose("[CLASS:Iexplorer.exe]") Next WinWaitClose("[CLASS:IExplorer]") ; Finished! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now