All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
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.
[TestMethod]
public
void
MessageBoxTest()
{
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
ActiveBrowser.NavigateTo(
"http://localhost:2463/SampleApplicationTestPage.aspx"
);
// 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"
btnShowMessageBox.User.Click();
Thread.Sleep(2000);
Window msgBox =
null
;
WindowManager winManager =
new
WindowManager();
winManager.GetWindows();
foreach
(Window win
in
winManager.Items)
if
(win.Caption.Contains(
"My Message"
))
msgBox = win;
}
(msgBox !=
)
var label= msgBox.AllChildren.OfType<Window>().Where(w => w.ClassName ==
"Static"
(label.FirstOrDefault().Caption ==
"Hello World!!!!!!!!"
msgBox.Close();
Thread.Sleep(4000);