Forum Discussion

didacher's avatar
didacher
Occasional Contributor
10 years ago

Check Image (Regions) dynamically using a function

Hi all,



I am using VBScript in my keyword testing. I use the following line in order to compare on the fly images with stored images (regions).



result = Regions.myStoredImage.Check(liveImage, True, False, 20, 60)



I want to implement a function that takes as arguments the on the fly image object and the name (string) of the stored image region:



Function compareImages(liveImage, storedImage)



And use it like this:



result = compareImage(liveImage, "myStoredImage")



How could I implement that? I can't do this:



Function compareImages(liveImage, storedImage)

    compareImages = Regions.storedImage.Check(liveImage, True, False, 20, 60)

End Function





1 Reply

  • I think the following are equivalent



    Regions.myStoredImage

    Regions.Items("myStoredImage")



    Try this instead:



    Function compareImages(liveImage, storedImageName)

      compareImages = Regions.Items(storedImageName).Check(liveImage, True, False, 20, 60)

    End Function