scrolluntill the Image Found

Hi all ,

I my application i would like to scroll Down untill the one particular Image ,
and i want to capture the screen ,please let me know is there any Commad for the scroll Down untill the Image ,

I have tired This :

scrollto2 "checkStatement/DateITime_TopOfStatement", top

but script keep saying command not found ,

Please help this on out

Thank you

Comments

  • 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
    end repeat
    
    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
    end repeat
    if imagefound().ImageName is "ScrolledToBottom"
    then
    	logWarning "Scrolled all the way to the bottom and did not find the image"
    else
    	log "Found the image"
    	click foundimagelocation()
    end if
    
    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
Sign In or Register to comment.