goku200 Posted January 26, 2022 Posted January 26, 2022 (edited) 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 February 19, 2022 by goku200
Danp2 Posted January 26, 2022 Posted January 26, 2022 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 Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted January 26, 2022 Author Posted January 26, 2022 (edited) 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 January 26, 2022 by goku200
Danp2 Posted January 26, 2022 Posted January 26, 2022 25 minutes ago, goku200 said: That just skips the first row in the spreadsheet 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 Â Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted January 26, 2022 Author Posted January 26, 2022 (edited) 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 January 26, 2022 by goku200
Danp2 Posted January 26, 2022 Posted January 26, 2022 Sorry, but that doesn't make sense to me. That line was from _ExcelFunction, not htmlTable, Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted January 26, 2022 Author Posted January 26, 2022 (edited) 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 January 26, 2022 by goku200
Danp2 Posted January 26, 2022 Posted January 26, 2022 I'm sure there's a way to make the script do what you desire, but I can't debug your entire script for you. Try adding some error checking / logging to help you identify where your logic is wrong. Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted February 2, 2022 Author Posted February 2, 2022 (edited) @Danp2i was able to figure it out. I created an If and Else statement and then inserted a for loop. Edited February 2, 2022 by goku200 Danp2 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now