SetTOProperty issue with WebTable and child obj
Ok guys, I am having an issue and I would appreciate any possible help. It may be that I am just looking at my code and reading what I want to read, but I just cannot figure out this issue I am having.
A little background on AUT. It is a web page that contains a list of web tables. Each web table represents a potential payee. Each payee web table has a list of common child objects that include WebElements, WebEdits, Links, Images, and Weblists. These objects are defined in the OR as child objects to the WebTable("payCenter - individualPayee Table"). The WebTable's defining attributes are html tag, class, and a default Index of 0. None of the child objects use an ordinal identifier.
The payee's can have two delivery methods, 1 being electronic, and 2 being paper check. These delivery types are displayed as a WebElement that I have defined in the OR as WebElement("payCenter - Check Type"). The only difference between the two is the innertext, so I am using a regular expression in the "innertext" attribute (".* days guaranteed delivery").
The goal of the code below, is to iterate through all the webtables on this page until I find the index of the first electronic payment, and the index of the first check payment.
Now for the problem I am having. When I am in the OR Manager, and I change the index of the WebTable object, the child objects inherit this change of the index and are highlighted correctly. However, when I run this script, the WebElement does not appear to be inheriting the change in the index for the WebTable and is always identifying the WebElement in the very first WebTable. [Edit] Forgot to mention that the WebTable is always identified correctly, before and after the index change. So eventhough QTP may be identifying the WebTable that is the third one down on the page, the child WebElement is still always being identified in the first WebTable. [/Edit]
I'm lost at this point. I've tried searching HP's many sites, this forum, and several other blogs and forums that I watch. The thing that confuses me the most is that when I comment out the code from the "payType =" to the "End IF" and step through and check the runtime OR, it appears to be working correctly. Any help would be appreciated. Sorry for the novel, code is below:
QTP 10 up to date on patches
<font class="small">Code:</font><hr /><pre>
For ctr = 0 To (electCount + paperCount - 1)
Browser("Browser").Page("Payment Page").WebTable("payCenter - individualPayee Table").SetTOProperty "index", ctr
payType = Browser("Browser").Page("Payment Page").WebTable("payCenter - individualPayee Table").WebElement("payCenter - Check Type").GetROProperty("outertext")
If payType = "Electronic - 3 days guaranteed delivery" and electFlag = 0 Then
electIndex = ctr
electFlag = 1
ElseIf payType = "Paper check - 5 days guaranteed delivery" and paperFlag = 0 Then
paperIndex = ctr
paperFlag = 1
If paperFlag = 1 and electFlag = 1 Then