Hi all,
Just a quickie for advice. I am screen scraping but wanted to know the "best practice" for error checking the classname/tagname/elementid? I want my code to be as water tight as possible so was thinking a combination of checking the website title page for "Error" and also checking each and every element such as
was thinking of along the lines of
Code
Dim Srch as string
Srch = "ERRORHERE"
on error resume next
Srch = Trim(Doc.getElementsByClassName("col-a")(0).getElementsByTagName("ul")(0).getElementsByTagName("li")(i).getElementsByTagName("a")(0).getAttribute("href"))
on error goto 0
If srch = "ERRORHERE" then
' there is a problemo, go to end of loop and start on next line and record in comments of the element causing the issue
else
' found something
Display More
Is this the best way to handle it? Given website scraping throws up unexpected errors I want to trap, report and move on to next row as potentially the code could be looping hundreds of times, and fetching dozens of web elements so I cant afford for the macro to fall over or error ignored. Thought id ask here