2013-08-02 25 views
0

我正在用TestStack White編寫一個簡單的安裝腳本,所以我可以學習框架(我沒有在網上找到很多信息)。控制一個我沒有啓動的窗口

我使用的是傳說中的聯賽安裝這個小實驗

後,我填寫表格,並按下下一個按鈕,有一個從安裝程序會打開一個窗口。

我想知道是否有辦法讓GET窗口,即使我不是執行它的人。

這是我用來運行應用程序,直到此刻新窗口中打開代碼:

private void pressXButton(White.Core.UIItems.WindowItems.Window currentWindow, string buttonName) 
    { 
     var xButton = currentWindow.Get<White.Core.UIItems.Button>(White.Core.UIItems.Finders.SearchCriteria.ByText(buttonName)); 
     xButton.Click(); 
     currentWindow.WaitWhileBusy(); 
    } 

    public void RunScript() 
    { 
     White.Core.Application application = White.Core.Application.Launch(filePath); 
     White.Core.UIItems.WindowItems.Window window = application.GetWindow(windowTitle); 
     window.WaitWhileBusy(); 

     pressXButton(window, NEXT_BUTTON_TEXT); 

     var radioButtonAgree = window.Get<White.Core.UIItems.RadioButton>(White.Core.UIItems.Finders.SearchCriteria.ByText("I accept the terms in the License Agreement")); 
     radioButtonAgree.Select(); 
     window.WaitWhileBusy(); 

     pressXButton(window, NEXT_BUTTON_TEXT); 
     pressXButton(window, NEXT_BUTTON_TEXT); 
     pressXButton(window, NEXT_BUTTON_TEXT); 
     pressXButton(window, NEXT_BUTTON_TEXT); 
     pressXButton(window, NEXT_BUTTON_TEXT); 
     pressXButton(window, "Install"); 

//afther pressing the Install Button the program ask to install Microsoft Visual C++ 2005 Redistributable Package and here is where im stcuk 




    } 

(對不起,我的英語)

回答

1

您可以使用Desktop.Instance.Windows()獲得在所有的窗口,而不僅僅是你正在測試的過程中的窗口。

否則,您必須使用Application.Attach(「processname」)來獲取Microsoft Visual C++ 2005可再發行組件包的進程

相關問題