Try below code to find your application window/child windows by using TestStack.White framework -
Lets take NotePad as our application -
Lets take NotePad as our application -
//get the required window
List windows = new List();
windows = Desktop.Instance.Windows();
//Get all the windows on desktop
for (int i = 0; i < windows.Count; i++)
{
string str = windows[i].Title;
if (str.Contains("Notepad"))
//compare which window title is matching to your string
{
mainwindow = windows[i];
//Log("mainwindow detected");
break;
}
}
//pop out "Font" window from the notepad with the below keypress
mainwindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.ALT);
mainwindow.Keyboard.Enter("O");
mainwindow.Keyboard.Enter("F");
//Find the Font window from the mainwindow (modal window)
Window font = mainwindow.ModalWindow("Font");
No comments:
Post a Comment