Jump to content

Array variable has incorrect number of subscripts or subscript dimension range exceeded


Go to solution Solved by Danp2,

Recommended Posts

I have a script that I have created that loops through an html table with pagination. The html table has 10 links that start with link1, link2, link3, etc.. The script clicks on each of these links. After link11 is clicked, the script then proceeds to click on the "Next" button in the pagination and the process repeats again for each link on the 2nd page, 3rd page, 4th page, etc....However, when it reaches page 12 it loops fine until it completes the last link in the page. Any help is greatly appreciated. I receive the following error:

Array variable has incorrect number of subscripts or subscript dimension range exceeded.

 

Edited by goku200
Link to comment
Share on other sites

Are you aware that you have a nested for-next loop with both loops controlled by the same variable $i. ? This can only lead to disaster.

I can't make out where your subscript error comes from, you have not reported which line is generating the error.

Phil Seakins

Link to comment
Share on other sites

1 hour ago, goku200 said:

  $test = _WD_ElementAction($sSession, $aArray2[$i], 'click')

Your acting as if $aArray2 will have at least as many rows as $aArray1.

Because $i is iterating based on $aArray1 size, but being used to reference $aArray2.

Code hard, but don’t hard code...

Link to comment
Share on other sites

Quote

    _WD_ExecuteScript($sSession, 'return history.back()')

Did you try using _WD_Action here?

Quote

    $aArray1[$i] = _WD_ElementAction($sSession, $aArray1[$i], 'text')
    
    Local $aArray2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//td[2]/a", $aArray1, True)

I'm not sure how this is supposed to work. If $aArray1[$i] already holds an element ID, why are you replacing it with the element's text and then attempting to use it as a starting element?

I suggest that you repost your revised script so that we can better assist you.

Link to comment
Share on other sites

  • Solution

Here's my feedback --

  • You've got a While loop in NextPage that shouldn't be there
  • The While loop should be in your main script
  • Inside this While loop, you should --
    • Load $aArray1 with the desired links
    • Call the LoopPagination function to process the links
    • Call the NextPage function to switch to the next page
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...