08-24-2009, 05:40 PM
(This post was last modified: 08-24-2009, 05:52 PM by HazleVillage.)
The purpose of checking the existance of the child ("Import") page twice is this:
The first ...Page("Import").Exist statement checks if the page is visible initially (maybe opened by a previous testrun). If not, the page will be openend explicitly.
The second ...Page("Import").Exist statement is just error handling: If the testscript is unable to open (or recognize) the page, exit test instead of runnning in an ugley exception.
Of course I could place the second within the inner Else -branch of the first conditional structure. The reason why I didn't is that I places this statement subsequently - when I realized that there could be a problem in opening the page.
Maybe I should explain the workflow of the application under test -it's a locally running web application - more detailed.
- Initially there is a home page providing access to several functionalities of the application, e.g. the "Import" functionality
- By clicking on the desired link, a new tab will be opened showing the web page of the corresponding functionality (e.g. "Import")
- In this case the browser contains two tabs: One for the homepage, one for the child page
- When recording QTP identifies both elements on the home page and the child page
- When running the test starting with the homepage (no child page opened) the "Import" link is clicked and the child page opened. But then QTP is unable to recognize the child page
- If you start the test with the child page already opened (regardless if it is opened by a previous testrun or manually), the test passes
Michael
The first ...Page("Import").Exist statement checks if the page is visible initially (maybe opened by a previous testrun). If not, the page will be openend explicitly.
The second ...Page("Import").Exist statement is just error handling: If the testscript is unable to open (or recognize) the page, exit test instead of runnning in an ugley exception.
Of course I could place the second within the inner Else -branch of the first conditional structure. The reason why I didn't is that I places this statement subsequently - when I realized that there could be a problem in opening the page.
Maybe I should explain the workflow of the application under test -it's a locally running web application - more detailed.
- Initially there is a home page providing access to several functionalities of the application, e.g. the "Import" functionality
- By clicking on the desired link, a new tab will be opened showing the web page of the corresponding functionality (e.g. "Import")
- In this case the browser contains two tabs: One for the homepage, one for the child page
- When recording QTP identifies both elements on the home page and the child page
- When running the test starting with the homepage (no child page opened) the "Import" link is clicked and the child page opened. But then QTP is unable to recognize the child page
- If you start the test with the child page already opened (regardless if it is opened by a previous testrun or manually), the test passes
Michael