Excel widgets

Jun 21, 2011 at 10:22 AM
Edited Jun 21, 2011 at 10:25 AM

Hi, I am trying to build a simple automated test env for a suite of spreadsheets we have here. I am having issues getting handles for spreadsheet buttons. In the code below I can start excel, get a handle on the excel window but cannot geta handle on a simple button. Has anyone managed to use white for Excel application automation?

 

var path = @"C:\Automation.xls";

 

Application application = Application.Launch(path);

 

Window window = Desktop.Instance.Windows().Find(obj => obj.Title.Contains("Microsoft Excel"

));

window.Focus();

Button b = window.Get<Button>(SearchCriteria.ByText("CommandButton1"

));

 

Button b1 = window.Get<Button>(SearchCriteria.ByAutomationId("CommandButton1")); // b1 is also null