This question was asked by Suresh in the comments field.

I am recording using QTP and for some reason QTP does not recognize any upload buttons. For example, start the recording at this site: http://cgi-lib.berkeley.edu/ex/fup.html
Click on the “Browse” button. Notice this click is not recognized by QTP. Please provide some feedback why QTP is not able to recognize this button. Thanks

This is an interesting question and not a typical object identification issue. I thought I will take it up on the blog to make it available to the wider audience.

If you go on the link mentioned above, you will see QTP is not able to record the click on Browse web button. Web buttons are generally associated with input type=submit object but if you see the source of the browse button, you will notice input type=file object.

qtp-type-file-type-submit

Now According to Microsoft help, input type=file object creates a file upload object with a text box AND Browse button. Notice the AND. So, in case of input type=file, the text box and browse button are considered part of ONE object. There are no separate objects for QTP to identify.

What can we do to solve this issue?

Enter Web Event Recording Configuration.

  1. Object Spy on the text box/ browse button object reveals that it is a WebFile type Object. QTP webfile object
  2. Using Tools > Web Event Recording Configuration, go to WebFile (under Web Objects tree). Add onclick event. When QTP does not recognize buttons
  3. Set the onclick event settings to Always. Click ‘OK’.QTP onclick werc
  4. Done!. Record the click on browse button, now QTP should be able to identify the click on the button.

Welcome new readers: Download the Free eBook!

I am Ankur Jain, the owner of LearnQTP and founder of a software organization. This site is run, maintained and updated by me and my team. Feel free to take a look around, you may want to start with What is QTP? 

You can connect with me on twitter @ajonit. 

Please enter your first name and email address below to instantly download the eBook on Optimizing QTP Scripts. In future, we will make sure you get new tips & tricks on QTP delivered direct to your email box.

You have Successfully Subscribed!

Share This