Appium Installation Through Terminal

Pre-Requisites

1. Update MacOS

2. Install XCode from AppStore. Once XCode finishes the install, launch it and let it continue installing all the necessary components.

3. Exit XCode.

Brew Installation

4. Goto https://brew.sh/ and copy the latest installation command

5. Open terminal and run the command to install brew on your system.

6. Run the below command to make sure your system is ready to brew. Follow any recommendation from brew doctor

7. Next, add the Homebrew location to your $PATH and source your bash or zsh profile file after adding/saving this:

Open vi .bash_profile and add the below.

8. After completion, esc + :wq and then source .bash_profile

9. Exit the terminal

Java Installation:

10. Run the below commands in a new terminal for latest Java JDK.

11. Or for specific Java version

12. Existing users of Homebrew may encounter Error: Cask adoptopenjdk8 exists in multiple taps due to prior workarounds with different instructions. This can be solved by fully specifying the location with

13. Above command will give empty response. Now let us set up java environment paths by running the below commands

15. Finally, follow the below steps to exit and save successfully.

16. Successful Java set up will show the below path

17. Exit the terminal

IntelliJ Installation:

18. Run the following commands, remembering to re-run the install in case of any error while installing.

19. Launch IntelliJ from Launchpad and create maven project

20. Project SDK will auto select’s the Java JDK version or select the desired Java JDK

21. Create a main method

22. Run a print program to make sure Java / IntelliJ installation is successful.

23. Close IntelliJ and Exit the terminal

TestNG Installation:

24. Open pom.xml in the above project.

25. Add below testng maven dependency

<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng | TestNG for running testing-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

26. Right click on pom.xml and click on Reload project & Generate source to make sure testng is installed.

27. Now create a method and run print program using testng command using @Test notation

Maven Installation:

28. Run the following commands, remembering to re-run the install in case of any error while installing

29. Add steps to validate maven

30. Exit the terminal

Appium Installation

31. Go into the iOS device you plan to use and set the screen to not lock. Locking will cause issues during this process so its key to go into your ios settings app > display and brightness > auto-lock > set to “never”

32. Make sure XCode is install with its necessary components

33. When XCode finally launches go into the XCode preferences, accounts, then add your dev apple account. Once you have signed in, connect an iPhone device (make sure you are on the latest version of iOS) and go into XCode → Window → Device and simulator menu, verify your iPhone is present on the device list and wait for XCode to finish installing all the necessary support onto the iPhone.

34. Once you notice XCode completes its installs, go into your iPhone settings, you will notice a Developer option that you did not see before, click on that and make sure the Enable UI Automation option is selected and green, then close XCode

35. Run the following commands, remembering to approve all requests for the terminal to access your file system.

36. Go to appium.io and download the latest version of Appium

37. Install the dmg file

38. Launch appium via applications folder and verify it launches successfully. If you cannot launch the app right click on it the second time and click open. That should give you another option to open the app.

39. Close Appium

40. Launch XCode

41. Open the following project in XCode

42. Double click on the WebDriverAgent item under the left panel

43. On the center top panel, click on WebDriverAgentLib

44. Click on the signing and capabilities tab up top

45. Enable the automatically manage signing checkbox

46. Set the team drop down to your team (apple id account)

47. The provisioning profile should be set to none required

48. On the center top panel, click on WebDriverAgentRunner

49. Enable the automatically manage signing checkbox

50. Set the team drop down to your team (apple id account)

51. The provisioning profile should be set to XCode managed profile

52. The signing certificate should be set to (your apple id and certificate name this should be auto generated. If the device already has a certificate it may ask you to revoke and recreate. There should not be any errors on this screen)

53. On the center top panel, click on IntegrationApp

54. Enable the automatically manage signing checkbox

55. Set the team drop down to your team (apple id account)

56. The signing certificate should be populated

57. Make sure on the center top panel, click on WebDriverAgentLib_tvOS and make sure “automatically manage signing” is disabled. Repeat for WebDriverAgentRunner_tvOS

58. Click on the webdriveragaint again just above the webdriveragentlib and build the project (play icon on upper left of XCode) This process will install integrationapp onto your ios device and verify the build is successful. You may be prompted to enter your macOS password. Make sure if you are to click always allow after inputting your password.

59. Once you get the build successful notification, stop the build in XCode and exit XCode

60. Go back to your terminal session and perform the following commands

61. Exit your terminal session

62. Launch Appium

63. Start the server

64. Click on start inspector session button

65. Set the following capabilities

66. Once you have saved, go ahead and start the inspector, the appium logs should start to flow with data and the inspector will launch as well as your app. You may be asked to enter your password multiple times, make sure when you are prompted to click always allow after entering your password (your mac password NOT your icloud password) for each prompt. You will see your app on the left side of the inspector. IF YOU ENCOUNTER A PORT 8100 OCCUPIED ERROR: All you have to do is bounce your machine. Once you restart your machine do not launch anything other than appium and launch the appium app again and load the capabilities again and try to launch the inspector.

67. Add Appium Server dependency to pom.xml

<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng | TestNG for running testing-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.3.0</version>
</dependency>
</dependencies>

Android Studio Installation:

68. Run the following commands, remembering to re-run the install in case of any error while installing

69. Run each below command to make sure installation is successful

70. Exit your terminal session

71. Add steps to launch Android system app using Appium and IntelliJ

Charles Proxy Installation:

72. Run the following commands, remembering to re-run the install in case of any error while installing

73. Install the certificate on device / emulator / simulator and test.

Launch Apps Using IntelliJ:

74. Create a Class and run the modified program

//Launch Android Sys App in Real Devicepublic class LaunchSysAppInRealDevice {
private static AndroidDriver driver;

@Test
public static void setUpAppium() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.0");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "SM-G950U");
caps.setCapability(MobileCapabilityType.UDID, "98883746303999999");
caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE,"com.android.calculator2");
caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY,"com.android.calculator2.Calculator");

driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
System.out.println("SYS APP Launched In Android Real Device Successfully");
}
}
===================================================================//Launch iOS Sys App in Real Device

public class LaunchSysAppInRealDevice {
private static IOSDriver driver;

@Test
public static void setUpAppium() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "12.4");
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
caps.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "com.apple.news");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone X");
caps.setCapability(MobileCapabilityType.UDID, "86be2eb53ab8483cce86428ae90628a343988988)");

driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
System.out.println("IOS Simulator Launched In Sys App File Successful");
}
}

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store