{"id":623,"date":"2018-08-31T18:04:08","date_gmt":"2018-08-31T12:34:08","guid":{"rendered":"http:\/\/nxglabs.in\/etech\/?p=623"},"modified":"2018-10-27T11:07:38","modified_gmt":"2018-10-27T05:37:38","slug":"automate-ios-application-using-appium","status":"publish","type":"post","link":"https:\/\/nxglabs.in\/etech\/automate-ios-application-using-appium\/","title":{"rendered":"How to Automate iOS Application Using Appium?"},"content":{"rendered":"<p>Appium is an open source and cross-platform tool. Appium supports the android as well as iOS applications. Appium is a good mobile automation testing tools. We can automate the scripts in six languages as Java, Ruby, Python, PHP, JavaScript, and C#. With the help of jar files, we can automate the mobile application. Appium Supports iOS application also. We can automate the iOS application using Appium.<\/p>\n<p>As we have seen automation of android application using Appium. Now we are going to see How to Automate iOS application\u00a0using Appium with java language. To run the iOS application we need a Mac\u00a0operating system as well as Xcode version mandatory.<\/p>\n<p><strong>Pre-requisites &#8211; Appium : (Script for iOS Application)<\/strong><\/p>\n<ol>\n<li>Java JDK installed with Java_Home<\/li>\n<li>Latest Xcode which includes iOS SDK and command line tool.<\/li>\n<li>Eclipse IDE for mac.\n<ol>\n<li>Node js for mac.<\/li>\n<\/ol>\n<\/li>\n<li>Android SDK tool for mac<\/li>\n<li>Apple&#8217;s XCUITest<\/li>\n<li>Jar files for appium\u00a0&#8211; to get this go to the appium-java .<\/li>\n<\/ol>\n<p><strong>Installations:<\/strong><\/p>\n<p>Software required for setup of an Appium &#8211;<\/p>\n<p><strong>1.Java Application:\u00a0JDK (Java SE Development Kit) \u2013 [ Compulsory ]<\/strong><\/p>\n<ul>\n<li>Go to the link:<\/li>\n<\/ul>\n<p>http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-654 size-full\" title=\"Java application\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/11-1.png\" alt=\"Java application\" width=\"1159\" height=\"610\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/11-1.png 1159w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/11-1-300x158.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/11-1-768x404.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/11-1-1024x539.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/11-1-800x421.png 800w\" sizes=\"(max-width: 1159px) 100vw, 1159px\" \/><\/p>\n<ul>\n<li>Install it.<\/li>\n<li>Once after installation is done, set the JAVA_HOME path.<\/li>\n<li>Export the JAVA_HOME path on mac.<\/li>\n<\/ul>\n<p><strong>2.Latest Xcode which includes iOS SDK.<\/strong><\/p>\n<ul>\n<li>1. To download Xcode. Go to the App Store and download Xcode.<\/li>\n<li>2. To download and install the Xcode, we need Valid Apple ID and Password.<\/li>\n<li>3. Accept the license and install it.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-655 size-full\" title=\"Xcode \" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/12-1.png\" alt=\"Xcode \" width=\"1226\" height=\"680\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/12-1.png 1226w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/12-1-300x166.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/12-1-768x426.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/12-1-1024x568.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/12-1-800x444.png 800w\" sizes=\"(max-width: 1226px) 100vw, 1226px\" \/><\/p>\n<p><strong>3.Eclipse IDE<\/strong><\/p>\n<ul>\n<li>\u00a0Go to the link of eclipse IDE. and download it.<\/li>\n<li>\u00a0link &#8211; https:\/\/www.eclipse.org\/downloads\/<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-656 size-full\" title=\"eclipse IDE\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/13-1.png\" alt=\"eclipse IDE\" width=\"1551\" height=\"628\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/13-1.png 1551w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/13-1-300x121.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/13-1-768x311.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/13-1-1024x415.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/13-1-800x324.png 800w\" sizes=\"(max-width: 1551px) 100vw, 1551px\" \/><\/p>\n<ul>\n<li>After installation, now open the eclipse. We need TestNG software to run the test cases<\/li>\n<li>Go to Help &#8211;&gt; install new software. add&#8211;&gt; type name : TestNG<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-657 size-full\" title=\"Add repository\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/15-1.png\" alt=\"Add repository\" width=\"865\" height=\"662\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/15-1.png 865w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/15-1-300x230.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/15-1-768x588.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/15-1-800x612.png 800w\" sizes=\"(max-width: 865px) 100vw, 865px\" \/><\/p>\n<ul>\n<li>Agree to the licenses and install it.<\/li>\n<\/ul>\n<p><strong>4.Node js<\/strong><\/p>\n<ul>\n<li>\u00a0Go to the link of Node.js and download it.<\/li>\n<li>\u00a0link &#8211;\u00a0https:\/\/nodejs.org\/en\/download\/<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-596 size-full\" title=\"Node.js\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/8.png\" alt=\"Node.js\" width=\"1565\" height=\"805\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/8.png 1565w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/8-300x154.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/8-768x395.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/8-1024x527.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/8-800x412.png 800w\" sizes=\"(max-width: 1565px) 100vw, 1565px\" \/><\/p>\n<p><strong>5.Android SDK tool<\/strong><\/p>\n<ul>\n<li>\u00a0Go to the link of Android studio website and download it.<\/li>\n<li>\u00a0link &#8211;\u00a0 https:\/\/developer.android.com\/studio\/<\/li>\n<li>Export the ANDROID_HOME path on mac.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-589 size-full\" title=\"Android studio\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/1-1.png\" alt=\"Android studio\" width=\"1583\" height=\"797\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/1-1.png 1583w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/1-1-300x151.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/1-1-768x387.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/1-1-1024x516.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/1-1-800x403.png 800w\" sizes=\"(max-width: 1583px) 100vw, 1583px\" \/><\/p>\n<p><strong>6.Appium for mac\u00a0<\/strong><strong>[By this we can get the appium GUI]<\/strong><\/p>\n<ul>\n<li>Go to the link of appium and download it.<\/li>\n<li>link \u2013 http:\/\/appium.io\/<\/li>\n<li>Install it as per the operating system. As we are explaining for mac so, we will download the file as per the mac operating system.<\/li>\n<li>By the help of this, we can get the inbuilt inspector to find out the elements.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-597 size-full\" title=\"appium apps\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/9.png\" alt=\"appium apps\" width=\"1572\" height=\"782\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/9.png 1572w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/9-300x149.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/9-768x382.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/9-1024x509.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/9-800x398.png 800w\" sizes=\"(max-width: 1572px) 100vw, 1572px\" \/><\/p>\n<h3><strong>Steps to Install the Appium Tool &#8211;<\/strong><\/h3>\n<p>In order to install it, we should go to the below steps:<\/p>\n<ul>\n<li><strong><em>Step<\/em> 1<\/strong>. Install the Java application.<\/li>\n<li><strong><em>Step<\/em> 2<\/strong>. Open a command prompt.<\/li>\n<li>Type the <strong>command:\u00a0<\/strong>\u00a0&#8220;node \u2013v&#8221;\u00a0 (to check the node version. we will get the installed version of node)<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-659 size-full\" title=\"command code\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/2-2.png\" alt=\"command code\" width=\"1599\" height=\"713\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/2-2.png 1599w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/2-2-300x134.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/2-2-768x342.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/2-2-1024x457.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/2-2-800x357.png 800w\" sizes=\"(max-width: 1599px) 100vw, 1599px\" \/><\/p>\n<ul>\n<li><strong><em>Step<\/em> 3<\/strong>. Install Appium via NPM command.<\/li>\n<li>Type the <strong>command: &#8220;<\/strong>npm install -g appium&#8221;<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-670 size-full\" title=\"login status - appium\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/29-1.png\" alt=\"login status - appium\" width=\"566\" height=\"365\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/29-1.png 566w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/29-1-300x193.png 300w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/p>\n<ul>\n<li><strong><em>Step<\/em> 4<\/strong>. After installation is done successfully. Check the version of installed appium.<\/li>\n<li>Type the <strong>command:<\/strong>\u00a0&#8220;appium \u2013v&#8221;<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-671 size-full\" title=\"installed appium - v\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/30-1.png\" alt=\"installed appium - v\" width=\"573\" height=\"355\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/30-1.png 573w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/30-1-300x186.png 300w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/p>\n<ul>\n<li><strong><em>Step<\/em> 5<\/strong>. To start appium server<\/li>\n<li>Type the <strong>command: &#8220;<\/strong>appium&#8221;<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-660 size-full\" title=\"command as &quot;appium&quot;\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/4-1.png\" alt=\"command as &quot;appium&quot;\" width=\"1589\" height=\"704\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/4-1.png 1589w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/4-1-300x133.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/4-1-768x340.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/4-1-1024x454.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/4-1-800x354.png 800w\" sizes=\"(max-width: 1589px) 100vw, 1589px\" \/><\/p>\n<p>We will get the appium version as well as the appium listener with the port number.\u00a0 This is useful to run an iOS application on the listening port successfully.<\/p>\n<h3>Some External dependencies of appium on Mac. [Important]<\/h3>\n<p>We have to install some dependencies for Appium on \u00a0Mac. Follow the below link and do as per it.<\/p>\n<p>Link :- https:\/\/github.com\/appium\/appium-xcuitest-driver<\/p>\n<p><strong>Steps to install external dependencies<\/strong><\/p>\n<ol>\n<li>Go to the terminal<\/li>\n<li>Type Command: <em>brew install libimobiledevice<\/em> <em>and install it.<\/em><\/li>\n<li>Type Command:<em> brew install ideviceinstaller and install it.<\/em><\/li>\n<li>Type Command: <em>brew install <\/em>carthage<em>\u00a0and install it.<\/em><\/li>\n<li>Type Command: <em>npm install -g ios-deploy<\/em>\u00a0<em>and install it.<\/em><\/li>\n<\/ol>\n<p><strong>7.Apple&#8217;s XCUITest<\/strong><\/p>\n<p>To run the Appium script on Real iOS device we need WebDriver Agent. It is really important to run XCUITest using webdriver agent.<\/p>\n<p>link :\u00a0https:\/\/github.com\/facebook\/WebDriverAgent<\/p>\n<p>Some Steps should be followed to run web driver agent for appium.<\/p>\n<p>1.Open Terminal.\u00a0 Go to the folder:<\/p>\n<p>cd \/path\/where\/installed\/lib\/node_modules\/appium\/node_modules\/appium-xcuitest-driver\/WebDriverAgent<\/p>\n<p>2.type command : &#8220;mkdir &#8211;<span class=\"hljs-tag\">p<\/span> Resources\/WebDriverAgent<span class=\"hljs-class\">.bundle&#8221;<\/span><\/p>\n<p>3. type command : &#8220;.\/Scripts\/bootstrap<span class=\"hljs-class\">.sh<\/span> -d&#8221;<\/p>\n<p>4.Now open the WebDriverAgent.xcodeproj in Xcode.<\/p>\n<p>&#8211; After opening it we have to set\u00a0&#8220;Automatically manage signing&#8221; for both WebDriverAgentLib and WebDriverAgentRunner.<\/p>\n<p>&#8211; Go to WebDriverAgentLib &#8211;&gt; Agent&#8211;&gt; General &#8211;&gt; Signing.<\/p>\n<p>We have to provide the same singing certificate which has used for the IPA. To add certificate you should have valid Apple ID and IPA singing certificate.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-751 size-full\" title=\"WebDriverAgentLib\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/42.png\" alt=\"WebDriverAgentLib\" width=\"1400\" height=\"674\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/42.png 1400w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/42-300x144.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/42-768x370.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/42-1024x493.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/42-800x385.png 800w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-750 size-full\" title=\"WebDriverAgentRun\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/43.png\" alt=\"WebDriverAgentRun\" width=\"1388\" height=\"659\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/43.png 1388w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/43-300x142.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/43-768x365.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/43-1024x486.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/43-800x380.png 800w\" sizes=\"(max-width: 1388px) 100vw, 1388px\" \/><\/p>\n<ul>\n<li>After that Build it. The build should be successful. After that, we can verify whether everything is working properly or not.<\/li>\n<li>Connect the iOS device and type the command in the terminal as :<\/li>\n<\/ul>\n<p><strong>Command :<\/strong> xcodebuild -project WebDriverAgent<span class=\"hljs-class\">.xcodeproj<\/span> -scheme WebDriverAgentRunner -destination <span class=\"hljs-string\">&#8216;id=&lt;udid&gt;&#8217;<\/span> test\u00a0 \u00a0\/\/ You have to mentioned udid of the device.<\/p>\n<h3><strong>Steps to create the simple script for the iOS application.<\/strong><\/h3>\n<p><strong>Step<\/strong> <strong>1<\/strong>. To create the project first open eclipse.<\/p>\n<p>Go to File &#8211;&gt; New &#8211;&gt; Other &#8211;&gt; Select Maven Project &#8211;&gt;select simple project and workspace&#8211;&gt; type groupid artifact id etc and click on finish.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-661 size-full\" title=\"Select Maven Project\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/18-1.png\" alt=\"Select Maven Project\" width=\"537\" height=\"510\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/18-1.png 537w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/18-1-300x285.png 300w\" sizes=\"(max-width: 537px) 100vw, 537px\" \/><\/p>\n<p>We will get the project in eclipse on the left-hand side.<\/p>\n<p><strong>Step 2<\/strong>. Now we will get the pom.xml file.<\/p>\n<p>Set the properties of Test-NG and appium in that file. Here we will mention the TestNG version and appium\u00a0jar files java version.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-663 size-full\" title=\"pom.xml file\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/19-1.png\" alt=\"pom.xml file\" width=\"1596\" height=\"460\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/19-1.png 1596w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/19-1-300x86.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/19-1-768x221.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/19-1-1024x295.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/19-1-800x231.png 800w\" sizes=\"(max-width: 1596px) 100vw, 1596px\" \/><\/p>\n<p><strong>Step 3<\/strong>. Then click on src\/test\/java to create the package.<\/p>\n<p>Src\/test\/java &#8211;&gt; new &#8211;&gt; package. Here Name of the package: &#8220;appiumPackage&#8221;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-664 size-full\" title=\"appium package\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/20-1.png\" alt=\"appium package\" width=\"533\" height=\"505\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/20-1.png 533w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/20-1-300x284.png 300w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/p>\n<p><strong>Step<\/strong> 4. Now create a class in a created package<\/p>\n<p>Right click &#8211;&gt; new &#8211;&gt; class<\/p>\n<p>A]Type new class name.Once a class is created then we will get it as in the figure. This class will be used\u00a0 to create appium iOS driver for appium.<\/p>\n<p>B] Now again create another class for Testcase execution. Here is the testcase class to run the test cases using appium.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-665 size-full\" title=\"java class\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/21-1.png\" alt=\"java class\" width=\"531\" height=\"642\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/21-1.png 531w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/21-1-248x300.png 248w\" sizes=\"(max-width: 531px) 100vw, 531px\" \/><\/p>\n<p><strong>Step 5<\/strong>. Now go to the src\/test\/resources &#8211;&gt; copy and paste the .app file in that folder. To run the iOS application we need either .ipa file or .app file.<\/p>\n<p>Right click&#8211;&gt;new&#8211;&gt;folder &#8211; Here we have to paste .app file \/ .ipa file<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-748 size-full\" title=\".app or .ipa file\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/23-2.png\" alt=\".app or .ipa file\" width=\"523\" height=\"576\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/23-2.png 523w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/23-2-272x300.png 272w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/p>\n<p><strong>Step 6<\/strong> .Type desired capabilities in the <strong>DemoClassForAppium.java<\/strong><\/p>\n<p>Here we need the code &#8211;<\/p>\n<p><em>\u00a0final File classpathRoot = new File(System.getProperty(&#8220;user.dir&#8221;));<\/em><\/p>\n<p><em>final File appDir = new File(classpathRoot, &#8220;\/src\/test\/resources\/app\/&#8221;);<\/em><\/p>\n<p><i>final File app = new File(appDir, &#8220;yourappname.app&#8221;); \/\/ give the path of .app file\/. ipa file .<\/i><\/p>\n<p><em>DesiredCapabilities caps = <strong>new<\/strong> DesiredCapabilities();<\/em><\/p>\n<p><em>caps.setCapability(&#8220;browserName&#8221;, &#8220;&#8221;);<\/em><\/p>\n<p><em>caps.setCapability(&#8220;platform&#8221;, &#8220;iOS&#8221;);\u00a0 \/\/Assign platform name of your application.<\/em><\/p>\n<p><em>caps.setCapability(&#8220;deviceName&#8221;, &#8220;name of your device&#8221;); \/\/Name of your device<\/em><\/p>\n<p><em>caps.setCapability(&#8220;appPackage&#8221;, &#8220;package of your application&#8221;); \/\/package of the application<\/em><\/p>\n<p><em>caps.setCapability(&#8220;appActivity&#8221;, &#8220;activity of your application&#8221;); \/\/app activity of the application<\/em><\/p>\n<p><em>This is very important. We have to mention the URL of the Appium server.<\/em><\/p>\n<p><em>driver = <strong>new<\/strong>\u00a0<u>IOSDriver<\/u>(<strong>new<\/strong> URL(&#8220;http:\/\/0.0.0.0:4723\/wd\/hub&#8221;), caps);<\/em><\/p>\n<p><strong>Step 6<\/strong> . Appium Inspector<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-747 size-full\" title=\"appium source\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/41.png\" alt=\"appium source\" width=\"1077\" height=\"568\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/41.png 1077w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/41-300x158.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/41-768x405.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/41-1024x540.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/41-800x422.png 800w\" sizes=\"(max-width: 1077px) 100vw, 1077px\" \/><\/p>\n<p>By using this we can find the elements of the application. We can get the elements by resource-id, Xpath, accessibility id, text etc.<\/p>\n<p>Example: Here I have given you the example for Accessibility\u00a0id. You can get the elements by other ways also.<\/p>\n<p><em>@Test(priority = 0)\u00a0 \/\/(Always give the priority to test case)<\/em><\/p>\n<p><em><strong>public<\/strong> <strong>void<\/strong> sampleTest() <strong>throws<\/strong> InterruptedException{<\/em><\/p>\n<p><em>System.<strong>out<\/strong>.println(&#8220;We launched the application succesfully&#8221;);<\/em><\/p>\n<p><em>\u00a0driver.findElement(MobileBy.AccessibilityId(&#8220;NO&#8221;)).click();\u00a0\u00a0 <\/em><\/p>\n<p><em>System.<strong>out<\/strong>.println(&#8220;We are able to click on NO button&#8221;);<\/em><\/p>\n<p><em>Thread.sleep(100);<\/em><\/p>\n<p><em>}<\/em><\/p>\n<p><strong>Steps 7.\u00a0<\/strong>Before we run the application, we have to set build path by providing archive files to the project.<\/p>\n<p>For this We have to Build Path&#8211;&gt; Configure Build Path&#8211;&gt;Libraries&#8211;&gt; Add external Jars&#8211;&gt; Apply and close.<\/p>\n<p><strong>Step 8<\/strong>. Once after done this, we have to run the application. To run the application we have to right click on the application. Select RunAs&#8211;&gt; TestNG Test.<\/p>\n<p>i]Before we have to do this step. We have to attach the android device by USB. And start the\u00a0appium server.<\/p>\n<p><strong>Start Appium Server<\/strong>: A]If you are starting the appium server by terminal then we have type in terminal\u00a0as : appium<\/p>\n<p>B]If you are starting appium by GUI desktop. then open appium gui and start the server.<\/p>\n<p>ii] Connect the real device to the system using data code and run the script using appium tool.<\/p>\n<p>We can get the result of test cases on the console.<\/p>\n<p>At the time of running the appium script, web driver agent successfully launched on the device for that will asks for trust this computer message. Always do Trust.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-673 size-medium\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1752-169x300.png\" alt=\"Start Appium Server\" width=\"169\" height=\"300\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1752-169x300.png 169w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1752-576x1024.png 576w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1752.png 750w\" sizes=\"(max-width: 169px) 100vw, 169px\" \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-674 size-medium\" title=\"enter passcode\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1751-169x300.png\" alt=\"enter passcode\" width=\"169\" height=\"300\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1751-169x300.png 169w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1751-576x1024.png 576w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/IMG_1751.png 750w\" sizes=\"(max-width: 169px) 100vw, 169px\" \/><\/p>\n<p>Once it has done it will launch the web driver agent as well as the application on the real device. We will get the output on the console.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-676 size-full\" title=\"Console output\" src=\"http:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/27-1.png\" alt=\"Console output\" width=\"1345\" height=\"351\" srcset=\"https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/27-1.png 1345w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/27-1-300x78.png 300w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/27-1-768x200.png 768w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/27-1-1024x267.png 1024w, https:\/\/nxglabs.in\/etech\/wp-content\/uploads\/2018\/08\/27-1-800x209.png 800w\" sizes=\"(max-width: 1345px) 100vw, 1345px\" \/><\/p>\n<p>In this above Article, I just explained how we can easily automate the iOS application using Appium Tool. Hope you all liked it. Thank You..!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Appium is an open source and cross-platform tool. Appium supports the android as well as iOS applications. Appium is a good mobile automation testing tools. We can automate the scripts in six languages as Java, Ruby, Python, PHP, JavaScript, and C#. With the help of jar files, we can automate the mobile application. Appium Supports &hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[70,40,73,66,67,63,72,68,71,69],"_links":{"self":[{"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/posts\/623"}],"collection":[{"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/comments?post=623"}],"version-history":[{"count":40,"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/posts\/623\/revisions"}],"predecessor-version":[{"id":811,"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/posts\/623\/revisions\/811"}],"wp:attachment":[{"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/media?parent=623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/categories?post=623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nxglabs.in\/etech\/wp-json\/wp\/v2\/tags?post=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}