kk-dev11
kk-dev11

Reputation: 2674

QTP: How to identify a object which was created while the script was running?

Now I am testing a online shop website with QTP.

The occured problem is quite tricky. I already have an account, so I order a product, It will automatically show up my billing address.

What I need to test is that if I were to change this address, this address should be added in "my address"I can set the typed address in a variable. like (newaddress= "Sk ks, ....") But the problem is I could not identify the created object. Because it was created during the script was running. Has anybody got an idea?

enter image description here

myQTP script to find the "SK ks ... " SPAN.

Set mypage = Browser("Browser").Page("Micasa")

If mypage.webelement("html tag:=span").Exist(3) Then       'or even class:=headline
    msgbox "it exists"
Else
    msgbox "doesn't exist"
    End if
End if

Upvotes: 1

Views: 3909

Answers (2)

Motti
Motti

Reputation: 114685

There should be no problem identifying objects that were created during the test run. If QTP doesn't find an object it waits a bit and tries again. Your problem seems to be finding a good description for the WebElement you're looking for.

Looking at the comments on AutomatedChaos's answer it seems that you have a very minimal description (only the html tag). If this is really all you know about your WebElement you can use Visual Relations Identifiers (using QTP11) to find your element.

Upvotes: 1

AutomatedChaos
AutomatedChaos

Reputation: 7500

It is hard for me to understand what exactly the problem is, but let me try to help you.

Have you tried putting a breakpoint on the part that gives you trouble? After placing a breakpoint, you can run your script and it automatically breaks on the point of the breakpoint. From there, you can use the GUI spy and the Object Repository (I assume you use the O.R. and do not use Descriptive Programming?) to detect the object to make the description in the O.R. more generic.

Upvotes: 2

Related Questions