This project is read-only.

Excel 2003 Automation

Sep 2, 2009 at 2:43 PM
Edited Sep 2, 2009 at 2:55 PM


I've to write tests for an Excel 2003 Add-In. I'm new to White, but it seems to be very helpful to solve this task.

After reading through the documentation, I tried to write my first tiny test. Starting Excel and getting the window worked fine. Then, I tried to click a button of my AddIn's toolbar:


Application application = Application.Launch(path);
Window window = application.GetWindow("Microsoft Excel - Book1", InitializeOption.NoCache);
Button b = window.Get<Button>(SearchCriteria.ByText("myCaption"));


On clicking this button, a dialog should appear - but it doesn't! The object b is not null, so I guess, I got the correct control.

This is my log4net output:

[2009-09-02 15:48:00,857][INFO ] Using BusyTimeout=5000 for White/Core
[2009-09-02 15:48:00,887][INFO ] Using WaitBasedOnHourGlass=True for White/Core
[2009-09-02 15:48:00,887][INFO ] Using LogActions=False for White/Core
[2009-09-02 15:48:00,889][INFO ] Using WorkSessionLocation=. for White/Core
[2009-09-02 15:48:00,890][INFO ] Using UIAutomationZeroWindowBugTimeout=5000 for White/Core
[2009-09-02 15:48:00,891][INFO ] Using PopupTimeout=5000 for White/Core
[2009-09-02 15:48:00,892][INFO ] Using TooltipWaitTime=0 for White/Core
[2009-09-02 15:48:00,894][INFO ] Using SuggestionListTimeout=3000 for White/Core
[2009-09-02 15:48:00,895][INFO ] Using DefaultDateFormat=Day,Month,Year for White/Core
[2009-09-02 15:48:00,896][INFO ] Using DragStepCount=1 for White/Core
[2009-09-02 15:48:00,897][INFO ] Using InProc=False for White/Core
[2009-09-02 15:48:27,948][INFO ] Using TableVerticalScrollBar=Vertical Scroll Bar for White/UIItemId
[2009-09-02 15:48:27,948][INFO ] Using TableHorizontalScrollBar=Horizontal Scroll Bar for White/UIItemId
[2009-09-02 15:48:27,950][INFO ] Using TableColumn=Row for White/UIItemId
[2009-09-02 15:48:27,950][INFO ] Using TableTopLeftHeaderCell=Top Left Header Cell for White/UIItemId
[2009-09-02 15:48:27,951][INFO ] Using TableCellNullValue=(null) for White/UIItemId
[2009-09-02 15:48:27,952][INFO ] Using TableHeader=Top Row for White/UIItemId
[2009-09-02 15:48:27,952][INFO ] Using HorizontalScrollBar=Horizontal ScrollBar for White/UIItemId
[2009-09-02 15:48:27,953][INFO ] Using VerticalScrollBar=Vertical ScrollBar for White/UIItemId

I can't find anything helpful in it. I used window.LogStructure() and found my button:
ControlType: ControlType.Button
Name: myCaption
Bounding rectangle: 122;263;96;22
IsOffScreen: False
ProcessId: 6992


Do you have any hints for me?


Thanks & best regards



Sep 2, 2009 at 3:08 PM

Ok ok, shame on me!

Button b = window.Get<Button>(SearchCriteria.ByText("xxx"));
works fine!