This helps a lot - I just ran into a few problems. When I try to use the Element Exists activity, when I am on the last page of the website, the boolean returns as âtrueâ since the âNext pageâ button is still showing/exists; however, it is greyed out and doesnât have a hyperlink behind it (which the Element Exists apparently doesnât care about). Due to this, when I try the loop you suggested, it goes on forever and will throw no errors to catch and thus I am unable to make the NextPageExists Boolean âfalseâ to exit the loop. Idk if it is possible to have an Element Exists activity that searches for valid elements that have a hyperlink behind them because if that exists, I would just use that and the loop would stop on the last page. Do you know of a better way to do the loop with the âElement Existsâ that doesnât make the bot go in an infinite loop?
Instead, I created a weird workaround where I have a variable that I assign the number of items I would like scraped as well as the maximum amount of items that can be scraped per page. Since each Zillow page has 40 listings, the maximum amount of items that can be scraped per page is equal to 40.
So the work around looks like this:
[My Variables]:
Int ItemsToScrape (how many items I would like to scrape in total) Ă THIS NEEDS THE INPUT from the user
Int MaxPerPage (in this case 40 because Zillow only displays 40 items per page and this is set as the default)
Int ScrapesNextRun (how many items the data-scraping activity should scrape per run)
Int LeftToScrape (after each scrape, how many more scrapes to I want to do Ă This is ItemsToScrape â ToScrapeNext)
While LeftToScrape <> 0 {
If: LeftToScrape - MaxPerPage > 0 {
ScrapesNextRun = MaxPerPage
LeftToScrape = LeftToScrape â MaxPerPage
}
Else if: LeftToScrape - MaxPerPage < 0 {
ScrapesNextRun = LeftToScrape
LeftToScrape = 0
Else (so when LeftToScrape and MaxPerPage are the same) {
ScrapesNextRun = MaxPerPage
LeftToScrape = LeftToScrape â MaxPerPage (in this case, this will equal 0 and then will stop the loop when it gets back to the while)
}
}
Then I did the âRepeat Actionâ activity 7 times (for the pgdn) and then started the data scraping activity for a single page and inside the Properties tab of the data scraping activity, I told it to scrape the amount of the variable: ScrapesNextRun
I then went through the ExtractedData Table, putting the rows in a new data table named âBuiltDataTableâ and then I cleared the ExtractedData Table, otherwise it would not overwrite the information in the ExtractedData Table in the sub-sequential runs of the single page data scraping activity (is that what you meant about the master data table or is there a better solution than what I did?)
} (end of while loop)
Export to Excel Document
End of Program.
I can foresee a problem that if I tell the bot to scrape more listings than are available for the given city, I donât have a way to stop the bot when the ânext page buttonâ is not responsive (the same problem I have with the Element Exists method; however, though this workaround I am able to scan as many items as I choose as long as it does not exceed the amount of listing per city).
Do you have any feedback to my solution or answers to my questions?
Thanks a lot for your help, without your solutions I wouldnât have known how to go on in trying to solve this problem.