In UFT/QTP Training series last article “Object Repository Exercise 1” we presented that how to create a shared object repository for the Welcome page of the Mercury Tours Web site.
In Object Repository Exercise 2, you will get to know how to create a shared object repository for each of the remaining pages in the site. Here, UFT will learn all of the objects on each page, it is not require for you to associate the object repositories with a specific action.
Let us know that how to work on it.
First, visit to the Flight Finder page by log-in into the Mercury Tours Web site.
In IE browser, open the URL: “http://newtours.demoaut.com”. The Mercury Tours Web site welcome page will appear, log-in into the site by giving UserName and Password. Once log-in process done, the Flight Finder page appears.
Second, generate a new shared object repository.
If the Object Repository Manager is not opened, open it by visiting Resources > Object Repository Manager in UFT. The Object Repository Manager window opens. Once the Object Repository Manager window opens, click on “New”button to open a blank shared object repository.
Third, set the Define Object Filter to open the Navigate and Learn
To open the Navigate and Learn, go to the opened Object Repository Manager window, select Object à Navigate and Learn will hide both UFT and the Object Repository Manager.From the Navigate and Learn toolbar, click the Define Object Filter button. The Define Object Filter dialog box opens.
Here, UFT will learn all objects of Flight Finder page of the Mercury Tours Web site that match the filter, and those objects to a shared object repository. In the Mercury Tours Web site, refresh the Flight Finder page to bring it into focus for UFT to learn as the Web page.
Next, use Navigate and Learn toolbar and click “Learn” button. Once we click on “Learn” button, the Web page start flickering and the Adding Objects message box displays to represent that UFT has been started adding properties and values of objects of the Web page to a new object repository.
When objects addition done, close the Navigate and Learn toolbar. As soon as we close the Navigate and Learn toolbar, UFT and the Object Repository Manager window becomes visible.
Fifth, save the shared object repository by click on “Save”, it opens the “Save Shared Object Repository” dialog box. Save the file by giving name of the file, here we have used the file name “MercuryToursFlightFinder.tsr” and click OK.
To generate a new shared object repository for the Select Flight page.
To create new shared object repository, just go down to the Flight Finder page of Mercury Tours Web site and click on “Continue” button, it takes you to the Select Flight page. Objects can also be added from this page too.
After setting the Select Flight page, go back to Object Repository Manager window and click “New” button. A blank shared object repository opens.
In the Object Repository Manager window, select Object > Navigate and Learn. The Navigate and Learn toolbar opens that hides both UFT and the Object Repository Manager.
Next, go back to the Select Flight page,refresh the page to bring it into focus for UFT to learn as the Web page.
Sixth, generate object repositories for the remaining objects of Web pages.
Using above process, create new shared object repositories for each of the following pages:
- Book a Flight
- Flight Confirmation
After creating shared object repositories for both “Book a Flight” and “Flight Confirmation” page. Save “Book a Flight” by giving name “
MercuryToursBookFlight.tsr” and Flight Confirmation” by giving name “
Seventh, involve the MercuryToursFlightFinder.tsr object repository with the Flight Finder action.
To do so, go back to the UFT window and open Solution Explorer window. In Solution Explorer window, right-click to the “Flight Finder” action and choose“Associate Repository with Action” from the context menu. The Open Shared Object Repository dialog box opens.
Choose the “MercuryToursFlight Finder.tsr” shared object repository and click Open.
Next, the “Automatic Relative Path Conversation” message box opens, click on “Yes” for further process.
In the Solution Explorer window, you can see the object repository (MercuryToursFlightFinder) at the bottom of the Flight Finder action, as a child of that action.
Eight, just like above mention process, involve the “MercuryToursSelectFlight.tsr”object repository with the SelectFlight action, and “MercuryToursBookFlight.tsr” and “MercuryToursFlightConfirmation.tsr” withBookFlight action.Shown in the figure below.