How to launch chrome incognito using UFT

Using UFT we can launch Chrome incognito with the help of a small program.

First, we will create an object of shell and then we will add an argument “-incognito” in the run statement of the program. This tells the Windows shell to launch Chrome in incognito mode.

Example code. to launch Chrome incognito using UFT
'''***************************************************************************
'Function Name: ChromeIncognito
'Description:	Launches Chrome incognito mode with given URL
'Arguements:	ChromePath= (chrome.exe), URL=(Url of application)
'''***************************************************************************


Function ChromeIncognito(ChromePath, URL) 'Chrome path need to be chrome.exe
  Set oShell = CreateObject("wScript.shell")
  oShell.AppActivate("chrome.exe")
  varChrome = ChromePath &" "& "-incognito " & URL
  oShell.Run varChrome
  Wait 2
End Function

You may also read


Discover more from Automation Script

Subscribe to get the latest posts sent to your email.

Related Posts