Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Labels and other objects w/ descriptive programming
#1
Not Solved
Hi there,

Let me give you some background about my application first.

I have a web application that is almost 80% customizable, in other words, all forms vary from page to page and every time there is a possibly the forms change (may have more fields or less, or more required fields or less, etc.).

As a matter of fact if you record a script, it will work only one time as the field names will be changing from one run to the other, therefore my approach was to use only descriptive programming for all the scripts (actions).

This worked for many of the modules but for many others it didn't, so I have some questions:

1. In some pages I have over a thousand controls....so reading reading them and verifying which one I needed didn't work very well. For those I use something similar to:

Code:
Set oDescription = Description.Create()
    oDescription("micclass").Value = micClass
    Set oObject = oBrowser.ChildObjects(oDescription)
    For iCounter = 0 To oObject .Count  - 1
     If oObject(iCounter).GetROProperty("name"))) = sDTControlName Then
       oObject (iCounter).Set(sDTControlValue)
     End If
    Next

So it works cool for many forms, but for those with a lot of objects....it takes years....So the question here.....do you think this is a good approach? Do you have any suggestion for me here?

2. In other cases when creating the array of objects:

Code:
Set oDescription = Description.Create()
    oDescription("micclass").Value = micClass
    Set oObject = oBrowser.ChildObjects(oDescription)

Internet Explorer (7) crashes..... it is IE the one that crashes....but I am sure because of what I am doing in QTP. Now this is only for the highly customized forms.....for the other it always works fine. Do you think I have some sort of process overload or memory leak or something like that?

3. My forms have tables embedded in more tables and so on...so I don't know if there any way to read labels..... for example I would like to read the ID of the form, but when I try to recognize it.....it comes as webelement and I cannot figure it out how to identify it..... if I use a property, such as "innertext".... there will be other webelements without that property or with the property set to null, so the script crashes as the property does not exist or is not supported, how can I read labels?.....using webtables didn't work.....unless I have to get the entire html code and parse for the values...but that's too much no?

4. Lastly... what about the tables.....how can you read a table that does not have a name (property)?.....and once you have, how you manipulate where you are (cell) and what you have (cell content).....could you provide me some guidance?.... I have tried for many days and just can;t make it work....or perhaps I am using the wrong approach.


Thanks for your help, understanding and patience.

Regards,

Juan Luna
Reply
#2
Not Solved
Hey Juan, I don't have any good answers for most of those questions but I do see something in #1 that you are doing in a very inefficient manner. The Description object can take more properties than just "micclass." If you add the "name" property, the ChildObjects method will only return those objects that match the specified "micclass" and "name" saving you TONS of loop time. If you give it the "name" property, and if it is valid HTML on the page, it will only return one object. I would suggest adding html tag as well, but it's not necessary.

Code:
Set oDescription = Description.Create()
oDescription("micclass").Value = micClass
oDescription("name").Value = sDTControlName
'add html tag if you can -->
'oDescription("html tag").Value = "TD"

Set oObject = oBrowser.ChildObjects(oDescription)

If oObject.Count = 1 Then
     oObject.Item(0).Set sDTControlValue
ElseIf oObject.Count > 1 Then
     Reporter.ReportEvent micFail, "Set Custom Object Value", "Object description is not unique"
Else
     Reporter.ReportEvent micFail, "Set Custom Object Value", "Object not found"
End If
Reply
#3
Not Solved
Christian,

Thanks, definitely I was doing it poorly, thanks for the advice....interested in a peer review?

Regards,

Juan Luna
Reply
#4
Not Solved
Peer review? Who's reviewing who?
Reply
#5
Not Solved
You will be reviewing mine, of course.
Reply
#6
Not Solved
I guess contact me by email with more information about what you are interested in me reviewing.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic descriptive Programming issue in Terminal Emulator cprasad 1 1,949 04-25-2019, 08:17 PM
Last Post: Ankur
  UFT Tool support with Descriptive programming laks 1 1,774 07-05-2018, 05:31 PM
Last Post: Ankur
  UFT Descriptive Programming objects not identified in a secure & private intranet env bugfinder2 1 1,828 06-07-2017, 01:41 PM
Last Post: Ankur
  UFT descriptive programming Browser("creationtime:=-1") not always working SOUMYADEEP 0 3,088 01-20-2017, 01:53 AM
Last Post: SOUMYADEEP
  Inserting variable values into Descriptive Programming Functions eske99 2 3,510 12-18-2015, 01:47 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)