White Automation

Mar 29, 2012 at 7:50 PM

 

 

 

 

 

 

 

 

Looking for help with my program have it attached to open up a program on my desktop and perform button clicks for pop ups. I get an error executing "var button = sim.Get<Button> (searchCriteria);"

comes up with object NullReference not set to an instance of an object. Anyone recognize why i'm getting this error and why it won't do button clicks on popup windows.

 

 

static void Main(string[] args)

{

 

Application manager = Application.Launch(@"C:\"

 

Window mainWindow = manager.GetWindow("MS");

Simulation(mainWindow);

ZephyrSelect(mainWindow);

manager.Kill();

}

 

private static void Simulation(Window mainWindow)

{

 

Window sim = mainWindow.ModalWindow("MS")

 

 

var searchcriteria = SearchCriteria.ByText("Yes");

 

var button = sim.Get<Button>(searchcriteria);

button.Click();

}

 

//end simulation

 

 

private static void ZephyrSelect(Window mainWindow)

{

 

Window zephyropen = mainWindow.ModalWindow("Config");

 

var searchcriteria = SearchCriteria.ByText("ConfigZeph");

 

var zephyr = zephyropen.Get<TreeNode>(searchcriteria);

zephyr.Click();

searchcriteria =

SearchCriteria.ByText("OK");

 

var button = zephyropen.Get<Button>(searchcriteria);

button.Click();

}

 

 

}

Mar 30, 2012 at 8:05 AM

Hi

 

it seems that  mainWindow.ModalWindow("MS"), don't find the Window you search. Have a look in the mainWindow.ModalWindows() List. or try to get child windows using manager.GetWindows().

 

Throndorin