Micro Focus QTP (UFT) Forums
How to get ChildObjects to register table? - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to get ChildObjects to register table? (/Thread-How-to-get-ChildObjects-to-register-table)



How to get ChildObjects to register table? - Tonya S - 09-09-2011

Hello,

I have a webpage that ask you to select coke type, pepsi type, generic type, or none.

Selecting coke sends you to 1 yes or no question followed by an okay before hitting the results page which displays a data table.
Selecting pepsi sends you to 2 yes or no questions before hitting the results page which displays a data table.
Selecting generic or none just goes to the results page which displays a data table immediately.

Selections coke sprite -> yes -> yes leads to no results returned, but all the others returns a table. The automated script runs through all 4 options I am able to run the following just fine:

Quote:1. Generic Sam's Choice, None Coffee, None Water, Generic Big K's
2. Coke Sprite, Coke Coke, Pepsi Mtn Dew, Coke Fanta

But if I throw in:

Quote:3. None Coffee, Coke Sprite, None Water, Coke Coke

the following code insists that countOfTables for test case 3 is zero, even though the table displaying just fine and it is even able to click a button on the table itself.

Code:
Set ODescO = Description.Create()
ODescO("html tag").Value = "TABLE"
ODescO("class").Value  = "resultsBTable"
Set OchildO = Browser("Beverage").Page("Beverage - Beverage Page_2").WebTable("a table").ChildObjects(ODescO)

countOfTables = OchildO.Count

Test Case 3's None Water's table is claimed by the above that the table is not there even though there are 5 columns worth of information being displayed and a look via View Source shows that the table is displaying.

Any test cases thrown before or after test case 3 runs just fine as long as there is Not any combination where Coke type follows a None type or a Generic type which is followed by a Coke type as those would do the same thing as test case 3.

I've tried:

Code:
Browser("Beverage").Refresh

and I've noticed that the problem types will sometimes display a message saying

Quote:"To display the webpage again, Internet Explore needs to resent the information you've previously submitted.

If you were making a purchase, you should click Cancel to avoid a duplicate transaction. Otherwise, click Retry to display the webpage again."

Each type is tested one at a time so that coke type -> yes would be tested first then coke type -> no, then none type, coke type -> yes, etc. so each is independent from each other aside from being on the same list.

How can I get OChildO.Count to actually be the number of tables being displayed?