3

I am new to QTP and programming in general, but my current task is to create automated tests using QTP 9.2 for a multi-page web application. My script was working fine during an earlier build, but now it seems as if the programmers have renamed some of the page names, so the script times out during execution because it is unable to find the objects in the Object Repository.

Is there a more efficient way to use QTP, so I don't have to do so much rework if the programmers change the titles of pages, etc?

Thanks... GB


This line of code is no longer working because the title of the browser/page has been changed from "REVIEW DOCS" to "REMOVE ALL DOCUMENTS":

DAF=Browser("REVIEW_DOCS").Page("REVIEW_DOCS").Frame("main").WebElement("DAF").GetROProperty("innertext")

I know of at least one other page that has been changed and may come across a few more as the scripts continues through.

Thanks for any assistance...

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
GBinEG
  • 31
  • 1
  • 2

4 Answers4

3

This depends on what you mean by the word Page.

If you mean:

Web Page

Probably the objects which aren't being identified are Frame test objects. You should reach the place where the object isn't identified and update the Frame's description in the object repository (you can use regular expressions to be more general). If you're using a later version of QTP Maintainance Run Mode will make this much easier (but as far as I remember it was introduced after QTP 9.2).

If you mean:

Page Test Object

By default the Page test object doesn't have any identification properties and it is used in order to group the other test objects in a logical manner. This means that you can move test objects from one Page to another and they should continue being able to run successfully.

Community
  • 1
  • 1
Motti
  • 110,860
  • 49
  • 189
  • 262
  • 1
    +1 since as usual Motti puts out the real-but-not-obvious-truth, like the fact that QTP does not differentiate between pages by default. (I'd add that QTP even hides the difference between a page and a browser window so you can adress a page even if the browser is configured to never show page tabs.) – TheBlastOne Jul 20 '11 at 12:36
1

If you are able to add the Page Object in the Object Repository.Then it is best to use "Regular Expression" to your Page Object's Property Value .

May this link help you:-http://www.learnqtp.com/regular-expressions-regularized/

1

One way to deal with this sort of issue is to apply static descriptive programming to your QTP scripts as opposed to relying solely on the Object Repository. In your situation, you could use an inline .* regex for the title property and a generic Browser miccclass property to deal with page objects with a title that often changes:

Set DAF = Browser("micclass:=Browser").Page("title:=.*").Frame("main").WebElement("DAF").GetROProperty("innertext")

QTP should then find the RO property you are setting the variable "DAF" to regardless of the page title.

Phonesis
  • 323
  • 3
  • 12
0

You need to go into the Object Repository and expand the Browser REVIEW_DOCS and the Page REVIEW_DOCS to update the page object to reference the new name.

PBMax
  • 242
  • 3
  • 15