Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flight Selection in Mercury Windows Appln
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
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 ?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Solved: 11 Years, 4 Months, 4 Weeks ago
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")

Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select RandomNumber(0, itemCount)

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
Reply
#6
Solved: 11 Years, 4 Months, 4 Weeks ago
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.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#7
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#8
Solved: 11 Years, 4 Months, 4 Weeks ago
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")
msgbox itemCount

a = RandomNumber(0, itemCount)
msgbox a
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT 12.53 trial version not recognizing its sample flight application login/password NehaRB 2 3,992 10-07-2016, 06:49 PM
Last Post: pradeep537
  Path of Flight reservation Window is not recorded in HP UFT 12.52 version mailtokopalverma@gmail.com 1 2,730 04-01-2016, 05:34 PM
Last Post: vinod123
  Weblist selection diya 11 21,483 06-16-2015, 08:27 PM
Last Post: rajpradeep32
  Issue related to dropdown selection(Please help urgent) excellentpawan123 2 4,311 05-31-2014, 12:00 PM
Last Post: excellentpawan123
  Selection of sub menu in Windows Desktop application Shilpa859 0 2,449 10-17-2013, 06:39 PM
Last Post: Shilpa859

Forum Jump:


Users browsing this thread: 1 Guest(s)