????????????С?????????????UI????????????.

?????????????????Button??disable?????????Button enable??????Click???????????.

????????????????????????????.

????1.?????????????????(?????????????????????????)

????button=FindButton();

????ClickButton(button);

????2.?????????????(???????sleep?????????е????)

????button=FindButton();

????Sleep(10);


????ClickButton(button);


????Sleep(10);

????window=FindWindow();

????3.?????????????(????????????????????Ч??)

????button=FindButton();

????WaitButtonEnable(button);

????ClickButton(button);

????window=WaitWindowOpen();

????4.???????????????(??????????в??????bug????д????£???а???exception????????伱??????????д???????????????)

????Button button=null;


????for(int i=0;button==null&&i<3;i++) //???FindButton???????????????in case

????{


????button=FindButton();

????if(button==null)

????{

????Log.Error("Tryout{0}:Can not find button"??i); //???????????

????}
????else

????{

????break;

????}

????}


????if(button==null)

????{

????Log.Error("Cannot find button. Quit"); //????????????button????????????

????Log.Screen();//????????????????????????д

????return;

????}

????if(!WaitButtonEnable(button))

????{

????if(button.Enabled==true) //?????????????е??enable?????

????{

????Log.Error("enabled?? but tool didn??t detect");

????}

????else//????????????????????button???????????????????enable

????{

????Log.Error("don??t enable");

????return;

????}

????Window window=null;

????for(i=0;window==null&i<3;i++)//ClickButton?????????????е??open event????????????

????{

????ClickButton(button);

????window=WaitWindowOpen();

????if(window==null)//???click??????е?????????????????


????{

????int count=0;

????findwindow://FindWindow???????????3??

????window=FindWindow();

????if(window!=null) //??е?????????????????

????{

????Log.Error("didn??t get event");

????break;


????}

????else //???click???????????? ????FindWindow?????

????{

????Log.Error("Tryout{0}:didn??t get window"??i);

????count++;

????if(count>3)

????{

????}

????else //FindWindow???????workaround

????{

????Log.Error("goto{0}"??count);

????goto findwindow;


????}

????}

????}

????else //???

????{

????break;

????}

????}

????if(window==null)

????{

????Log.Error("didn??t get window?? maybe tool or product problem.");

????return;

????}