I am trying to run some BDD tests using Ranorex API, SpecFlow and Nunit framework.
While running I got the following exception:
Code: Select all
The type initializer for 'Test.Automation.ObjRepo.LoginDialog' threw an exception.
Code: Select all
using Ranorex;
namespace Test.Automation.ObjRepo
{
public class LoginDialog
{
//public LoginDialog() { }
private static Form LoginForm = "/form[@title~'^Pryda Build Designer']";
private Text Username { get; set; } = LoginForm.FindSingle<Text>("/text[@AccessibleName='User name:']");
private Text Password { get; set; } = LoginForm.FindSingle<Text>("/text[@AccessibleName='Password:']");
private Button LogOnButton { get; set; } = LoginForm.FindSingle<Button>("/button[@text='Log on']");
public void ActivateLogOnDailog()
{
LoginForm.Activate();
}
public Text GetUsername()
{
return Username.TextValue;
}
public void SetUsername(string username)
{
Username.Click();
Username.PressKeys(username);
}
public void SetPassword(string password)
{
Password.Click();
Password.PressKeys(password);
}
public void LogOnUser()
{
LogOnButton.Click();
}
}
}
Thanks,
Felix.