我正在使用WatiN打开SSRS报告。最初,当报告打开时,它会显示消息“正在生成报告” 我想等到报告生成。
我使用了WaitForComplete,但它永远不会返回。
编辑否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 :(得分:0)
赞美耶和华!这个花了我几天才搞清楚!
我试图访问“内部html”,等到“Report Generated ...”存在。但是,由于我对Watin的了解有限,我无法做到这一点。但让我们继续讨论解决方案!
最终打击了我,看看我是否可以在屏幕上删除“Report is Generating ...”时捕获。但是,因为它从来没有从html中删除,所以我选择了这个漂亮的小支票。
while (reportViewer.Span("athenaReportViewer_ReportsViewer_ctl03").Style.Display.ToString() != "none")
{
Console.WriteLine("This enabled...");
}
Console.WriteLine("DISABLED!!!");
因此,我们检查样式属性“Display”,使其值为“none”。 XD