Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White UIAutomation click() stops working on different platform

I'm using White to automate the BDD testing of our C# WPF UI.

My first couple of tests are working well on my development machine (running Windows 7). However, when I try and run the same code on the build server (virtual machine running Windows server 2003 R2) it doesn't work correctly. In both cases the tests are run from the command line and the tests are using the Cuke4Nuke framework. In the case of the server I am accessing the server via Remote Desktop Connection.

The code looks like:

var application = Application.Launch("whiteApp.exe");
var initializeOption = InitializeOption.NoCache;
var windowCriteria = SearchCriteria.ByText("whiteApp");
var window = application.GetWindow(criteria, initializeOption);
var criteria = SearchCriteria.ByAutomationId("rightButton");
var button = (Button) window.Get(criteria);
button.click();

The problem is that the buttons click event is not fired when it is run on the server. The button can be clicked (using the mouse) if the UI is left open after White has finished executing. One interesting point is that after the click method is run that the button does show evidence of being clicked as in the picture below, in the case of other buttons the mouse over effect is shown.

Button before and after click

like image 354
Klee Avatar asked Apr 12 '11 06:04

Klee


1 Answers

I'm not sure if this is your problem or not, but I've noticed that White has a few issues when it is used by applications built using the AnyCPU platform and run on an 64-bit system. For some reason, anytime it attempts to move the mouse under these conditions, it automatically pushes the mouse to the bottom of the screen instead of the requested location. This means a click command misses the button it was told to click on.

If you build the automation application as an x86 application, White automates the mouse properly.

like image 166
Harry Steinhilber Avatar answered Nov 20 '22 15:11

Harry Steinhilber