0

我正在使用 WatiN 打开 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();
4

1 回答 1

0

赞美主!这个我花了几天才弄明白!

我试图访问“内部 html”以等待“生成的报告...”存在。但是,由于我对 Watin 的了解有限,我无法做到这一点。但是让我们继续解决问题!

当“报告正在生成...”从屏幕上删除时,我终于看到了我是否可以捕捉到。但是,由于它从未从 html 中删除,因此我使用了这个漂亮的小检查。

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

因此,我们改为检查样式属性“Display”,使其值为“none”。XD

于 2013-11-19T22:17:23.327 回答