Procedure for using of javascript function
Hi All,
please give clarification on use of javascript in Automation.
Steps to use javascript:
1.Start Interrogation(launch/open login page)
2.Click on F12 button from keyboard and click on Debugger tab to see javascript & html code of login page.
3.Find which javascript method we want to use in Automation.
Can you see the method which i want to use:
EX: function checkLoginName (userCode)
{
if (userCode.value.length == 0 )
{
userCode.focus();
alert("\n Please enter Username.\n");
return false;
}
if (userCode.value.length > 16)
{
userCode.focus();
alert("\n Length of Username cannot exceed 16 characters.\n");
return false;
}
if (userCode.value.indexOf(" ") > -1)
{
userCode.focus();
alert("\n Login name cannot have spaces or blanks.\n");
return false;
}
if ( (userCode.value.indexOf("'") > -1) || (userCode.value.indexOf("\"") > -1) )
{
userCode.focus();
alert("\n Username cannot have single or double quotes.\n");
return false;
}
return true;
}
4.Now came back to Openspan Studio and open Automation1.os
5.Please confirm above steps as correct or not and tell me remaining steps to use that javascript function of "checkLoginName (userCode)" in my automation.
Thanks.
Hi All,
please give clarification on use of javascript in Automation.
Steps to use javascript:
1.Start Interrogation(launch/open login page)
2.Click on F12 button from keyboard and click on Debugger tab to see javascript & html code of login page.
3.Find which javascript method we want to use in Automation.
Can you see the method which i want to use:
EX: function checkLoginName (userCode)
{
if (userCode.value.length == 0 )
{
userCode.focus();
alert("\n Please enter Username.\n");
return false;
}
if (userCode.value.length > 16)
{
userCode.focus();
alert("\n Length of Username cannot exceed 16 characters.\n");
return false;
}
if (userCode.value.indexOf(" ") > -1)
{
userCode.focus();
alert("\n Login name cannot have spaces or blanks.\n");
return false;
}
if ( (userCode.value.indexOf("'") > -1) || (userCode.value.indexOf("\"") > -1) )
{
userCode.focus();
alert("\n Username cannot have single or double quotes.\n");
return false;
}
return true;
}
4.Now came back to Openspan Studio and open Automation1.os
5.Please confirm above steps as correct or not and tell me remaining steps to use that javascript function of "checkLoginName (userCode)" in my automation.
Thanks.
***Moderator Edit: Vidyaranjan | Updated Categories***
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.