how to get and verify the message show in the msgbox.

2 posts, 0 answers
  1. Jack
    Jack avatar
    1 posts
    Member since:
    Jul 2010

    Posted 21 Jul 2010 Link to this post

    Is there any API we can use to get the  message display on the user log in to the system the usernam is null,click the log in button ,the warnning message like "please input username".
  2. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 21 Jul 2010 Link to this post

    Hi Jack,

    Try the below code and let me know if it is working.

    I am having a silverlight application. When i click a button it will dispaly a message box with caption "My Message" and text

    "Hello World!!!!!!".
    Please make sure to give Thread.Sleep() after the button click.

            public void MessageBoxTest()
                // Get an instance of the running Silverlight Application.
                SilverlightApp  CurrentApplication = ActiveBrowser.SilverlightApps()[0];
                //To activate the silverlight control
                CurrentApplication.Desktop.Mouse.Click(MouseClickType.LeftClick, CurrentApplication.Bounds);
                Button btnShowMessageBox = CurrentApplication.Find.ByName<Button>("btnShowMessageBox");
                Window msgBox = null;            
                WindowManager winManager = new WindowManager();
                foreach (Window win in winManager.Items)
                    if (win.Caption.Contains("My Message"))
                        msgBox = win; 
                if (msgBox != null)
                   var label= msgBox.AllChildren.OfType<Window>().Where(w => w.ClassName == "Static");
                   if (label.FirstOrDefault().Caption == "Hello World!!!!!!!!")

Back to Top