SetText
Dear community
For my login (in java script) I am using the following script, that includes SetText. But when I am using SetText, the testcase will fail because of "run time error". Does anybody has a guess why this error appears and can anybody please help me?
The script can click at the login button without any problems and it works. The problems are just setting username and password.
function login() {
var url = "http://.../login";
var UserName_XPath = "//input[@class=..................@ng-class=\"{error: error}\"]";
var PassWord_XPath = "//input[@class=\..........and @ng-class=\"{error: error}\"]";
var LogInButton_XPath = "//button[@type=\..............................................\"Log In\"]";
var username, password, loginButton;
Browsers.Item(btChrome).Run(url);
var page = Sys.Browser("*").Page(url);
Sys.Browser().BrowserWindow(0).Maximize();
aqUtils.Delay(3000);
username = page.FindChildByXPath(UserName_XPath, true);
password = page.FindChildByXPath(PassWord_XPath, true);
loginButton = page.FindChildByXPath(LogInButton_XPath, true);
username.SetText("lambada");
password.SetText("five");
loginButton.Click();
page.Wait();
}
I solved the problem now. I have had taken the whole hudge XPath, and there were some issues with it. Now I used an extension and got a shorter XPath and now it is working.
Thank you for your help :)