I have a simple application with button, which shows another form with ShowDialog() method. I would like to click close button from this opened form, but calling Session.FindElementByName("Close") will try to click close button from first form which fails (because another form is opened with ShowDialog()).
Any tips how I could switch to this new form?
SwitchTo doesn't seems to work. I have two window handles in session after ShowDialog() call, but switching does not seems to work.
[TestMethod]
public void AppDriverTest_Close_Another_Window()
{
Session.FindElementByAccessibilityId("button1").Click();
Session.FindElementByName("Close").Click();
}
// Form1 has button with following click method
private void button1_Click(object sender, EventArgs e)
{
var frm = new Form2();
frm.ShowDialog();
}