![]() |
Flight Selection in Mercury Windows Appln - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Flight Selection in Mercury Windows Appln (/Thread-Flight-Selection-in-Mercury-Windows-Appln) |
Flight Selection in Mercury Windows Appln - sumithra - 08-13-2009 Hello Friends, I tried to record the Windows Mercury Flight application, by 1. logging in 2. reserving a flight 3. selecting the default (first) option of the flight selection dialog winlist 4. inserted order 5. close application Next, I parameterise the values for FlyFrom and FlyTo in Global Sheet This works fine, while replay But when I try to select a flight(point 3 above), say the 2nd or 3rd rows in the list of the flights, because I have parameterised the flight details, the test fails for the 2nd iteration. Pls let me know wht changes I need to make this work. thanks, Sumithra RE: Flight Selection in Mercury Windows Appln - rameshrise3 - 08-13-2009 Hi Sumitra, As you parameterized the test, when you are running 2nd row in the sheet, FlyFrom & FlyTo city values changes, Thus, the flights displayed are totally different from the flights you recorded. Here is the Solution. Select Index for the flight Browser("").Page("").WinList("..").Select(1) you can change the index. Thanks Ramesh RE: Flight Selection in Mercury Windows Appln - sumithra - 08-14-2009 Thanks a lot Ramesh!!!. I wanted to know this for a long time. One more question: I parameterised that Index with a random number. So it will select the flight at random. This executes fine. But I have a doubt here. If I choose a random number between 1 and 10, and if the flight selection options have only 2, assume if the random number chosen is 3 or 4, the test will fail, because QTP will not be able to identify an object. Am i right? But I tried this, and the script passed. It took a random value of 4, 6, 5. thanks again, sumithra RE: Flight Selection in Mercury Windows Appln - basanth27 - 08-14-2009 Get the collection of the items in the winlist. Spy on the winlist and see what are the TO properties which return the "Items Count". If you get that then you can use it this way, a = RandomNumber(0, ItemsCount) You should get a value which is within the total number of flights avaliable. Wasnt this what you were looking for ? RE: Flight Selection in Mercury Windows Appln - sumithra - 08-14-2009 Hi Basanth, Thanks a bunch. This was what I was asking for. I used the RO Property for the "items count" in the Winlist. And used that count value in the Random Number as you had mentioned above. Code: itemCount = Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetROProperty("items count") After execution, I am able to see the different random values that it takes, in the Results Window - Step Name - From.Select But is there any way to observe this result in the QTP window either by using msgbox, print or Debug. I tried all these, but not able to retrieve the flight selected randomly. Any help is appreciated. thanks, Sumithra RE: Flight Selection in Mercury Windows Appln - basanth27 - 08-14-2009 Ahaa...Brilliant !!! Well you did search with most of the keywords, but if you searched with Report or reported you would have found the answer. Well as a token of appreciation for valuing research here is the answer, Reporter.reportevent micpass, "Test Passed", "Whatever text you want to write"&variablename Read about Reporter.Reportevent to know more. RE: Flight Selection in Mercury Windows Appln - sumithra - 08-14-2009 Hi Basanth, Yeah, I know about the Reporter.ReportEvent. This Reporter object displays the value in the Results Window. But I want to know the result in the QTP screen itself before seeing the results window - that is why i tried using print, msgbox, debug viewer to see the value of the flight selected randomly. Thanks for the quick replies, Sumithra RE: Flight Selection in Mercury Windows Appln - basanth27 - 08-14-2009 Msgbox varname should help. Arent you able to see it ? Try this, Code: itemCount = Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetROProperty("items count") |