I´m triing to install Appium using the WinAppDriver and Visual Studios on my PC. The first Tests are working, but now i´ve got a problem. The tested Program works like this: There is a window opening with a Button, called btnStart. After klicking this button, another window opens. In my Test, there should be a button pressed in the second window called btnC2. The Problem is, that the Tests are working for the first window, but it says that it cant find the btnC2 - i guess because its a nother new window. Do you know how i can fix this? that the test is looking for the btnC2 in the new window?
Thanks a lot!
Here is what the code looks like:
//This one is working
[TestMethod]
public void StartButtonTextTest()
{
var startButtonText = session.FindElementByAccessibilityId("btnStart");
Assert.AreEqual(startButtonText.Text, $"&Start");
startButtonText.Click();
}
//This one isn´t
[TestMethod]
public void FallWechselButton()
{
var fallwechselButton = session.FindElementByAccessibilityId("btnC2");
Assert.AreEqual(fallwechselButton.Text, $"Fallwechseln");
fallwechselButton.Click();
var labelFallText = session.FindElementByAccessibilityId("labelControl1");
Assert.AreEqual(labelFallText.Text, $"this is a test");
}
//New Code:
[TestMethod]
public void FallWechselButton()
{
var startButtonText = session.FindElementByAccessibilityId("btnStart");
Assert.AreEqual(startButtonText.Text, $"&Start");
startButtonText.Click();
var fallwechselButton = session.FindElementByAccessibilityId("cButton2");
Assert.AreEqual(fallwechselButton.Text, $"Fallwechseln");
fallwechselButton.Click();
var labelFallText = session.FindElementByAccessibilityId("labelControl1");
Assert.AreEqual(labelFallText.Text, $"2000:Paola4 Alvarez3");
}