2012-12-31 82 views
0

我正在使用WatiN打開SSRS報告。最初,當報告打開時,會顯示消息「正在生成報告」。
我想等到報表生成爲止。等待SSRS報告完成加載

我使用了WaitForComplete,但它永遠不會返回。

  1. 如果生成報告,程序應該繼續。
  2. 否則顯示報告未能生成的錯誤。

編輯1號

//create IE window 
WatiN.Core.IE window = new WatiN.Core.IE(); 
window.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.ShowMaximized); 

//go to the URL 
window.GoTo("http://10.205.10.173"); 

//fill details for login 
window.TextField(Find.ByName("User")).TypeText("bcadmin"); 
window.TextField(Find.ByName("Password")).TypeText("Test123!"); 
window.SelectList(Find.ByName("Application")).SelectByValue("appBCCIFrys"); 
window.Button(Find.ByName("dbbSystemLogin")).Click(); 

//go to Activity Re-cap Report 
window.Span(Find.ByText("Reports")).Click(); 
window.Span(Find.ByText("Activity Re-cap Report")).Click(); 

//fill details for it 
window.SelectList(Find.ByName("DbbDataCtrl_PnlARecapReportingdeARecapReportingRecordType_")).SelectByValue("00"); 
window.SelectList(Find.ByName("DbbDataCtrl_PnlARecapReportingdeARecapReportingSection_")).SelectByValue("00"); 

//press next 
window.Image(Find.ByAlt("Next")).Click(); 

//change checkbox to option 2 
window.RadioButton(Find.ByValue("1")).Checked = true; 

//fill date 
window.TextField(Find.ByName("DbbDataCtrl_PnlARecapReporting8NextdeARecapReportingIndividualDate_")).TypeText("12/12/2012"); 

//press create report 
window.Image(Find.ByAlt("Create Report")).Click(); 

//Thread.Sleep(60000); 

//connect to the new page opened 
IE report = IE.AttachToNoWait<IE>(Find.ByTitle("New Activity Recap"), 200); 

**//HERE I WANT TO WAIT TILL THE REPORT IS LOADED AND FETCH VALUES 
//IF IT DOES NOT LOAD (or throws any error) WITHIN 2 MINS, MOVE FOWWARD** 

//logout 
window.Span(Find.ByText("Logout")).Click(); 
window.Close(); 
report.Close(); 
+0

您可以發佈檢查SSRS報告的當前邏輯嗎? –

+0

當然!看到我編輯的問題 –

回答

0

你們要讚美耶和華!這一個花了我幾天的時間來弄清楚!

我試圖訪問「內部html」,等到「報告生成...」存在。但是,由於我對Watin有限的瞭解,我無法做到這一點。但讓我們繼續解決問題!

它終於打我,看看我是否可以捕獲「報告正在生成...」從屏幕上刪除。但是,因爲它永遠不會從html中刪除,而是使用這個漂亮的小檢查。

while (reportViewer.Span("athenaReportViewer_ReportsViewer_ctl03").Style.Display.ToString() != "none") 
{ 
    Console.WriteLine("This enabled..."); 
} 
Console.WriteLine("DISABLED!!!"); 

所以我們不是檢查樣式屬性「顯示」有值「無」。 XD