Refreshing a Browser Window with QTP/UFT

Hi. Today I will show you how to select a specific browser window, and refresh it using QTP/UFT descriptive programming. This may be useful in situations where the page hasn't loaded correctly and needs to be refreshed. I've recently worked on an application where I was receiving a 404 error on occasion when loading a specific page. In this case, I would set a condition to recognize if the 404 page appeared, and then I used the code below to refresh the specific page. I will use the google home page as an example. If you have some great experience with QTP/UFT already, just copy and paste the code below into your QTP/UFT. Make sure to change the specific object property based on your specific page. This property is highlighted in blue.

Browser("name:=Google").Refresh

 

Steps to refresh a page using QTP/UFT:

1. Go to google.com

2. Click on the spy tool in QTP/UFT

3. Select any object within the google page

4. Click on the top hierarchical node on the object tree. The top item should be the Browser.

5. Select a unique property for the Browser object. This property will be used to uniquely identify the page that you would like to refresh. In this case, I will use the name property. "name:=Google"

6. Copy and paste the name within the code example below

Browser("name:=Google").Refresh

7. Paste this code directly in your action window of QTP/UFT. There we go! You have successfully refreshed a page using QTP/UFT! Now you can make it a bit more complex by adding a condition to recognize if a page has a 404 error. Happy automating!!!

Pin It on Pinterest

Clef two-factor authentication