White Issues and solutions

Aug 30, 2011 at 7:22 PM
Edited Aug 30, 2011 at 7:23 PM


I've been working with White for the last couple of days. I ran into some issues so I thought I'd share the issues I've encountered and solutions I found.

Basic tests not working on Windows 7 64-bits

Issue: Simple actions like entering text into a textbox would not work on my Windows 7 64-bit station.

Solution: Run tests using nunit-x86.exe (32-bits) instead of nunit.exe (64-bits). If you're running the test using Resharper, look at this StackOverflow question for solutions.

Cannot access items in a large form with a lot of data

Issue: A simple call like "form.MenuBar" hangs infinitely in a large form with tables and lists containing tons of data.

Solution: What happens here is that there is a timeout of 5 seconds by default, and it takes longer than that to find elements if there are a large number of elements, so it keeps timing out and retrying repeatedly. The first thing you should do in this case is configure the BusyTimeout so that the value is higher than 5000 milliseconds (I would set it to a very high value at first, to make sure that the timeout is never the source of your problem). Look here for details on how to set up your app.config, in which you can configure the BusyTimeout value.

Slow performance in a large form with a lot of data

Issue: Altough the tests now work with a higher value for BusyTimeout, there is still a performance issue. It takes a very long time to find items in the form.

Solution: The key is to limit the search depth. Make sure to set RawElementBasedSearch to true when performance can be an issue. And don't set MaxElementSearchDepth to a needlessly high value, which will make it go through every single row and cell of a Table.

Cannot access submenus on Windows XP

Issue: One of our computers runs on Windows XP and the test would fail to get any submenu of the main menu.

Solution: Downloading this update from Microsoft for UI Automation on Windows XP solved the problem.

Cannot access rows of a Table (DataGridView) on non-english version of Windows

Issue: When calling the Rows property of a Table automation object, no row is returned, even though there are rows in the table. This happens on a french version of Windows.

Solution: White retrieves some objects using the Name property which is automatically set by Windows. Seems like this name is a localized name describing the object. For example, table rows have names like "Row 0", "Row 1", but in french they are actually named "Ligne 0", "Ligne 1", etc. So in french, White fails to find items starting with "Row " because they start with "Ligne " instead. The solution is to configure White so that it uses the localized keyword. I now have this row in my app.config: <add key="TableColumn" value="Ligne " />.