You are seeing that error because “scrollto2” is not a defined command in SenseTalk. It’s going to be invalid, unless it is the name of a handler that you have created, and you’re passing the image name to that handler to do something with.
For this scenario, you will want to use a repeat loop: http://docs.testplant.com/?q=repeat-loops
Your code might look something like this:
Repeat until imageFound("checkStatement/DateITime_TopOfStatement")
ScrollWheelDown 2 -- One of a few different ways to scroll. The 2 indicates how many increments the scroll wheel moves down
It’s often good to give it a backup though, so your script doesn’t end up in a recursive loop if the image is never found. For this, you could add an image of the scroll bar all the way at the bottom, or an image that will only be found at the very bottom of the page. Then your script might look like this:
Repeat until imagefound("checkStatement/DateITime_TopOfStatement","ScrolledToBottom")
TypeText DownArrow -- another way to scroll down
if imagefound().ImageName is "ScrolledToBottom"
logWarning "Scrolled all the way to the bottom and did not find the image"
log "Found the image"
You can see above that I used the foundImageInfo() function to get further information about which of the two images was found: http://docs.testplant.com/?q=content/image-searching-commands-and-functions#imagefound