Archana_72
8 years agoContributor
Is it possible to have same script for Android and iOS apps?
Hi,
We have an app developed in android and now we are developing same app in iOS.
Is there any way I can re-use the same scripts for Android and iOS apps?
If so what is the approach?
If your flow is same for both iOS and Android then the best option would be like below,
function test() { testiOSLogin(Aliases.iOS.txtUserName,Aliases.iOS.txtPWD,Aliases.iOS.btnLogin,v_username,v_password); testAndriodLogin(Aliases.Andriod.txtUserName,Aliases.Andriod.txtPWD,Aliases.Andriod.btnLogin,v_username,v_password); }
//common function for login function loginApp(obj_usrName,obj_passWord,objLoginButton,txt_userName,txt_Password) { enterFiled(obj_usrName,txt_userName); enterFiled(obj_passWord,txt_Password); if(objLoginButton.Exists) { objLoginButton.Click(); } //do the necessary check to know the login succesful and return true return true; } //common function for entering function enterFiled(objecttoEnter,value) { if(objecttoEnter.Exists) { objecttoEnter.Keys(value); } }