Micro Focus QTP (UFT) Forums
Is this one instance where descriptive programming does not work? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Is this one instance where descriptive programming does not work? (/Thread-Is-this-one-instance-where-descriptive-programming-does-not-work)

Pages: 1 2


Is this one instance where descriptive programming does not work? - chong67 - 06-25-2012

I cant seem to find anything to make it unique on this object here.

It is a Image. Once you click on it, it is suppose to go to the next page.

Here is what QTP10 capture:

Code:
Browser("Delta - Book a flight").Page("Delta - Book a flight").Image("red_arrow").Click

Here is what I did:

Code:
Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").Image("file name:=red_arrow.gif", "abs_x:=1236", "abs_y:=393").Click

The problem is that all the red arrow button have this same name and I cant find anything unique.

About the abs_x and abs_y, if you resize the browser, everything change too. So it is way way too dynamic.

Any trick on this thing?

Thanks for your help!


RE: Is this one instance where descriptive programming does not work? - supputuri - 06-25-2012

Add the Economy(T) webelement which will include the red button and then the Frist(A) webelement webelement with red button. now you can work easly on them. Let me know if you need any details

Sorry, I was referring to OR.

Yes,you can handle this.... But you have to use x,y values so that even if the application is resized the coordinates won't get affected.
But I would not prefer using the co-ordinates until it's mandatory.

other good Options:
1) Use the webtable object so that it will be identified easly.
2) Rather you can create the child item object for the red button using DP and then click on that.
Please let me know if you need any detailed steps.




RE: Is this one instance where descriptive programming does not work? - chong67 - 06-26-2012

Thank you so much Supputuri. I will check this out. Thanks again!


RE: Is this one instance where descriptive programming does not work? - vibhakhandelwal - 06-26-2012

Hi,

You can add one user defined properties to the OR of the image you want to click and then use this user defined property while describing it through DP in the code. So then QTP will use only that RED image.

Regards
Vibha


RE: Is this one instance where descriptive programming does not work? - chong67 - 06-26-2012

Hello everyone.

I am very confused here.

I want to strickly use DP and no recording our using OD. Can give me an example or give me hint?

Tell me which screenshot you would like to see.

Thanks for helping.


RE: Is this one instance where descriptive programming does not work? - chong67 - 06-26-2012

Hello everyone.

I got an update now.

Please see my latest screenshot. I include the Webtable and WebElement.

Keep in mind that this table is very dynamic. We dont know what price and flight will come back. See the first screenshot.

I just cant do DP on it.

QTP says cannot find this below:

Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebElement("class:=opA2_left", "x:=564", "y:=600", "outertext:=Select").Click


RE: Is this one instance where descriptive programming does not work? - chong67 - 06-27-2012

I use this below:

Code:
Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebTable( "html tag:=TABLE", "cols=3", "rows:=6").WebElement("html tag:=DIV", "class:=opA2_left",  "innerhtml:=Select").Click

I am getting this error message below.

I am trying very hard. Please help if you can. Thanks so much!


RE: Is this one instance where descriptive programming does not work? - chong67 - 06-28-2012

Dead in the water.

I knew QTP cant do everything. Or maybe I can do anything. :-)


RE: Is this one instance where descriptive programming does not work? - chong67 - 06-30-2012

1. It seems like QTP will not work if you have a "Click" even with "Web Table" ??? That is what happened on this error msg above.

2. I did this and it work:

Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebElement("class:=fareButton center", "html id:=fareButton2", "x:=536", "y:=577").Click

3. The problem is that when I go to another machine to test it, it doesnt work again. I bet "x" and "y" coordinates are not fix target at all.

4. I dont know what to do next. I will post on other forums and see.

5. If you got clues, let me know. :-)


RE: Is this one instance where descriptive programming does not work? - chong67 - 10-08-2012

I have solve my problem and this code below work!

Code:
Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebElement("html tag:=DIV", "innertext:=Select", "index:=0").Click

It was that easy! Yet I didnt know!