Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
7 years ago

Subscript out of range: '[number: 0]'

props = Array("tagName", "idStr")
values = Array("a","showMore")
Show_More_Link = page.FindAll(props, values, 10)
Delay(10000)
Show_More_Link(0).Click                    'Click on show more link to check existing users

But after Click, It only giver problem in Internet Explorer 11. Below is the error shown in test log
Subscript out of range: '[number: 0]' 

How to fix this problem

1 Reply

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    The error may mean that either

    a) the link was not found or that

    b) the result array was not converted for JScript/JavaScript code.

     

    For the case a) - can you confirm with the ObjectBrowser that the sought for link does exist? Note, .FindAll() result will be 'visually reverted', i.e. the first element of the array will reference the last sought for element on the screen. Note2, in case you don't need to search for all links on the page, there is no reason to use .FindAll() because of performance considerations. .Find()/.FindChild() is much better in this case.

     

    For the case b) - if your test code is in JScript/JavaScript, the resulted array must be converted to the JScript array format (https://support.smartbear.com/testcomplete/docs/scripting/specifics/jscript.html#arrays for more details)