Jump to content

Loop goes to next URL when next page is clicked on paginated table instead of continuing to iterate through


goku200
 Share

Recommended Posts

I'm having an issue with my html paginated table. The script work as expected. It reads the html table and clicks on the Download button. However when it clicks on the next page its not iterating the items. instead it goes to the next URL from the spreadsheet and then iterates through the html table clicking the Download button and so on. Not sure why its doing that. I want it to click the next page and then continue iterating then after it has reached the end of the pagination go to the next url in the spreadsheet and repeat the process. Below is my script. Any help is appreciated 🙂

 

 

Edited by goku200
Link to comment
Share on other sites

Since we can't run your script, we can only make educated guesses at why it isn't functioning properly.

Quote
        Local $Skipline = 0 ;0==> first line

        Local $temprf

Why are these being declared inside a For loop? Can you explain why you even need $Skipline?

Quote
        ;Find the table of all the IDs

Did you investigate using _WD_GetTable here?

Quote
        Local $aArray1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//td[8]/a", $sElement, True)

This line appears to be problematic because it --

  • wipes out the previously built array by the same name
  • is being used within a For loop where the upper bound is based on $aArray1
Link to comment
Share on other sites

20 minutes ago, Danp2 said:

Since we can't run your script, we can only make educated guesses at why it isn't functioning properly.

Why are these being declared inside a For loop? Can you explain why you even need $Skipline?

Did you investigate using _WD_GetTable here?

This line appears to be problematic because it --

  • wipes out the previously built array by the same name
  • is being used within a For loop where the upper bound is based on $aArray1

Thanks @Danp2 for the reply. 

Local $Skipline = 0 ;0==> first line

Local $temprf

That just skips the first row in the spreadsheet

I didn't use _WD_GetTable because I didn't think it was practical for what I'm trying to accomplish. Instead I used _WD_FindElement.
 

Edited by goku200
Link to comment
Share on other sites

15 minutes ago, Danp2 said:

Couldn't you just change your loop? For example --

For $i = 1 To UBound($aArray2) - 1
; instead of
; For $i = 0 To UBound($aArray2) - 1

 

I just tried that and it downloads the second row in the html table. but it still only does the 24 items on the html table and then goes to the next URL instead of going to the second page and then repeating the process of clicking on the download link.

Edited by goku200
Link to comment
Share on other sites

9 minutes ago, Danp2 said:

Sorry, but that doesn't make sense to me. That line was from _ExcelFunction, not htmlTable,

Yes that works when changing it to 1 from 0 in the Excel function, but it still navigates to the second URL in the spreadsheet after it has looped through the html table with the 25 items instead of continuing to the second page and so on... Is there a way to make it where if the next button is not found in the table to navigate to the second URL in the spreadsheet after it has looped through the HTML table. So basically finish looping through the html table and the end if the next page link is not found navigate to the next URL on the spreadsheet. 🙂

Edited by goku200
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

×
×
  • Create New...