Hi,
Below is my test script but its not identifying the childwindow
Below is my test script but its not identifying the childwindow
| [TestMethod] |
| public void ChildWindowTest() |
| { |
| // |
| // TODO: Add test logic here |
| // |
| //Manager.Settings.ExecutionDelay = 10; |
| Manager.LaunchNewBrowser(BrowserType.InternetExplorer); |
| //System.Drawing.Point loc = ActiveBrowser.Window.Location; |
| ActiveBrowser.NavigateTo("http://localhost:1031/SampleSilverlightAppTestPage.aspx"); |
| ActiveBrowser.WaitUntilReady(); |
| SilverlightApp app = ActiveBrowser.SilverlightApps()[0]; |
| Assert.IsNotNull(app); |
| Button btnShowConfirmDialogue = app.Find.ByName<Button>("btnShowConfirmDialogue"); |
| Assert.IsNotNull(btnShowConfirmDialogue); |
| btnShowConfirmDialogue.User.Click(); |
| Thread.Sleep(2000); |
| app.RefreshVisualTrees(); |
| IList<ChildWindow> childWindows= app.Find.AllByType<ChildWindow>(); |
| ChildWindow myChildWindow = app.Find.ByName<ChildWindow>("ConfirmDialogueWindow"); |
| Button btnCancel = myChildWindow.Find.ByName<Button>("CancelButton"); |
| btnCancel.User.Click(); |
| } |
I have added Track method also in the Childwindow constructor
| public partial class ConfirmDialogue : ChildWindow |
| { |
| public ConfirmDialogue() |
| { |
| Telerik.WebUI.PopupTracker.Track(this); |
| InitializeComponent(); |
| } |
| private void OKButton_Click(object sender, RoutedEventArgs e) |
| { |
| this.DialogResult = true; |
| MessageBox.Show("Ok"); |
| } |
| private void CancelButton_Click(object sender, RoutedEventArgs e) |
| { |
| this.DialogResult = false; |
| MessageBox.Show("Cancel"); |
| } |
| } |
Below is the error i am getting
Test method WebAiiSample.WebAiiTest.ChildWindowTest threw exception: System.ApplicationException: Exception thrown during the wait for a condition. Error: Unexpected error while waiting on condition. Error: System.NullReferenceException: Object reference not set to an instance of an object.
at ArtOfTest.Common.TreeCrawler`3.ByExpression(T startNode, V expression, Boolean includeRoot)
at ArtOfTest.Common.TreeCrawler`3.ByExpression(T startNode, V expression)
at ArtOfTest.WebAii.Silverlight.VisualWait.WaitForExistsByFindInfo(VisualFindInfo findInfo)
at ArtOfTest.Common.WaitAsync._worker_DoWork[T,V](Object waitParam).