UFT/QTP is generating wrong code by recording

  • Questions
  • UFT/QTP is generating wrong code by recording
Question ID: 105645
2
0

I record simple action for a treeview control, so I select node, Right-Click on it and once context menu opens, I click on one line in it.
Code, generated by QTP/UFT through recording – don't work


SwfWindow("MyWin").SwfWindow("MyTree").SwfTreeView("myTreeV").RightClick "\\M\\c\\config\\all\\items"
SwfWindow("MyWin").SwfWindow("MyTree").SwfTreeView("myTreeV").SelectMultiple ""
SwfWindow("MyWin").SwfWindow("MyTree").SwfTreeView("myTreeV").Expand "\\M\\c\\config\\all\\items"
SwfWindow("MyWin").SwfWindow("MyTree").SwfTreeView("myTreeV").Select "\\M\\c\\config\\all\\items"
SwfWindow("MyWin").SwfToolbar("SwfToolbar").Select "POS Item Number Maintenance"

Correct code after my edit (moved "Right-Click"line and deleted unnecessary code/script runs fine even without it) – works fine


SwfWindow("MyWin").Activate  
SwfWindow("MyWin").SwfWindow("MyTree").SwfTreeView  ("myTreeV").Select "\\M\\c\\config\\all\\items"  
SwfWindow("MyWin").SwfWindow("MyTree").SwfTreeView  ("myTreeV").RightClick "\\M\\c\\config\\all\\items"  
SwfWindow("MyWin").SwfToolbar("SwfToolbar").Select "POS Item Number Maintenance"  
Marked as spam
Posted by (Questions: 28, Answers: 0)
Asked on October 24, 2014 7:18 pm
13 views
Answers (1)
2
Private answer

If you are having problems recording items and the Application Under Test (AUT) is changing the title, I would recommend changing the Object Identification. To access Options > Select Tools > Object Identification. This enables you to set mandatory and assistive properties, to select the ordinal identifier, and to specify whether you want to enable the Smart Identification mechanism for each test object class. This is only for new (not existing) objects in the object repository and is a configuration per user login per workstation.

The behavior that QTP/UFT recording events out of order I have seen with several other AUT environment. QTP/UFT 11 has expanded the .NET add in to capture more events, attributes, and methods over QTP/UFT10. These changes could explain why QTP/UFT might behave differently than QTP 10 for your AUT. Talking to co workers and field consultants they become aware of the issue and just modify the code to get around the area where the code does not work.

One suggestion, HP has release a .NET Addin SDK if the Addin needs to be modified this is how it can be done. The SDK install is located on the same media as the QTP/UFT install.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on October 24, 2014 7:19 pm
Thank you
( at October 24, 2014 7:19 pm)