Ask a Question

Is it possible to have same script for Android and iOS apps?

SOLVED
Archana_72
Contributor

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?

 

1 REPLY 1
shankar_r
Community Hero

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);
     }
}

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

cancel
Showing results for 
Search instead for 
Did you mean: