Wednesday 30 December 2015

HP UFT/QTP issue while performing action on object/element in the application

Have you ever observed an issue when UFT has an object in OR and it is able to recognize during execution but when we try to execute that line there is no action performing on the application

Ex: There is a link on the application and Object for that link is available in the Object Repository
Browser("BN").Page("PN").Link("LN").Click

This object is getting identified by highlighting it and also during the debug mode object is exist. But when we execute above line it is not performing actual action. At the same when we do this action manually it is working fine.

The reason behind is these kind of objects required special care to execute. Usually UFT/QTP executes the scripts by taking over the browser application controls. It is required to ask UFT to use Keyboard/Mouse action as user does manually.

In UFT, we have 2 options to execute scripts
1. Taking over the browser controls
2. Use Keyboard or Mouse contol

UFT by default uses approach as taking over the browser controls directly and performing the script execution. Apparently we have to change execution mode from default to Keyboard/Mouse control mode

Below piece of code does this job for us

Setting.WebPackage("ReplayType") = 2 'Mouse/keyboard mode
Browser("BN").Page("PN").Link("LN").Click

When you done this job you can move back to your previous mode again with below link of code
 Setting.WebPackage("ReplayType") = 1 'UFT mode

I hope this will help us to resolve such issues. Your comments are welcome :)

No comments:

Post a Comment