Forum Discussion
I have gotten two types of error messages.
Case 1. If I have high pixel tolerance value
It finds a wrong place and clicks it, this causes an error because after that it tries to look for a pop-up window that should open after clicking the camera. But of course the pop up doesn't exist, because the test has not actually clicked on the camera.
Case 2. I have low pixel tolerance value
No match is found and I got an error saying that None object does not have attribute Left. This is also quite obvious since location is then "None" and it does not have the attribute.
In regards, to your integer rounding suggestion, that's a good point. I hadn't thought about that. However, at least on my own Python version, integer division is rounded to the lower number automatically. For example 7 / 2 results in 3.
Just to help with debugging... have you tried doing a simple recording of clicking on a camera image to see what co-ordinates are used there?
Also, in your first case, what co-ordinates are used for x and y? How far off is the click versus any of the camera icons?
Where my brain is going with this (and this is just me thinking out loud, really), is that the co-ordinates returned by the Find Picture call may be correct with regards to the captured picture... but the grid component itself may have a different resolution or configuration. So, while the pixel location on the image may find a camera correctly at pixel (25,100) (as an example), the grid resolution may have (25,100) at a completely different location. Does that make sense?
- Teemu9 years agoNew Contributor
That doesn't seem to be the issue. I tried changing the way the screenshot of the screen is taken.
Before:Sys.Desktop.ActiveWindow().Picture(
Now:
livi_TLoik_Ui_Karttatyokalu.HwndSource_Shell.Shell.Grid.ContentControl.MainView.MainGrid.MainPanel.MapPanel.ChromiumWebBrowser.Picture()
I did this because I tried recording a script where I manually clicked the nearest camera icon and the script was like below and so now they should at least be using a similar grid and coordinates.
livi_TLoik_Ui_Karttatyokalu.HwndSource_Shell.Shell.Grid.ContentControl.MainView.MainGrid.MainPanel.MapPanel.ChromiumWebBrowser.Click(973, 24)
If my test finds something to click, and I've gotten co-ordinates (9, 5) and (392, 5) so it's quite far off. The (9,5) thing is probably about finding the first possible match or so. And the (392, 5) could be the first urban area it finds as it has a bit similar color than the camera icon.
I'll try some more values for color and pixel tolerance to see if I could find good ones. Is there some easy way to see the image TestComplete thinks was the right one?I tried Sikuli as well and it managed to find the icon just fine. Its approach is looking for the whole area and returning the one with the best match. Is there a way I could do that in TestComplete? I just recently started using TestComplete so I'm not really aware of all the features :)
- tristaanogre9 years agoEsteemed Contributor
If you turn on the visualizer for your project for playback, whenever a click event occurs, TestComplete will take a screenshot showing where the click happens.
I'm still not 100% convinced that there's not a resolution difference between the Grid component and the picture you're capturing but perhaps with the visualizer in place, we can see a bit more about what is being returned by TestComplete.- Teemu9 years agoNew Contributor
Hmm, it seems like the test visualizer is not working as intended for me. I think it was enabled by default, but it doesn't take pictures of the step in question.
Attached is a screenshot of my source code as seen in the TestComplete IDE. We can see that it took a picture on line 22 and shows the whole screen. But does it replace that in the next line with the camera icon?
Then no pictures are taken for a while until at line 36, which is empty, so that is weird. And the picture on line 36 is a picture it should have taken on line 19 and line 19 does not show any pictures taken.
Related Content
- 6 years ago
- 2 years ago
- 11 years ago
Recent Discussions
- 7 hours ago