lundi 23 mai 2016

How can I verify text in ControlType.Text in C# + TestStack.White?

How can I verify text in ControlType.Text using C# + TestStack.White? I am just trying to verify that error message is correct and contains correct phrase.

I have tried different solutions:

  1. TextBox errorTextBox = MainWindow.Get("txbError"); Assert.AreEqual("User name or password is invalid", errorTextBox.Text);

  2. TextBox errorTextBox = MainWindow.Get(SearchCriteria.ByText("User name or password is invalid")); Assert.AreEqual(errorTextBox.Text, "User name or password is invalid");

And others...

Always appears an error in VS:

TestStack.White.AutomationException: Failed to get ControlType=edit,Name=User name or password is invalid

Screenshot

Aucun commentaire:

Enregistrer un commentaire