Skip to end of metadata
Go to start of metadata
  1. Introduction:

WebUI.authenticate keyword in Katalon Studio would work well on Firefox browser, but the function might not work on other browsers due to unknown reasons. This guide will provide you a workaround solution for handling authentication on different browsers is using autoIT.

This would be applicable for Chrome, Firefox and Edge.

      2. Requirements:

3. Steps Details: 

    1. Working with AutoIt file:

      • Proceed to edit credential to your own account:

        • Open autoIt Script Editor (SciTE)

        • Open (or create new) autoit file with contents:

Change your own credential at “Username” and “Password” fields

WinWaitActive("","Authentication Required","10")
WinFlash("", "Authentication Required",4,500)
If WinExists("","Authentication Required") Then
  Send("Username{TAB}")
  Send("Password{Enter}")
ElseIf WinExists("","Chrome Legacy Window")Then
  Send("Username{TAB}")
  Send("Password{Enter}")
ElseIf WinExists("","Windows Security") Then
  Send("Username{TAB}")
  Send("Password{Enter}")
EndIf
  • Save this file to your desired location. You would have a file with *au3 format. Right click on file and select “Compile Script” option to create .exe file.

             b. Adding steps to call autoIt (*.exe) file in Katalon Studio Script Mode 

WebUI.openBrowser('') 
autoit_prj = '[your_autoit_file_path].exe' 
Runtime.getRuntime().exec(autoit_prj) 
Thread.sleep(3000);
WebUI.navigateToUrl('Your test site url')

For example: 

WebUI.openBrowser('')
 
//Sample path. Change it to your saved location of autoIT script
autoit_prj = 'D:\\PS-Katalon\\AutoIT\\Authentication_Custom.exe'
Runtime.getRuntime().exec(autoit_prj)
Thread.sleep(3000);
 
//Sample URL. Please change it to your authentication URL
WebUI.navigateToUrl('http://the-internet.herokuapp.com/basic_auth')


Now it’s all done. You can run your test case to see how it works.

  • No labels