Sunday, 12 June 2016

How to Extract .App file from .ipa file & Install .App file to the IOS Simulator.

Keywords :  Xcode, IOS Simularors, SDKs, Appium, .App File, .ipa File, Mac OS X.

1. How to Extract .app file from .ipa file.


During Testing i faced some problems like "how can i install my .ipa file in the simulator" then after some research i got to know that if you want to install an App then you first have to convert or Extract your app file from your ipa file.


Follow these steps to achieve results : 

1. Download the app you want to store in your simulator from App store. 

2. Convert the Extension of the file from .ipa to .zip.

3. Extract all the contents of the .zip file. 

4. After extraction you will get Payload folder in which you can find your .app file and its Info.plist      file.

2. Install .App file to the IOS Simulator.


Now if you want to install the app in the simulator then you have to follow these simple steps to get the desired results.

1. Launch Xcode. 

2.Go to Xcode > Open Developer Options > IOS Simulator.

3. See all the apps in the simulator . 

4. Go to terminal and write " open  /Applications/Xcode/Contents/Developer/Platforms /iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications.

5.In this window you can see all the applications that are installed in the simulator.

6. Paste your .app file here and exit.

7. Relaunch your IOS Simulator . 

8. You can see you app in the Simulator. 




********************Looking for your Feedbacks*************************

*******************Enjoy Coding, Enjoy Automation********************** 



Related :  How to Run safari on real device

Wednesday, 1 June 2016

Sample code to Run a APP on Real Device through Appium

Sample code to Run a APP on Real Device through Appium.



This Piece of code tested on -
  • Appium -1.3.4 IOS -6 (8.1)
  •  Mac: Mavericks [10.9.5] 
  • Java -1.7 & 8 
  • TestNG 
  • WebDriver- 2.45

1. Install all the pre-requisites as mentioned above

2. Connect your Iphone and collect your udid through itunes.

3 Turn on the Appium server, you can do it in two ways :
  • Using Appium UI.
  • Through Terminal.
4 In my case, i am using terminal. Enter "appium -U xxxxxxxxxxxxxxxxxxxxxxxxx  --app /path/to/app/" command in your terminal. This will set the server on.
     
       xxxxxxxxxxxxxxxxxxxxxxx : Stands for UDID of your Device 

Note : you can add more arguments in the command like --address 127.0.0.1 and --port 4723.
           if you face any error.

5. Now you are all set to run your code.

6. Code : Java code written in Eclipse.


package runapp;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;


public class testapp {
 WebDriver wd;

 @BeforeTest
 public void beforeTest() throws MalformedURLException { 
  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability("deviceName", "iPhone 6");
  capabilities.setCapability("platformName", "iOS");
  capabilities.setCapability("platformVersion", "8.1");
  capabilities.setCapability("app", "/path/to/app/");  //Path of Safari.app 
  capabilities.setCapability("udid", "xxxxxxxxxxxxxxxxxxx");

  wd = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
  wd.manage().timeouts().implicitlyWait( 10,TimeUnit.SECONDS);
 }

 @Test
 public void clickonapp() throws InterruptedException {

wd.findElement(By.id("Login")).click();
  
 }

 @AfterTest
 public void afterTest() {
  wd.close();
 } 
}   



7.Run this code.

8.Check Terminal window, wheather system is pushing some commands or not .


Looking for your feedback. All The Best.


**************************Enjoy Automation****************************