Button Click Problem

Jan 11, 2011 at 12:44 PM

Hi ,
I have to implement autotest on a program which already exist. I have a problem with a button click :

string path = @"C:\Users\dxa\Documents\Visual Studio 2010\Projects\Bluetooth\BluetoothApp\bin\Debug\BluetoothApp.exe";
            
            // launch the application thanks to the path
            Application application = Application.Launch(path);

            // Get the window called Bluetooth Test
            Window window = application.GetWindow("Bluetooth Test", InitializeOption.NoCache);
            
            // Get the buttons of the windows thanks to their nane
            Button scanBtn = window.Get<Button>("scanBtn");
            Button sendBtn = window.Get<Button>("sendBtn");
            System.Windows.Forms.MessageBox.Show(scanBtn.ToString());
            ListBox deviceList = window.Get<ListBox>("deviceList");

            scanBtn.Click();

 

 But an other programs I have created and tested before works fine with that too so I do not understand. 
string path = @"C:\Users\dxa\Documents\visual studio 2010\Projects\WhiteTest\WhiteApplication\bin\Debug\WhiteApplication.exe";

            Application application = Application.Launch(path);
            Window window = application.GetWindow("Form1", InitializeOption.NoCache);
            TextBox tNom = window.Get("textBox1");
            TextBox tPrenom = window.Get("textBox2");
            Button btn = window.Get("button1");
            btn.Click();

 

The only difference is my project was created on VS2010 and the first on 2008. Any idea? 

Thanks 

Jan 11, 2011 at 2:44 PM
Edited Jan 11, 2011 at 2:45 PM

Any Error message or Stacktrace?

 

Can you say what OS you use? x64?

try build for x86 and use Nunit-x86.exe instead of normal nunit.

 

Throndorin

Jan 11, 2011 at 2:49 PM

I just found the problem :) , in fact, my action which was use by scan button was too long so I had to create an new App.config in White project and change timeout. White maybe thougt taht the button doesn't exist or was busy because after 5 scs nothing happened!