Need easy way to update values in QTP code.

  • Questions
  • Need easy way to update values in QTP code.
Question ID: 105540
1
0

I need to edit some values in my QTP code, but I need to find an easy way to do it. I don’t want to use Replace with regular expressions or anything complicated like that. Here’s some sample code (my real list is a bit bigger):

Browser("MyWebSite").Page("MyWebSitePage").WebEdit("MyList1").Set "Value 1"
Browser("MyWebSite").Page("MyWebSitePage").WebEdit("MyList2").Set "Value 2"
Browser("MyWebSite").Page("MyWebSitePage").WebEdit("MyList3").Set "Value 3"
Browser("MyWebSite").Page("MyWebSitePage").WebEdit("MyList4").Set "Value 4"

I want to change the values at the end of the code to new values pasted from a data list. Is there any easy way to do it?

Marked as spam
Posted by (Questions: 338, Answers: 20)
Asked on July 29, 2014 2:55 pm
4 views
Answers (1)
1
Private answer

There's a neat feature in QTP that most people don't know about. Not sure if there's an official term for it, but I call it Vertical Selection. This works best when you have symmetrically similar lines of code, like yours.

To do it, first have the values you want to paste copied into your clipboard. Next, select the top value horizontally like you normally would, but keep holding down the left mouse button. When you have the value selected, hold down the right mouse button too and then drag down to select the values below.

Check out this little video I made showing this in action:

[Vertical Selection][1]

[1]: http://www.ftporasi.com/EyeOnTesting/QTP/Vertical_Selection/Vertical%20Selection.wmv

Marked as spam
Posted by (Questions: 16, Answers: 748)
Answered on July 29, 2014 2:59 pm
That's really cool. I did not know about that feature!
( at July 29, 2014 3:03 pm)