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

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.