Best way to confirm images below the page break?

So, I want to confirm a bunch of image in a FireFox winow. 2/3 of them are below the page break.

Typically I just confirm the top third then do some combo of

If imagefound “blah”
else
typetext pagedown
End if

or even more ghetto

repeat 30 times
	Click "BrowserDownArrow"
End Repeat

Is there a better way? My method is rather dicey. If I ever change resolutions or window sizes it all goes south.

The “better” way combines your two approaches:

repeat while not imageFound("blah")
     typeText downarrow
end repeat
click foundImageLocation()

This assumes that pressing the down arrow scrolls the page and that doing so repeatedly isn’t too slow. You can substitute “pageDown” or “space” for downarrow, but you run the risk of the image you are looking for following across the screen boundary, so if you do that, you might want to hedge your bet and scroll up a little:

repeat while not imageFound("blah")
     typeText pageDown
     if not imageFound("blah")  -- check first; also ensures you check the very bottom of the page
          typeText upArrow
     end if
end repeat
click foundImageLocation()

If the image isn’t found, this code will run forever, so you should also either add a check to see if you’re at the bottom of the page (maybe look for the scroll bar at the bottom of the scrolling channel) or just assume that you’ve only got so many screenfulls:

repeat while not imageFound("blah") and repeatIndex() < 10     typeText pageDown
     if not imageFound("blah")  -- check first; also ensures you check the very bottom of the page
          typeText upArrow
     end if
end repeat
Click "blah"

Note that in this last example I’m not using foundImageLocation() since I’ve coded to allow the possibility that the image won’t be found, so I have to make sure that I’m clicking on the right thing. I could also end the code if I didn’t find the image I was expecting:

repeat while not imageFound("blah")
     typeText pageDown
     if not imageFound("blah")  -- check first; also ensures you check the very bottom of the page
          typeText upArrow
     end if
     if repeatIndex() equals 10 then exit all
end repeat
click foundImageLocation()