Forum Discussion
shankar_r
8 years agoCommunity Hero
Based on your code what i understand, you want to have some generic functions which can perform actions like ClickButton, Select Dropdown, etc.
Yes, this kind of functions would be useful when you want to have a framework for Object actions.
In some scenarios, It won't be helpful if you trying to do different operations with Textbox.
As tristaanogre, AlexKaras said, If it is useful for your AUT structure and business needs then it is good have.
I have similar kind of function that i wrote for Setting up of Text,
function EnterText(objMainObject,strValue,strFridenlyName)
{
//objMainObject should be Text box object
if(objMainObject != null)
{
if((objMainObject.Exists) && (objMainObject.Visible))
{
if(aqConvert.VarToStr(strValue) == "null")
{
objMainObject.Keys("^a");
objMainObject.Keys("[BS]");
}
else if(aqConvert.VarToStr(strValue) != "")
{
if(aqString.Compare(aqConvert.VarToStr(objMainObject.getText()),strValue,true) != 0)
{
objMainObject.Keys(strValue);
if(aqString.Compare(aqConvert.VarToStr(objMainObject.getText()),strValue,true) == 0)
{
Log.Event(strFridenlyName + " object is entered as " + strValue);
}
else
{
Log.Error(strFridenlyName + " object is not entered as " + strValue);
}
}
else
{
Log.Event(strFridenlyName + " object is already as " + strValue);
break;
}
}
else
{
Log.Message("No value found for input");
}
}
}
}