Quantcast
Channel: Pochampalli IT Labs
Viewing all articles
Browse latest Browse all 261

AutoIT script for windows based chrome authentication in Selenium or Cucumber

$
0
0
Hi,

The following AutoIt script can be used for windows based chrome authentication.

1. Open the website in chrome with windows based pop-up.
2. Open the AutoIT tool and move the "Finder Tool" on to the window.
3. Make a note of "Title" and "Class" of the window.
4. Use the following script with values updated with the "Title" and "Class".
5. Save the file, for example : atuoit_chrome_credentials.au3  (extension should be .au3)
6. Compile the script (right click from the location where the file is saved and compile).
7. Compile generates .exe file , in this case it is : atuoit_chrome_credentials.exe

Call the .exe file before the website get loaded in java file


Runtime.getRuntime().exec("\path to the .exe file\"+autoit_chorme_credentials.exe);


AutoIT code snippet

;RequireAdmin ; unsure if it's needed
;$iSleep = 2000
Opt("WinSearchChildren", 1)
$sUsername="admin"
$sPassword="PaSSWorD2%"
Sleep(1000)
For$i=1To20Step1
Sleep(3000)
$sTitle=WinGetTitle("Sign in")
If$sTitle="sadakar.network.com - Google Chrome"orWinWaitActive("[CLASS:Chrome_WidgetWin_1]") orWinWaitActive("Sign in") Then
Send($sUsername)
Send("{TAB}")
Send($sPassword,1);$SEND_RAW (1)
Send("{TAB}")
Send("{ENTER}")
Exit0
Else
ContinueLoop
EndIf
Next
Exit1


How to find Title and Class from AutoIt tool ? 



Auto reads the credentials while the program runs for chrome based windows authentication pop-up.



- Sadakar Pochampalli


Viewing all articles
Browse latest Browse all 261

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>