I am trying to automate application testing, and I am stuck in a problem that I am trying to fix.
The application has standard buttons for Windows, and I tried using both AutoIT and User32 DLLs to click. Sometimes buttons are pressed correctly (yay!), And sometimes they fail (boo!) - but even worse, AutoIT is convinced that he pressed the button (double-boo!), Which then generates false positives (triple-boo!). When I saw that he was convinced, I mean that he returns that the click was successful when it was not.
I run the application on Win Server 2K8, there is nothing special in this application, except that it uses MDI windows, and some of them are contained in MDI windows. Some of them, however, are not included in MDI windows (for example, the login window before the parent window is created).
Here is my order of commands:
Find the button in the window (success, always) Take the foreground window (success) Activate the window (success) Button active (success) Button focus (success) If the button is focused and the button is on, click it. (Success / Failure, unpredictable behavior. I cannot narrow down why this sometimes succeeds and why it sometimes fails ...)
Other information:
Sometimes in the order a button is clicked that should open another window. This window is closed, then the button is pressed again - and this time nothing happens. In other cases, it works as expected.
I work as an administrator, and UAC is completely disabled.
This is not a time issue, as far as I know, because I'm sure that the button is focused and on before trying to click on it, and I see that the button really focuses on it.
And, as I mentioned, I also tried this with a simple call to User32 / SendMessage, and this also fails.
Last but not least, this does not happen when I manually interact with the application. I have always had valid button presses.
Any thoughts?
UPDATE
Here's another variable for the equation that I should have mentioned - it happens in a virtual machine (because where I need to run it). I can conduct limited testing on my machine, but in order to get true testing, it must be on a virtual machine. Clicking on my own block box seems reliable, which makes it even more mysterious.
I tried this on another virtual machine and it works there too. As for the two virtual machines, they work with the same version of Windows, the same version of my application, the same version of AutoIT, etc.
I reduced it to one detail - that, as luck would have it, I wonβt be able to configure myself, and I need to deposit a ticket to change any configuration. The difference in configurations is as follows:
On a virtual machine in which it does not work , the device manager displays a mouse, which is a vmware mouse. On the virtual machine in which it works The device manager displays a mouse, which is a PS / 2 mouse. Obviously, both are soft mice, but now I wonder if the VMWare mouse can act differently and make the buttons not always work. I'm not sure how likely this solution is, because, in my understanding of this, using the User32 SendMessage call doesn't actually use the mouse, but instead sends the same message that the mouse would send, but it's worth it ...