Micro Focus QTP (UFT) Forums
GetROProperty error when used in a for loop - 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: GetROProperty error when used in a for loop (/Thread-GetROProperty-error-when-used-in-a-for-loop)



GetROProperty error when used in a for loop - JustLag - 05-15-2012

Hi,

I have the below code. It works until I get to the first if statement and leave the page and then return back. Then it breaks with a General Run error. Any ideas?

Code:
Set links = Description.Create
links("micclass").value = "Link"

set allLinks = Browser("BROWSER").Page("PAGE").ChildObjects(links)
link_count = allLinks.count

For i=0 to link_count -1    
    [u][b]url_temp = allLinks(i).GetROProperty("href")    [/b][/u]    
              If inStr(url_temp, "javascript:gotoLINK") then
        url_temp = Replace(url_temp,"javascript:","")
        url_temp = Replace(url_temp,";","")
        Browser("BROWSER").Page("PAGE").RunScript(url_temp)
        Browser("BROWSER").Sync
                           Browser("BROWSER").Page("PAGE").Link("RETURN_TO_HOME").Click
    end if
Next



RE: GetROProperty error when used in a for loop - Ankesh - 05-15-2012

What version of IE are you using??

Are you getting the proper count for child objects? Do check.

Regards,
Ankesh


RE: GetROProperty error when used in a for loop - JustLag - 05-15-2012

Using IE 8 and the child count is correct.