Image comparison and image find problems
I'm testing an application, which has a map with several icons. I couldn't find the icons in the Object Browser. My goal is to find a camera icon on the map and click the icon.
I have found the original icon as a png file in the program files and try to locate that in the map, but it's not finding the icon. I've read the documentation about the Picture.Find method and tried to use the color and pixel tolerance values. Below is the relevant code of my application in Python.
#Starting the application TestedApps.Livi_TLoik_Ui_Kaynnistin.Run() livi_TLoik_Ui_Karttatyokalu = Aliases.Livi_TLoik_Ui_Karttatyokalu hwndSource = livi_TLoik_Ui_Karttatyokalu.HwndSource_Shell grid = hwndSource.Shell.Grid ### #Unrelevant code emitted# ### screenPicture = Sys.Desktop.ActiveWindow().Picture() cameraPicture = Utils.Picture cameraPicture.LoadFromFile("C:\\Program Files\\T-LOIK\\Kartta\\kuvat\\symbolit\\kamera\\s_map_camera_outdated.png") #With a small pixel tolerance value it doesn't find any match, this value finds a wrong place. location = screenPicture.Find(cameraPicture, 0, 0, False, 500,True, 50) Log.Message(location.Bottom) Log.Message(location.Top) Log.Message(location.Right) x = (location.Left + location.Right)/2 y = (location.Top + location.Bottom)/2 grid.Click(x, y)
I also tried the compare function with a screenshot of the icon on the map and the same icon, but that didn't work either.
I have attached the camera icon and a screenshot of the map. There are several of the camera icons on the map and it doesn't really matter which one I would click.
How could I make TestComplete find the image on the map? How could I have debugged this myself?