How to Record a Script in Chrome Browser in UFT

Before the introduction of UFT, QTP could only do the recording on the Internet Explorer browser. However, QTP was able to playback the same recorded scripts on different browsers like Google Chrome, Mozilla Firefox, etc. However, UFT is a very advanced and powerful tool loaded with lots of features and capabilities.

Using UFT you can record and playback scripts on the following browsers.
  • Microsoft Internet Explorer (32 bit)
  • Microsoft Internet Explorer (64 bit)
  • Google Chrome
  • Mozilla Firefox
  • Apple Safari(on remote Mac Machine)
  • Chrome Emulator
  • Phantom JS

In this tutorial, I will show you how to use UFT Record and Run Settings to record a script on the UFT supported browsers. The following is the example to record a script on Chrom browser. However, you can follow the same steps to record and run the script on other browsers by selecting the required browser in UFT Record and Run Settings.

How to Record a script in Chrome Browser in UFT

To record or run a UFT script on a required browser go to Record>Record and Run Settings. The record and run settings window will be shown.
 
Record a script in Chrome Browser in UFT
 
From the browser list box selects the required browser on which you want to either record or playback your UFT automation scripts. Also, provide the URL of the required application and click on the OK button.
You will see the following floating bar on the top right corner of the UFT editor. You can click on the small square button to stop recording when you are done with recording a script.
 
Record-Script-in-uft
 

Now if you start recording, UFT will automatically invoke the specified browser and open the provided URL. It will identify the objects in the same fashion as it does on Internet Explorer. You can also see the number of steps recorded on this floating bar.

You can record a script in one browser and run the same on another browser. For example, you can create or record a script on Internet Explorer and run the same on Mozilla Firefox and Google Chrome, etc.
 

How to Run a script on the desired browser Using Code

To run a test script on the required browser follow the below syntax.
 
SystemUtil.Run “Browser .exe file path” , “URL”

Here I have shown the example of opening the HPE demo mercury application on internet explorer and Google Chrome. These scripts run successfully on both browsers without any issue. In the same fashion, you can invoke any supported browser by UFT and run your automation scripts. You can write the rest of the automation script after invoking the desired URL on the required browser.

Note: You can use UFT Record and Run Settings if you are a novice on UFT and trying to learn UFT. Having said that, one should control the automation script flow rather than UFT record and run settings.

Recommended Posts

Leave a Reply