<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sidharth Shukla</title>
    <description>The latest articles on DEV Community by Sidharth Shukla (@sidharthshukla).</description>
    <link>https://dev.to/sidharthshukla</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1000337%2Fdbcf1e85-9ca3-4d1b-95b8-b6a7828ec8ab.png</url>
      <title>DEV Community: Sidharth Shukla</title>
      <link>https://dev.to/sidharthshukla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sidharthshukla"/>
    <language>en</language>
    <item>
      <title>Appium Testing Tutorial For Mobile Applications</title>
      <dc:creator>Sidharth Shukla</dc:creator>
      <pubDate>Tue, 03 Jan 2023 16:58:16 +0000</pubDate>
      <link>https://dev.to/testmuai/appium-testing-tutorial-for-mobile-applications-46ao</link>
      <guid>https://dev.to/testmuai/appium-testing-tutorial-for-mobile-applications-46ao</guid>
      <description>&lt;p&gt;The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbd2clql9y3exujasg9n8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbd2clql9y3exujasg9n8.png" width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the present world, there are apps for every mobile device and purpose, and feedback is an integral part of their improvement process. With the emerging technology and demand for faster releases, it is quite important to make sure that the mobile apps need to be tested thoroughly before it is released to the customers.&lt;/p&gt;

&lt;p&gt;There are many tools available to perform &lt;a href="https://www.lambdatest.com/mobile-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;mobile app testing&lt;/a&gt; in the market. Still, there are more &lt;a href="https://www.lambdatest.com/blog/mobile-app-testing-challenges/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;challenges in mobile app testing&lt;/a&gt; than web application testing, as there is a huge fragmentation when it comes to mobile devices &amp;amp; mobile operating systems. You can learn more about Android and iOS fragmentation from our earlier blog on how to deal with &lt;a href="https://www.lambdatest.com/blog/ios-version-fragmentation/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;iOS version fragmentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Amongst all the &lt;a href="https://www.lambdatest.com/blog/mobile-app-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;mobile automation tools&lt;/a&gt; (or frameworks), Appium is one of the most popular open-source test automation frameworks for mobile app testing. It is cross-platform and compatible with a number of popular programming languages (e.g., Java, Python, JavaScript, etc.) for &lt;a href="https://www.lambdatest.com/app-test-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;app test automation&lt;/a&gt;. The best part is that you don’t have to recompile your app or modify it due to the usage of standard automation APIs on the supported platforms.&lt;/p&gt;

&lt;p&gt;While Selenium is still the king of the web, Appium rules the mobile domain, with 35% of the organization preferring it over other free/open-source functional automation tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcqm3dx0e0rqt5nssqjxq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcqm3dx0e0rqt5nssqjxq.png" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this Appium testing tutorial, we will deep dive into the essentials of the Appium framework for performing &lt;a href="https://www.lambdatest.com/mobile-automation-test?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;mobile automation tests&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Appium testing
&lt;/h2&gt;

&lt;p&gt;Appium is an open-source framework for automating native, mobile web, and hybrid applications on Android mobile, iOS mobile, and Windows desktop platforms. For starters, Appium was developed by Dan Cuellar and Jason Huggins and today has about 15.2K stars and 5.7K Fork on GitHub. It has the highest market share compared to all the other mobile automation frameworks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6j9w5ffomm4y3c7i0pfy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6j9w5ffomm4y3c7i0pfy.jpg" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the major categories of mobile applications that can be tested using the Appium framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Native apps&lt;/strong&gt; — These are written using the iOS, Android, or Windows SDKs. Instagram, Spotify, and Facebook are some of the most popular native mobile apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mobile web apps&lt;/strong&gt; — These are applications accessed using a mobile browser. Appium supports Safari on iOS and Chrome or the built-in ‘Browser’ app on Android. Uber and Pinterest are some of the most popular mobile web applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hybrid apps&lt;/strong&gt; — These applications have a wrapper around a “webview” — a native control that enables interaction with the web content. Projects like Apache Cordova make it easy to build new apps using web technologies bundled into a native wrapper, creating a hybrid app. LinkedIn and Facebook are the most popular hybrid mobile applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Progressive Web Apps (PWAs)&lt;/strong&gt; — &lt;a href="https://www.lambdatest.com/blog/progressive-web-apps-and-the-future-of-mobile-web/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Progressive Web Apps&lt;/a&gt; are almost the same as regular web pages. In fact, they also function when the device is in offline mode (i.e., when the device is not connected to the Internet). The best thing about these “PWAs” is that they can be accessed via the app icon on the device. By clicking on it, the icon launches the app website.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Intrigued to know more about Web, Hybrid, and Native apps? You can deep-dive into it by going through the &lt;a href="https://www.lambdatest.com/blog/web-vs-hybrid-vs-native-apps/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Web vs Hybrid vs Native Apps&lt;/a&gt; comparison.&lt;/p&gt;

&lt;p&gt;Appium is “cross-platform”; hence, tests written for one platform (i.e., Android, iOS, etc.) work seamlessly across other platforms supported by the Appium framework. This increases the code reusability factor and minimizes the code maintainability factor of the test code.&lt;/p&gt;

&lt;p&gt;Watch this video to learn about Appium, one of the most popular open-source test automation frameworks for mobile app testing.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Z_J8RmQf7Nw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Platforms supported by Appium
&lt;/h2&gt;

&lt;p&gt;Before we start discussing &lt;a href="https://www.lambdatest.com/appium-mobile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Appium Mobile Testing&lt;/a&gt; in greater detail, we should know about the platforms supported by Appium. In my personal experience, if we aren’t aware of the support provided by Appium, you may waste your time trying out some implementation that might not be supported by Appium.&lt;/p&gt;

&lt;p&gt;Appium supports multiple platforms and testing modalities mentioned below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Native Apps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hybrid Apps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web Apps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing on Real devices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing on Simulators and Emulators&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Appium supports iOS, Android, macOS, and Windows. Here is the list of drivers required for each platform:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;**iOS **Support for XCUITest Driver and SafariDriver for Apple’s Safaridriver.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Android **supports UiAutomator2 Driver, Espresso Driver, and Geckodriver for Firefox and GeckoView. However, UIAutomation Driver **support has been deprecated for both iOS and Android&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;**macOS **support for Mac2 Driver is for macOS 10.15 (or later). Windows Desktop supports WinAppDriver Geckodriver for Firefox and GeckoView.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Apart from these, some vendors/community-based drivers can be found on the Appium official website.&lt;/p&gt;

&lt;p&gt;In case you are a beginner to Appium you can learn to perform mobile app testing easily through this tutorial.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/pI5zrUhydyo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How to install Appium?
&lt;/h2&gt;

&lt;p&gt;Appium can be installed in two ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Via NPM (Node Package Manager).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By downloading Appium Desktop — a graphical, desktop-based way to launch the Appium server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation of Appium via NPM
&lt;/h2&gt;

&lt;p&gt;If you want to run Appium via an npm install, you will need Node.js and NPM (use nvm, n, or brew install node to install Node.js).&lt;/p&gt;

&lt;p&gt;Ensure that Node or Appium are not installed with sudo (or root); otherwise, you’ll run into problems. We recommend the latest stable version, though Appium supports Node.js 12+.&lt;/p&gt;

&lt;p&gt;Run the following command on the terminal to install Appium via npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  npm install -g appium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installation is done, we can type “npm — -version,” which will return the installed version as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AXTR822kfzwC2CxED.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AXTR822kfzwC2CxED.png" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation of Appium via Desktop App
&lt;/h2&gt;

&lt;p&gt;Simply download the latest version of Appium Desktop from the releases page of Appium official website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A9XOFUO4Grb_h13z8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A9XOFUO4Grb_h13z8.png" width="604" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to start the Appium Server?
&lt;/h2&gt;

&lt;p&gt;Appium server is basically written in Node.js and follows the HTTP JSON Wire Protocol. It acts as a virtual server that sends the commands to the framework to handle testing actions and scripts autonomously.&lt;/p&gt;

&lt;p&gt;The Appium server processes the request and then responds with the test results. Now we can kick up an Appium server, either by running it from the command line or by using Appium Desktop (assuming the npm install was successful).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We can use the below command to start the appium server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ⇒ appium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2- You will get to see &lt;strong&gt;Welcome to Appium&lt;/strong&gt; like the below screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2292%2F0%2AHucw514Uj7Y0ynJ0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2292%2F0%2AHucw514Uj7Y0ynJ0.png" width="800" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3- If you have installed Appium Desktop, then we can start by clicking on the ‘&lt;strong&gt;Start Server&lt;/strong&gt;’ button inside of Appium Desktop as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A7vnkit1pJ96N9jli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A7vnkit1pJ96N9jli.png" width="668" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4- Appium will now show you a little welcome message showing the version of Appium you’re running and what port it’s listening on (the default is 4723: You can use “netstat” to check whether a port is available or not).&lt;/p&gt;

&lt;p&gt;5- You can use port number 4726 instead of 4723. However, the server needs to be configured to run on the said port. This port information is vital since you will have to direct your test client to make sure to connect to Appium on this port. If you want to change the port, you can do so by using the -p flag when starting Appium (be sure to check out the full list of server parameters).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus Tip&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There is an easy way to start Appium server programmatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   AppiumDriverLocalService service = AppiumDriverLocalService.buildDefaultService();
    service.start(); // start the Appium Server
    service.stop(); // stop the Appium Server

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Android Emulators for Appium testing
&lt;/h2&gt;

&lt;p&gt;In my ten years of experience, I have observed that when we want to &lt;a href="https://www.lambdatest.com/blog/how-to-test-mobile-application-manually/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;test mobile applications&lt;/a&gt;, we always prefer to do the dry run on emulators. In fact, most organizations prefer emulators for running a regression suite for Appium testing. So it is quite vital to know about emulators and how to create one for Appium testing.&lt;/p&gt;

&lt;p&gt;Android emulator is a tool that creates virtual Android devices (with both software and hardware) that can be used for running &lt;a href="https://www.lambdatest.com/android-device-test?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Android device tests&lt;/a&gt; that are implemented using the Appium framework. You can go through the blog on &lt;a href="https://www.lambdatest.com/blog/difference-between-emulator-vs-simulator-for-mobile-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;emulator vs simulator&lt;/a&gt; differences to learn about emulators and simulators.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/android-emulator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Android emulators&lt;/a&gt; are very important for performing &lt;a href="https://www.lambdatest.com/android-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Android app testing&lt;/a&gt;. Below are the steps to create an Android Mobile Emulator, which we can use for Mobile testing on any Android version.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Download and install Android Studio in case it is not present on your machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Android Studio and click on “Configure” “AVD Manager” from the list as shown in the below screenshot.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AHhlnG21VP4sAkBOw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AHhlnG21VP4sAkBOw.png" width="668" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3- Now click on the “Create Virtual Device” button, and you will be redirected to the “Select Hardware” page, where we need to select the mobile type, for example, “Pixel XL,” as shown below and then click on “Next”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AIkqShaoC2QGFTn_q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AIkqShaoC2QGFTn_q.png" width="656" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4- After the “Select Hardware” page you will be able to see the “System Image” page. Here we need to select which Android version we want in our mobile device for testing, for example, Pie, Oreo, R, etc. In the below image, you can see that I have selected Android 11, then click “Next.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ad9GmeHH5UpcCuwOq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ad9GmeHH5UpcCuwOq.png" width="636" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we can change the Memory and Storage by clicking on “Show Advanced Settings.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ADzXauWFkULg27LEU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ADzXauWFkULg27LEU.png" width="644" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5- Now you will arrive at the “Verify Configuration” page. Here, you can check the selection we have made in steps 3 and 4. Provide the name for your device as I have given the name “AndroidMobile” in the below screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ae9yVwKlVDeCDof2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ae9yVwKlVDeCDof2c.png" width="644" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6- Now the device is created, and in the dashboard, we can see it. Search with the device name that we have provided in Step 5, as shown below. Now click on the ‘Play’ button, and the device is ready for testing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A3lTRa7GgcQBBd_QX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A3lTRa7GgcQBBd_QX.png" width="648" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above screenshot, we have an edit option, which can be used to edit some fields for the emulator, and the dropdown button can be used for cold boot.&lt;/p&gt;

&lt;p&gt;But sometimes, it’s really difficult to go through all the six steps mentioned above to create an emulator. So, instead of that, you can also use &lt;a href="https://www.lambdatest.com/android-emulator-online?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;online Android emulators&lt;/a&gt; provided by LambdaTest.&lt;/p&gt;

&lt;p&gt;Cloud-based &lt;a href="https://www.lambdatest.com/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;cross browser testing&lt;/a&gt; platforms like LambdaTest provides an &lt;a href="https://www.lambdatest.com/online-device-farm?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;online device farm&lt;/a&gt; of over 3000+ Android emulators to &lt;a href="https://www.lambdatest.com/test-on-android-devices?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;test on Android devices&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We need to run just three steps to start an emulator on LambdaTest:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://accounts.lambdatest.com/login?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=login" rel="noopener noreferrer"&gt;Login to LambdaTest&lt;/a&gt; and go to the &lt;a href="https://accounts.lambdatest.com/login?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=login" rel="noopener noreferrer"&gt;LambdaTest Dashboard&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to Real Time Testing &amp;gt; App Testing as shown below:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AS8djCzJZ7WfrzVmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AS8djCzJZ7WfrzVmh.png" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3- Now select your &lt;strong&gt;BRAND **and **DEVICE/OS&lt;/strong&gt; and then click on the &lt;strong&gt;START&lt;/strong&gt; button. Here, the sample apk is mentioned, but you can use your apk for Appium testing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2ATr_gd5X8e_VEtcpz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2ATr_gd5X8e_VEtcpz.png" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Isn’t it easy :), Don’t forget to stop the emulator after use by clicking on the last button on the left panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AlWnoOuGSSEs5s7md.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AlWnoOuGSSEs5s7md.png" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/blog/regression-testing-what-is-and-how-to-do-it/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Regression testing&lt;/a&gt;- Complete Guide With Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing App on Emulators
&lt;/h2&gt;

&lt;p&gt;Once the emulator is ready for use and the Android path is set up correctly, the next step would be to install an app on the emulator on which we would be performing the app testing.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The first step is to run the emulator on which you need to install the app.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   emulator -avd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2- The emulator will be launched, and the command will run in the terminal.&lt;/p&gt;

&lt;p&gt;3- There are two ways to install the app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install via ADB command:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Download the apk and put it in folder&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the following command&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;adb install path/to/your/app.apk&lt;br&gt;
When multiple emulators are open, run the following command&lt;br&gt;
adb -s serial-number-of-device install path/to/your/app.apk&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drag and Drop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can also drag the apk file and drop on to the emulator, which will install the application.&lt;/p&gt;

&lt;p&gt;Now perform testing by dragging your .apk to the newly created virtual device. There are many websites that provide the sample apk, which can be used for testing. If you do not have any .apk or .ipa files, you can run your sample tests on LambdaTest using our sample 🔗 Android app or sample 🔗 &lt;a href="https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa" rel="noopener noreferrer"&gt;iOS app&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to identify elements for Appium testing?
&lt;/h2&gt;

&lt;p&gt;Before we can start writing test scripts, we need to understand identifying elements using attributes such as ID, Name, Class, etc., to perform actions. You can go through this &lt;a href="https://www.lambdatest.com/learning-hub/selenium-locators?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Selenium Locators tutorial&lt;/a&gt; to learn more about the locators.&lt;/p&gt;

&lt;p&gt;To identify (or locate) elements, we can use &lt;strong&gt;UIAutomatorViewer&lt;/strong&gt; or &lt;a href="https://www.lambdatest.com/blog/appium-inspector-for-apps/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Appium inspector&lt;/a&gt; to capture a snapshot of the current device screen, which shows the hierarchy of the UI components properly arranged on the screen.&lt;/p&gt;

&lt;p&gt;UI Automator Viewer is a GUI tool that comes with Android SDK and is primarily used to inspect UI components of the Android Application. It also lets you view the properties associated with it. We can find it in the Android SDK “tools” folder with the file name ‘uiautomatorviewer.bat’ on Windows OS.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to access elements using UIAutomatorViewer?
&lt;/h2&gt;

&lt;p&gt;When designing automation scripts, Appium uses “UIAutomatorViewer” to identify different properties of the object and use the properties to identify the required object.&lt;/p&gt;

&lt;p&gt;There are several ways by which the UIAutomatorViewer can be launched:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;For Windows&lt;/strong&gt;: Go to the path where UIAutomatorViewer exists (Android SDK folder) and run the batch file (for Windows) — uiautomatorviewer.bat.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;For Mac&lt;/strong&gt;: Go to the location via terminal and run the uiautomatorviewer sh file. Execution permission must be given to the file, or errors will be thrown.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can be added as an alias to run directly via the terminal. In the Mac machine, add it to the bash_profile file.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: alias inspector='$ANDROID_HOME/tools/bin/uiautomatorviewer'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Mac:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Atgr6SnoZS8v5bRfP.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Atgr6SnoZS8v5bRfP.png" width="624" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the below mentioned steps for using UIAutomatorViewer:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Connect the device to the PC via USB cable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enable USB Debugging mode for the device connected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the ADB devices command in the command prompt/terminal to check if the device is detected and online/available.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open an application and click the &lt;strong&gt;device screenshot&lt;/strong&gt; icon from the right up corner.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2FNaN%2F1%2Ab31hiO4ynbDLRrXWEFF4aQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2FNaN%2F1%2Ab31hiO4ynbDLRrXWEFF4aQ.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5- After clicking on ‘&lt;strong&gt;Device Screenshot&lt;/strong&gt;‘, an image of the current screen will be loaded in the UIAutomatorViewer, and we can use the mouse to click on any element and see the details of that element. You can also use the hierarchical tree in the top right to browse a particular element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note&lt;/em&gt;&lt;/strong&gt;: The UIAutomatorViewer works only with Android native app elements.&lt;/p&gt;

&lt;p&gt;Want to make your life of testing easy and fuss-free while debugging? &lt;a href="https://www.lambdatest.com/lt-debug?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Try LT Debug Chrome extension!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: Mobile &lt;a href="https://www.lambdatest.com/mobile-emulator-online?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Emulator Online&lt;/a&gt;- Test your mobile websites and smartphone apps using our scalable on cloud mobile emulator.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to work with Appium Inspector?
&lt;/h2&gt;

&lt;p&gt;A default inspector available in standalone Appium (not in the npm version) is called &lt;strong&gt;Appium Inspector&lt;/strong&gt;, which can be used to inspect Android and iOS elements. It simply mirrors the screen of the device, and we can interact with it and get the details of the elements. Let’s see how we can launch and work with it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Launch Appium from your application/programs menu by clicking on Start Server. You can refer to the screenshot in the “&lt;a href="https://www.lambdatest.com/blog/appium-tutorial/#D?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;How to start the Appium Server&lt;/a&gt;” section of this blog.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2- Click the Search icon from the right up corner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ApsycYn1gJ3v9i2cP.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ApsycYn1gJ3v9i2cP.png" width="624" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add correct desired capabilities as per your device/emulator and application. Then click on the &lt;strong&gt;Start Session&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AQQ01k_CWXrJIIwG3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AQQ01k_CWXrJIIwG3.png" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4- It will open the App screen, App Source (the hierarchy of elements), and Selected Element Pane (The attributes and associated values of the element). You can use this to create locators which will uniquely identify the element.&lt;/p&gt;

&lt;p&gt;5- You can provide a .apk or .app file in desired capabilities inside Appium Inspector, which will install and launch the app. Refer to the screenshots below, which we have used to test .apk and passed in the value against “app.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2308%2F0%2Aq7DXkBpfIePfJn9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2308%2F0%2Aq7DXkBpfIePfJn9x.png" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6- Best thing about the Appium Inspector is that you can verify your written locator on screen. Check the below screenshots.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A6h2M1PU7fCFgo3Gm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A6h2M1PU7fCFgo3Gm.png" width="624" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your locator is correct, then it will highlight the associated element.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AcRBTnwOxqw5Md7bS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AcRBTnwOxqw5Md7bS.png" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes the screen on the left and your emulator won’t be in sync, so we need to click on the refresh button to bring the screen and emulator in sync:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ABo4R8JA5Pvng60rJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ABo4R8JA5Pvng60rJ.png" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Locators used for Mobile Automation
&lt;/h2&gt;

&lt;p&gt;Shown below are some of the major locators used for mobile app automation:&lt;/p&gt;


&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;STRATEGY&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;DESCRIPTION&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Accessibility ID&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;    Reads a unique identifier for a UI element. For XCUITest, it is the element’s accessibility-id attribute. For Android, it is the element’s content-desc attribute.&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Class name&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;    For iOS, it is the full name of the XCUI element and begins with XCUIElementType. For Android it is the full name of the UIAutomator2 class (e.g., android.widget.TextView)&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;ID&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;    Native element identifier. resource-id for android; name for iOS.&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Name&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;    Name of element.&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;XPath&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;    Searches the app XML source using xpath (not recommended, has performance issues)&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Image&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;    Locates an element by matching it with a base 64 encoded image file&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Android UiAutomator (UiAutomator2 only)&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;Uses the UIAutomator API, in particular, the UiSelector class to locate elements. In Appium, you send the Java code, as a string, to the server, which executes it in the application’s environment, returning the element or elements. &lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Android View Tag (Espresso only)&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;Locates an element by its view tag. &lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;Android Data Matcher (Espresso only)&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;Locates an element using Espresso DataMatcher. &lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
    &lt;tr&gt;
&lt;br&gt;
        &lt;td&gt;iOS UIAutomation&lt;/td&gt;
&lt;br&gt;
        &lt;td&gt;When automating an iOS application, Apple’s Instruments framework can be used to find elements.&lt;/td&gt;
&lt;br&gt;
    &lt;/tr&gt;
&lt;br&gt;
&lt;/table&gt;&lt;/div&gt; 

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/webdriver?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;WebDriver&lt;/a&gt; Tutorial: A Comprehensive Guide on Selenium WebDriver Automation&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to run Appium tests on iOS and Android?
&lt;/h2&gt;

&lt;p&gt;In this section of this Appium testing tutorial, I will walk you through the steps for running Appium tests with iOS and Android. First, make sure the Appium server is up and running. You can refer to the section “&lt;a href="https://www.lambdatest.com/blog/appium-tutorial/#D?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;How to start the Appium Server&lt;/a&gt;” in this blog to kick start your first step for Appium testing.&lt;/p&gt;

&lt;p&gt;Then, we have to check that the Android emulator we have created in the section “&lt;a href="https://www.lambdatest.com/blog/appium-tutorial/#E?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Android Emulators for Appium testing&lt;/a&gt;” is up and running. For that, we need to run adb devices. For example, we should see one device connected, as shown in the below screenshot. This is the device Appium will use for testing purposes. (Remember that if the Android SDK tools are on your path, simply run: emulator -avd )&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3520%2F0%2A3V9t4yYbhgZO3pHS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3520%2F0%2A3V9t4yYbhgZO3pHS.png" width="800" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to wait for the Android emulator to finish launching. Sometimes, for various reasons, adb gets stuck. If it’s not showing any connected devices or otherwise failing, we can restart it by running: adb kill-server &amp;amp;&amp;amp; adb devices.&lt;/p&gt;

&lt;p&gt;Once we are done with starting the Appium server and checking the emulator, then we should be aware of the desired capabilities as per the OS(Android/iOS) we are using for Appium testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Android&lt;/strong&gt;: Set the following desired capabilities in your WebDriver script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
    capabilities.setCapability(MobileCapabilityType.APP, myApp);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using your WebDriver library of choice, set the remote session to use these capabilities and connect to the server running at port 4723 of localhost (or whatever host and port you specified when you started Appium). You are all set now!&lt;/p&gt;

&lt;p&gt;There are many ways to start an Appium application (it will work exactly the same way as when the application is started via ADB command):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;apk or zip only, default activity will be launched (‘app’ capability)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;apk + activity (‘app’ + ‘appActivity’ capabilities)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;apk + activity + intent (‘app’ + ‘appActivity’ + ‘appIntent’ capabilities)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are not sure what activity is configured in your apk, you can proceed in one of the following ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mac/Linux: ‘adb shell dumpsys window windows | grep mFocusedApp’&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the Ruby console: ‘adb shell dumpsys window windows`.each_line.grep(/mFocusedApp/).first.strip’&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Windows terminal, run ‘adb shell dumpsys window windows’ and manually look for the mFocusedApp line.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;iOS&lt;/strong&gt;: Set the following desired capabilities in your WebDriver script::&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    DesiredCapabilities capabilities = new DesiredCapabilities();&lt;br&gt;
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");&lt;br&gt;
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4");&lt;br&gt;
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");&lt;br&gt;
    capabilities.setCapability(MobileCapabilityType.APP, myApp);&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the set of capabilities for Android and iOS, myApp must be any one of the below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A local absolute path to your .apk or a .zip&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An URL of a zip file containing your .apk&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;path to one of the sample app relative to the appium install root&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using the WebDriver library of choice, we can set the remote session to use these capabilities and connect to the server running at port 4723 of localhost . You should be all set now!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AMItoJMnXFuCY9eV3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AMItoJMnXFuCY9eV3.jpg" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: Test On &lt;a href="https://www.lambdatest.com/test-on-iphone-simulator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;iPhone tester&lt;/a&gt; Simulator On Cloud&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Appium testing with Demo Code
&lt;/h2&gt;

&lt;p&gt;Here, we are using simple code, which can be used by anyone for their first test on Appium. We are using an emulator that we created in this post to run our apk, which can be downloaded from the ”&lt;a href="https://www.lambdatest.com/blog/appium-tutorial/#F?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Installing App on Emulators&lt;/a&gt;” section of this post.&lt;/p&gt;

&lt;p&gt;We will try to verify two important scenarios in the test below, the first one is “&lt;strong&gt;open the geolocation page&lt;/strong&gt;” and the second one is “&lt;strong&gt;speed test page&lt;/strong&gt;”. Apart from the code, I will share the screenshot on the emulator while running the test script for both the scenarios mentioned above.&lt;/p&gt;

&lt;p&gt;Sometimes it’s difficult to start from scratch, so to make life easier, you can clone the LambdaTest’s 🔗LT-appium-java repository and then replace the vanilla_android.java class with the code mentioned below.&lt;/p&gt;

&lt;p&gt;Now we are halfway done. We just need to hit the below two commands to run our sample test for Appium testing on &lt;a href="https://www.lambdatest.com/apk-emulator-online?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Android APK emulator online&lt;/a&gt;. The first command is to install dependencies and second one to run our suite.&lt;/p&gt;

&lt;p&gt;To install the required dependencies:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn clean install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To run your test just type below command in your command prompt:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
  mvn compile exec:java -Dexec.mainClass=vanilla_android -Dexec.classpathScope=”test”&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample Code:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
   import io.appium.java_client.AppiumDriver;&lt;br&gt;
    import io.appium.java_client.MobileBy;&lt;br&gt;
    import io.appium.java_client.MobileElement;&lt;br&gt;
    import org.openqa.selenium.JavascriptExecutor;&lt;br&gt;
    import org.openqa.selenium.remote.DesiredCapabilities;&lt;br&gt;
    import org.openqa.selenium.remote.RemoteWebDriver;&lt;br&gt;
    import java.net.MalformedURLException;&lt;br&gt;
    import java.net.URL;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class vanilla_android {
   private static AppiumDriver driver;

   public static void main(String args[]) throws MalformedURLException, InterruptedException {

       try {
           DesiredCapabilities capabilities = new DesiredCapabilities();
           capabilities.setCapability("deviceName", "AndroidMobile");
           capabilities.setCapability("platformVersion", "11");
               capabilities.setCapability("platformName", "Android");
           capabilities.setCapability("isRealMobile", false);
           capabilities.setCapability("app", "/Users/{user}/Downloads/proverbial_android.apk"); //Enter your app url
           capabilities.setCapability("name", "Sample Test Java");
           capabilities.setCapability("console", true);
           capabilities.setCapability("network", false);
           capabilities.setCapability("visual", true);
           capabilities.setCapability("devicelog", true);


           driver = new AppiumDriver(new URL("http://localhost:4723/wd/hub"), capabilities);

           //Open the geolocation page
           MobileElement geo = (MobileElement) driver.findElement(MobileBy.id("com.lambdatest.proverbial:id/geoLocation"));
           geo.click();
           Thread.sleep(5000);

           //takes back to home page
           MobileElement el3 = (MobileElement) driver.findElementByAccessibilityId("Home");

           driver.navigate().back();
           Thread.sleep(2000);

           //Takes to speed test page
           MobileElement speedtest = (MobileElement) driver.findElement(MobileBy.id("com.lambdatest.proverbial:id/speedTest"));
           speedtest.click();
           Thread.sleep(15000);

           driver.navigate().back();

       } catch (AssertionError a) {
           ((JavascriptExecutor) driver).executeScript("lambda-status=failed");
           a.printStackTrace();
       }
// The driver.quit statement is required, otherwise the test continues to execute, leading to a timeout.
       driver.quit();
   }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I am going to share two screenshots from live running to give you guys a look and feel of scenarios running on an emulator. The left section of the screenshot shows the execution of commands on the command prompt and the right panel is the emulator on which the script is executing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 1:&lt;/strong&gt; Open the geolocation page (check the geolocation page on the emulator screen)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AH2UunRyaofnL0m3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AH2UunRyaofnL0m3d.png" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 2:&lt;/strong&gt; Takes the speed of the test page. (check the speed of the test page on the emulator).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AmOEGSUA6b-mb52pb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AmOEGSUA6b-mb52pb.png" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Steps for Common Errors in Appium
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Make sure that before running the suite, the Android emulator is up and running. It’s useful to run adb kill-server &amp;amp;&amp;amp; adb devices. This can reset the connection to the Android device, and the issue can be resolved.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you’re running your Android emulator using Fastboot and the emulator isn’t being detected by ADB properly, try doing a cold boot: Android Studio &amp;gt; Tools &amp;gt; AVD Manager &amp;gt; Actions &amp;gt; Cold Boot Now. This will mostly solve all emulator issues (refer to Step 6) from the “&lt;a href="https://www.lambdatest.com/blog/appium-tutorial/#E?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Android Emulators for Appium testing&lt;/a&gt;” section to know how to cold boot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For iOS, if the Instrument crashes when running against a physical device (“exited with code 253”), ensure Xcode has downloaded device symbols. Go to Window -&amp;gt; Devices, and then it should start automatically. It is needed after iOS version upgrades.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We need to ensure that the macOS keychain that holds the certificate required for building the app and the WebDriverAgent is unlocked. Especially when you are using ssh.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;General symptoms to look for are codesign failures.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Appium may sometimes have difficulties finding the node executable if you’ve installed Node and npm via MacPorts. We need to make sure that the MacPorts bin folder (default path is : /opt/local/bin ) is added to PATH somewhere in ~/.profile, ~/.bash_profile or ~/.bashrc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you get an error “[INST STDERR] posix spawn failure; aborting launch” while running iOS tests, your app is not compiled correctly for the simulator or device.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Appium testing on Real Device Cloud
&lt;/h2&gt;

&lt;p&gt;When we talk about Appium testing or try to figure out the real use of Appium then, in my past experiences, two things come to my mind: The first one is that it supports both &lt;a href="https://www.lambdatest.com/android-automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Android automation testing &lt;/a&gt;and &lt;a href="https://www.lambdatest.com/ios-automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;iOS automation testing&lt;/a&gt;, and the second one is that Appium is free and open source.&lt;/p&gt;

&lt;p&gt;Remember that the learning curve for Appium testing is also quite easy, and you must have realized it by now if you are at the end of this post.&lt;/p&gt;

&lt;p&gt;One important point to remember is that until now, we have run our test scripts using an emulator, but you must be wondering if I want to run on a &lt;a href="https://www.lambdatest.com/blog/real-device-cloud/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;real device cloud&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Do I need to buy an iPhone or Android phone? So the answer is NO. Now you must think, if we won’t buy a device, how can we test it? The answer is the buzzword “Cloud Devices.”&lt;/p&gt;

&lt;p&gt;The best part is running our existing scripts on a real device is a cakewalk. Below, I will explain what changes to make if we opt for running our test on LambdaTest real device cloud. Here’s the walkthrough of the automated app testing on real devices using LambdaTest.&lt;/p&gt;

&lt;p&gt;{% youtube _gC5igQyJf8 %}&lt;/p&gt;

&lt;p&gt;You can also subscribe to the &lt;a href="https://www.youtube.com/channel/UCCymWVaTozpEng_ep0mdUyw?sub_confirmation=1" rel="noopener noreferrer"&gt;LambdaTest YouTube Channel&lt;/a&gt; and stay updated with the latest tutorials around &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Selenium testing,&lt;/a&gt; &lt;a href="https://www.lambdatest.com/cypress-e2e-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Cypress E2E testing&lt;/a&gt;, CI/CD, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: Run Automated &lt;a href="https://www.lambdatest.com/puppeteer-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Puppeteer Testing&lt;/a&gt; Online&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can use the same code that I have shared before but with the below changes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Firstly let’s change the value of desired capabilities for parameters:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    DesiredCapabilities capabilities = new DesiredCapabilities();&lt;br&gt;
                capabilities.setCapability("deviceName", "Galaxy S20");&lt;br&gt;
                capabilities.setCapability("platformVersion", "11");&lt;br&gt;
                capabilities.setCapability("platformName", "Android");&lt;br&gt;
                capabilities.setCapability("isRealMobile", true);&lt;br&gt;
                capabilities.setCapability("app", "lt://APP10016551653068008326557"); //Enter app URL&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2- Second change is to use Username and Password from LambdaTest and change Appium driver instance:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
    public static String userName = System.getenv("LT_USERNAME") == null ? "LT_USERNAME"  //Add username here&lt;br&gt;
                : System.getenv("LT_USERNAME");&lt;br&gt;
        public static String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "LT_ACCESS_KEY" //Add accessKey here&lt;br&gt;
                : System.getenv("LT_ACCESS_KEY");&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver = new AppiumDriver(new URL("https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"), capabilities);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;br&gt;
3- If you want help for creating authentication or uploading your app to the real device provided by LambdaTest, you can refer to this &lt;a href="https://www.lambdatest.com/support/docs/appium-java/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Java with Appium&lt;/a&gt; documentation.&lt;/p&gt;

&lt;p&gt;One thing we need to remember is that the scenarios are the same as used in the previous script using the emulator (open the geolocation page &amp;amp; take to speed test page). After all the changes are made on the vanilla_android class, the final piece of code will look like below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
    import io.appium.java_client.AppiumDriver;&lt;br&gt;
    import io.appium.java_client.MobileBy;&lt;br&gt;
    import io.appium.java_client.MobileElement;&lt;br&gt;
    import io.appium.java_client.ios.IOSDriver;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.MalformedURLException;
import java.net.URL;

public class vanilla_android {
    public static String userName = System.getenv("LT_USERNAME") == null ? "LT_USERNAME"  //Add username here
            : System.getenv("LT_USERNAME");
    public static String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "LT_ACCESS_KEY" //Add accessKey here
            : System.getenv("LT_ACCESS_KEY");
    private static AppiumDriver driver;

    public static void main(String args[]) throws MalformedURLException, InterruptedException {

        try {

            DesiredCapabilities capabilities = new      DesiredCapabilities();
            capabilities.setCapability("deviceName", "Galaxy S20");
            capabilities.setCapability("platformVersion", "11");
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("isRealMobile", true);
            capabilities.setCapability("app", "lt://APP10016551653068008326557"); //Enter your app url
            capabilities.setCapability("deviceOrientation", "PORTRAIT");
            capabilities.setCapability("build", "Java Vanilla - Android");
            capabilities.setCapability("name", "Sample Test Java");
            capabilities.setCapability("console", true);
            capabilities.setCapability("network", false);
            capabilities.setCapability("visual", true);
            capabilities.setCapability("devicelog", true);
            driver = new AppiumDriver(new URL("https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"), capabilities);
          //  driver = new AppiumDriver(new URL("http://localhost:4723/wd/hub"), capabilities);

            //Open the geolocation page
            MobileElement geo = (MobileElement) driver.findElement(MobileBy.id("com.lambdatest.proverbial:id/geoLocation"));
            geo.click();
            Thread.sleep(5000);

            //takes back to home page
            MobileElement el3 = (MobileElement) driver.findElementByAccessibilityId("Home");

              driver.navigate().back();
            Thread.sleep(2000);

            //Takes to speed test page
            MobileElement speedtest = (MobileElement) driver.findElement(MobileBy.id("com.lambdatest.proverbial:id/speedTest"));
            speedtest.click();
            Thread.sleep(15000);

            driver.navigate().back();

        } catch (AssertionError a) {
            ((JavascriptExecutor) driver).executeScript("lambda-status=failed");
            a.printStackTrace();
        }
// The driver.quit statement is required, otherwise the test continues to execute, leading to a timeout.
        driver.quit();
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4- Once you run it from the command line using the command shared in the “&lt;a href="https://www.lambdatest.com/blog/appium-tutorial/#i?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Appium testing with Demo Code&lt;/a&gt;” section:(mvn compile exec:java -Dexec.mainClass=vanilla_android -Dexec.classpathScope="test"), you can go to LambdaTest and check the execution report under Real Device section which will look like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AJcav0tj-AWn6B2Vt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AJcav0tj-AWn6B2Vt.png" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The dashboard shown above has many features like screenshots, artifacts, logs, and execution videos. Now with the execution visible on the dashboard, we are done with running our tests on real devices!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/agile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Agile Testing&lt;/a&gt; Tutorial: A Comprehensive Guide With Examples and Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this &lt;a href="https://www.lambdatest.com/learning-hub/mobile-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;mobile app testing tutorial&lt;/a&gt;, we deep-dived into the basics of the Appium framework for performing Android and iOS app testing with code demonstration. We also looked at running Appium tests on cloud grids like LambdaTest. Finally, we learned how to debug errors while running Appium tests and how to run Appium tests on real devices.&lt;/p&gt;

&lt;p&gt;Remember, “Try and Fail but do not fail to try.” So try to run the tests with the demo code provided in this Appium tutorial, and we’ll be happy to hear your thoughts. You can use LambdaTest to &lt;a href="https://www.lambdatest.com/test-on-oppo?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan03_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;test on Oppo&lt;/a&gt; &amp;amp; other mobile devices right from android to iPhone.&lt;/p&gt;

&lt;p&gt;Happy Testing!&lt;/p&gt;

&lt;p&gt;](url)&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How To Automate iOS App Using Appium</title>
      <dc:creator>Sidharth Shukla</dc:creator>
      <pubDate>Mon, 02 Jan 2023 14:02:49 +0000</pubDate>
      <link>https://dev.to/testmuai/how-to-automate-ios-app-using-appium-3l55</link>
      <guid>https://dev.to/testmuai/how-to-automate-ios-app-using-appium-3l55</guid>
      <description>&lt;p&gt;Mobile apps have been an inseparable part of daily lives. Every business wants to be part of the ever-growing digital world and stay ahead of the competition by developing unique and stable applications.&lt;/p&gt;

&lt;p&gt;Among all the mobile operating systems available in the market, current research states that iOS is the second most popular mobile operating system. There are some strong reasons behind it. Firstly, iOS is not restricted by any zonal or language barrier. Secondly, it supports 40 different languages, giving users a broader option globally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsqyxijrxgollok2dkhoh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsqyxijrxgollok2dkhoh.png" width="800" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the report, Apple sells nearly 200 Million iPhones annually, and Apple users download an average of 51 apps per minute. &lt;a href="https://www.lambdatest.com/blog/key-to-intuitive-mobile-ux/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Developing an intuitive app&lt;/a&gt; is just half the battle won, as the second half can only be won if the app is fully functional and creates a lasting impression on the users. This is why rigorous &lt;a href="https://www.lambdatest.com/ios-automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;iOS automation testing&lt;/a&gt; of apps becomes an absolute necessity!&lt;/p&gt;

&lt;p&gt;To ensure that the iOS app runs flawlessly, you must ensure that &lt;a href="https://www.lambdatest.com/mobile-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;mobile app testing&lt;/a&gt; is planned and executed perfectly. To achieve it, you need to use a framework like &lt;a href="https://www.lambdatest.com/appium?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Appium&lt;/a&gt; to run iOS app testing on real iOS devices at scale. The result is wider coverage and faster execution with utmost quality.&lt;/p&gt;

&lt;p&gt;This &lt;a href="https://www.lambdatest.com/learning-hub/mobile-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;mobile app testing tutorial&lt;/a&gt; on performing &lt;a href="https://www.lambdatest.com/appium-mobile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Appium testing&lt;/a&gt; of iOS devices will help you answer all questions pertaining to how to automate iOS app using Appium.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/black-box-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Black Box Testing&lt;/a&gt; Tutorial: A Comprehensive Guide With Examples and Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of iOS application testing
&lt;/h2&gt;

&lt;p&gt;There are specifically two types of iOS application testing, either you can test it using the &lt;strong&gt;simulator&lt;/strong&gt; or by using the &lt;strong&gt;real device&lt;/strong&gt;. In most real-time projects, the team prefers to perform &lt;a href="https://www.lambdatest.com/blog/regression-testing-what-is-and-how-to-do-it/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;regression testing&lt;/a&gt; in the &lt;a href="https://www.lambdatest.com/ios-simulator-online?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;iOS simulator&lt;/a&gt;, but &lt;a href="https://www.lambdatest.com/blog/setting-up-an-ios-simulator-for-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;simulator testing&lt;/a&gt; alone is insufficient for QA sign-off. This is why test (or QA) teams prefer to execute one round of Smoke or Sanity on the real devices.&lt;/p&gt;

&lt;p&gt;When teams perform iOS testing, they like to run &lt;a href="https://www.lambdatest.com/blog/automated-functional-testing-what-it-is-how-it-helps/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Functional Testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/infographics/performance-testing-basics?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Performance Testing&lt;/a&gt;, Security Testing, and Hardware Testing. It is important to note that Performance, Security, and Hardware Testing are non-functional testing types.&lt;/p&gt;

&lt;p&gt;In this &lt;a href="https://www.lambdatest.com/blog/appium-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Appium testing tutorial&lt;/a&gt;, we will perform functional testing on iOS using a &lt;a href="https://www.lambdatest.com/real-device-cloud?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;real device cloud&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Many &lt;a href="https://www.lambdatest.com/blog/best-mobile-app-testing-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;mobile app testing frameworks&lt;/a&gt; facilitate &lt;a href="https://www.lambdatest.com/automated-device-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;automated device testing&lt;/a&gt; on iOS. However, my personal choice has always been “Appium.” You will know about the USPs of Appium once you read through this blog on how to automate iOS app using Appium.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvs1vdio0q23qr10e4smv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvs1vdio0q23qr10e4smv.png" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/system-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;System Testing&lt;/a&gt; Tutorial: A Comprehensive Guide With Examples and Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Appium?
&lt;/h2&gt;

&lt;p&gt;Appium is an open source &lt;a href="https://www.lambdatest.com/blog/best-test-automation-frameworks-2021/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;test automation framework&lt;/a&gt; for automating native, mobile web, and hybrid applications on iOS devices, Android devices, and Windows desktop platforms. Importantly, Appium is “cross-platform”: it allows you to write tests against multiple platforms (iOS, Android, Windows) using the same API.&lt;/p&gt;

&lt;p&gt;In simple words, it processes the request from the client and forwards it to the &lt;a href="https://www.lambdatest.com/blog/difference-between-emulator-vs-simulator-for-mobile-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;simulator and emulator&lt;/a&gt; or real devices. The test scripts are automated, and the result is communicated to the client via the server. This &lt;a href="https://www.lambdatest.com/blog/emulator-vs-simulator-vs-real-device/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;emulator vs simulator vs real device testing&lt;/a&gt; blog will help you learn more about it.&lt;/p&gt;

&lt;p&gt;This enables code reuse between iOS, Android, and Windows test suites. The best part is using programming languages such as JavaScript, Java, Ruby, Python, PHP, and C# for Appium test script design.&lt;/p&gt;

&lt;p&gt;As per the official website of Appium, per month, around 416k downloads are done by the users. It has a massive number of users along with community support.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ofr64jod8c0rho8zcso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ofr64jod8c0rho8zcso.png" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Watch this video to learn about Appium, one of the most popular open-source test automation frameworks for mobile app testing.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Z_J8RmQf7Nw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/exploratory-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Exploratory Testing&lt;/a&gt; Tutorial: A Comprehensive Guide With Examples and Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of automating iOS app testing using Appium
&lt;/h2&gt;

&lt;p&gt;As discussed earlier in this blog on how to automate iOS app using Appium, you must have had a little idea about iOS and Appium by now, but the million-dollar question is &lt;strong&gt;why Appium?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Appium has shown significant progress and is quickly becoming a preferred &lt;a href="https://www.lambdatest.com/blog/automation-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;automation testing tool&lt;/a&gt; for mobile applications, with 35% of the organizations choosing it over other free/open source functional testing tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnujo7kpbkyezuhj6ykbi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnujo7kpbkyezuhj6ykbi.png" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, let’s point out some of the significant benefits of Appium for iOS app testing. We have alternatives for iOS automation, but Appium is easy to use and has extensive community support.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cross platform&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Appium is “cross-platform”. This means you can use the same tests across multiple platforms (iOS, Android, Windows). Not a single line of code change is required when using the APIs. This helps in making the test scripts more modular.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Avoid installing extra dependencies&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From Appium 1.15.0, Appium communicates with a real device via &lt;strong&gt;appium-ios-device&lt;/strong&gt;. You no longer have to install extra dependencies. The official documentation on &lt;strong&gt;appium-xcuitest-driver&lt;/strong&gt; is also helpful in resolving dependencies&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Support for major iOS versions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Appium supports major versions of iOS. iOS version 9.3 and above is supported by Apple &lt;a href="https://www.lambdatest.com/xcuitest?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;XCUITest&lt;/a&gt;, and the lower to 9.3 version is supported by Apple’s UI Automator. Learn more about XCUITest through this &lt;a href="https://www.lambdatest.com/xcuitest-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;XCUITest testing&lt;/a&gt; tutorial.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Avoid recompilation of app&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Appium does not require recompilation of App. It means we don’t need to implement a thing in the application code. While other frameworks need you to implement some change inside your code. It simply means there is no need to open the project in XCode. Just use the .app file to automate the application&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hassle-free execution&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Appium supports &lt;a href="https://www.lambdatest.com/blog/real-device-cloud/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;real devices cloud testing&lt;/a&gt; and testing on simulators and emulators. It gives the flexibility to execute the automation suite across the platforms.&lt;/p&gt;

&lt;p&gt;In case you are a beginner to Appium you can learn to perform mobile app testing easily through this tutorial.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/pI5zrUhydyo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;As stated on the official website of Appium, the Appium team does not test the XCUITest driver against jailbroken devices, so it cannot be guaranteed that it will work as seen on non-jailbroken devices.&lt;/p&gt;

&lt;p&gt;Automate your iOS apps on the Appium cloud of 3000+ real devices. &lt;a href="https://accounts.lambdatest.com/register?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=register" rel="noopener noreferrer"&gt;Try LambdaTest Now!&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites for how to automate iOS app using Appium
&lt;/h2&gt;

&lt;p&gt;Before starting the pre-setup, as per my past experiences, I must tell you that it is quite tedious to do the entire setup, so please stay with us and follow all the steps carefully. Remember that all the steps mentioned below are mainly specific to OS, so follow steps respective to your operating system (i.e., macOS, Windows).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First, you must have the Java setup done along with an IDE. We can use any IDE, but I recommend using Eclipse or IntelliJ IDE. I would recommend using Eclipse for the first try or practice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To set up JDK in the machine, please refer to the official Oracle website. If you already have JDK in your machine, skip this step. Never forget to check your java version in your machine post installation. You can also check the Java version as below once the installation is completed:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpd460gysvkwk70pvlfk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpd460gysvkwk70pvlfk8.png" width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3- Once your JDK installation along with environment setup is done, the next step is supposed to install Eclipse. For your help, please refer to these blogs on &lt;a href="https://www.lambdatest.com/blog/setup-junit-environment/#eclispeides?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;how to install Eclipse&lt;/a&gt; and &lt;a href="https://www.lambdatest.com/blog/setup-junit-environment/#intellij?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;how to install IntelliJ&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/QFHMzWqDPiA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can also subscribe to the &lt;a href="https://www.youtube.com/channel/UCCymWVaTozpEng_ep0mdUyw?sub_confirmation=1" rel="noopener noreferrer"&gt;LambdaTest YouTube Channel&lt;/a&gt; and stay updated with the latest tutorials around &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Selenium testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/cypress-e2e-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Cypress E2E testing&lt;/a&gt;, CI/CD, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install Homebrew&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is a package management software, and to install, follow the instructions on this page: &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;https://brew.sh/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To check the installed details along with the version, we can type “brew -v” as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f4fgixc8fh2h03auuli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f4fgixc8fh2h03auuli.png" width="800" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Install Carthage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The WebDriverAgent requires it. To install it, just type below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; brew install carthage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it is already installed in your machine, then you will get a message as below:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“carthage 0.38.0 is already installed and up-to-date.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Install Node &amp;amp; Npm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This step is required because Appium is a node application. To install it, run the below command on the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    brew install node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify the installed versions of npm and node, we can use npm -v &amp;amp; node -v as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczr9bemgr9q4wwyq6vq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczr9bemgr9q4wwyq6vq6.png" width="800" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Install authorize-ios&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;authorize-ios is a little utility that pre-authorizes Instruments to run UIAutomation scripts against iOS devices. It is required to run tests on real devices.&lt;/p&gt;

&lt;p&gt;In the terminal, enter the below command to install authorize-ios:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g authorize-ios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Install ios-deploy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install ios-deploy via Homebrew by running the below command on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   brew install ios-deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify the installation, we can use ios-deploy –version command in the terminal as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwy1zl63kpw3dbvq7yn43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwy1zl63kpw3dbvq7yn43.png" width="800" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Install ideviceinstaller&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the tool for managing apps on iOS device&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    brew install ideviceinstaller
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check the installation is completed or not, ideviceinstaller –version command can be used as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7slf7wfig9oxhlx3q9ql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7slf7wfig9oxhlx3q9ql.png" width="800" height="55"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-7: Install Xcode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Xcode is a complete developer toolset for creating apps for Mac, iPhone, iPad, Apple Watch, and Apple TV. Xcode brings user interface design, coding, testing, debugging, and submitting to the App Store into a unified workflow.&lt;/p&gt;

&lt;p&gt;For step-by-step guidance on using Xcode to build, test, and submit apps to the App Store, look at XCode documentation. To verify the Xcode installation, we can use the &lt;strong&gt;/usr/bin/xcodebuild&lt;/strong&gt; -version command as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81v0wnfbydf52s9gun3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81v0wnfbydf52s9gun3q.png" width="800" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 8: Install XCUITest driver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Appium XCUITest driver is a combined solution, which allows automated black-box testing of iOS and tvOS native applications and WebKit web views. The native testing is based on Apple’s XCTest framework and the fork of Facebook’s WebDriverAgent server.&lt;br&gt;
Web views communication is done via Webkit remote debugger protocol.&lt;/p&gt;

&lt;p&gt;The appium-ios-device library ensures real device communication. To install the XCUITest driver, please use the official website. It has the help doc, which can be referred to for common errors or issues faced during the installation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 9: Install Appium and Appium Doctor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To install Appium, please type the below command and use the version of Appium after @ in the below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  npm install -g appium@version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check the version of Appium installed by using the command &lt;strong&gt;appium –version&lt;/strong&gt; on the terminal, refer the below screenshot for reference:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F987ghyrqeo9fb2ubujs4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F987ghyrqeo9fb2ubujs4.png" width="800" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Appium doctor is a mini software that checks all (well, almost all) of the preconditions for appium to run successfully. In the terminal, enter the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   npm install -g appium-doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can use the command &lt;strong&gt;appium-doctor –version&lt;/strong&gt; to check the installed version:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpq51ls6arz4js9nwhbbt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpq51ls6arz4js9nwhbbt.png" width="800" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 10: Install Maven&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we all know, Maven is the dependency management tool, type below command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  brew install maven
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don’t forget the setup maven path before checking the version, you can do that by using below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   ​​export PATH=/opt/apache-maven-3.8.6/bin:$PATH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installation complete do cross-check by typing below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  mvn — version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output will look as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fno1ocjb5012hzj6t15l2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fno1ocjb5012hzj6t15l2.png" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 11: Install TestNG&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TestNG is a testing framework that we’ll be using to manage our automated test suite. Launch Eclipse, select “Help” &amp;gt; “Eclipse Marketplace”–&amp;gt;search for TestNG. Learn more about TestNG through this &lt;a href="https://www.lambdatest.com/learning-hub/testng?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Selenium TestNG tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We should be able to see the TestNG for Eclipse option with a button as “Install.” Click on the button and complete the installation. For more help, please go through this &lt;a href="https://www.lambdatest.com/blog/appium-with-testng-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Appium with TestNG&lt;/a&gt; tutorial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 12: Install Appium Desktop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need to install Appium Desktop so we can use the &lt;a href="https://www.lambdatest.com/blog/appium-inspector-for-apps/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Appium Inspector&lt;/a&gt; to identify the elements on the iOS app for designing test scripts. You can install the Appium Desktop from the official website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Capabilities setup for real iOS device
&lt;/h2&gt;

&lt;p&gt;This is the most vital step to perform. Below are the mentioned capabilities we require to run our tests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities.setCapability("useNewWDA", false);
        capabilities.setCapability("platformVersion", "12.0.1");
        capabilities.setCapability("deviceName", "iPhone 8");
        capabilities.setCapability("udid", "auto");
        capabilities.setCapability("bundleId", "&amp;lt;your bundle id&amp;gt;");
        capabilities.setCapability("xcodeOrgId", "&amp;lt;your org id&amp;gt;");
        capabilities.setCapability("xcodeSigningId", "iPhone Developer");
        capabilities.setCapability("updatedWDABundleId", "&amp;lt;bundle id in scope of provisioning profile&amp;gt;");
        capabilities.setCapability(MobileCapabilityType.APP, "[PATH_TO_YOUR_IPA_FILE]");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the question is how to get the details that have been mentioned in the above code. Let’s go through them one by one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;platformVersion&lt;/strong&gt;: is the version of iOS our app is running, 12.0.1 in my case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;deviceName&lt;/strong&gt;: is not required, as we have plugged in a real device and will select that device using the udid desired capability. Appium still requires us to supply a value for deviceName, so we use iPhone 8. To know the device name, in the iPhone, we can navigate to“Settings&amp;gt; General &amp;gt; About &amp;gt; Name.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;udid&lt;/strong&gt;: is the unique ID of the device we want to run our test on. Now connect your iPhone to your computer by USB and load up iTunes. We could find our device udid by running the command instruments -s devices in the terminal. Still, since we only have a single device plugged in, we can put in auto, and Appium will automatically find the udid of the device for us and use it. If ”auto” doesn’t work, then do provide your udid.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;xcodeOrgId &amp;amp; xcodeSigningId&lt;/strong&gt;: join the Apple Developer Program and locate your apple developer team id; xcodeorgid is the ID of the developer team that signed the certificate used to create the app. xcodeSigningId is the first part of the “Common Name” associated with the developer certificate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since XCode set this up for us, it is almost always iPhone Developer, but it could be something different for you if you are automating a different iOS device.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;bundleID&lt;/strong&gt;: it is the special iOS-internal name of our app. The easiest way to get the bundleID is by using iTunesConnect. The steps are as below:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Log into iTunes Connect.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click My Apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on an app to find the bundle ID.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The default app page will open, displaying the App ID and bundle ID.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;App&lt;/strong&gt;: many websites provide the sample apk, which can be used for testing. If you do not have any .apk or .ipa files, you can run your sample tests on LambdaTest using our sample 🔗 iOS app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;noReset&lt;/strong&gt;: do not forget to use this capability. This approximately saves 2.9 seconds per test by avoiding app installation before every test run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;updatedWDABundleId&lt;/strong&gt;: we need to create a provisioning profile for signing the WebDriverAgentRunner. Launch the Xcode and create a new project, select the team and enter the project name as follows:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyhccrioc5sk6sifq6ah9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyhccrioc5sk6sifq6ah9.png" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the “Project” tab of your project settings to confirm that “Automatically manage signing” is selected, and an Xcode Managed Profile is created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzxa6j4qtdeu61fr9zbb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzxa6j4qtdeu61fr9zbb.png" width="602" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Suppose you manually try to run the WebDriverAgentRunner app on the device. In that case, you will see a popup message:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq95abfk3q86zqi1imiaj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq95abfk3q86zqi1imiaj.png" width="216" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can go to Settings =&amp;gt; General =&amp;gt; Device Management on the device to trust the developer and allow the WebDriverAgentRunner app to be run.&lt;/p&gt;

&lt;p&gt;Copy your bundleId and add the following capability to your Appium Capabilities setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   capabilities.setCapability(“updatedWDABundleId”, “&amp;lt;bundle id in scope of provisioning profile&amp;gt;”);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are unable to do the above steps, then the manual configuration can also be done. To go through the steps, please refer to this document. It has all the steps along with the screenshots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/ui-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;UI Testing&lt;/a&gt; Tutorial: A Comprehensive Guide With Examples and Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Identifying the iOS elements
&lt;/h2&gt;

&lt;p&gt;In this section of this blog on how to automate iOS app using Appium, we will learn how to identify the iOS elements. To identify elements in iOS devices, we need to download and install the Appium Desktop application and use the Appium Desktop Inspector functionality.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you have installed Appium Desktop, then we can start by clicking on the &lt;strong&gt;Start Server&lt;/strong&gt; button inside of Appium Desktop as shown below.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furh38k29qi37bqb9qlmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furh38k29qi37bqb9qlmy.png" width="668" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2- Click the search icon from the right-up corner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy59uf33g40mbou47rxem.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy59uf33g40mbou47rxem.png" width="624" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add correct desired capabilities per your device/emulator and application. Then click on the &lt;strong&gt;Start Session&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1glgkrc4ftkvje9xlo0v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1glgkrc4ftkvje9xlo0v.png" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4- It will open the App screen, App Source (the hierarchy of elements), and Selected Element Pane (The attributes and associated values of the element). You can use this to create locators which will uniquely identify the element.&lt;/p&gt;

&lt;p&gt;5- You can provide a .ipa file in desired capabilities inside Appium Inspector, which will install and launch the app. Refer to the screenshots below, which we have used to test .ipa and passed in the value against “app.” Use all the fields of desired capabilities discussed in this blog on how to automate iOS app using Appium. The best thing about the Appium Inspector is that you can verify your written locator on screen. Check the below screenshots.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffmp5plvponka6fl0anmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffmp5plvponka6fl0anmf.png" width="769" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6- If your locator is correct, it will highlight the associated element, which is the same for Android and iOS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2o87yveu7v8ewrnwkyxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2o87yveu7v8ewrnwkyxw.png" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of the most used &lt;a href="https://www.lambdatest.com/learning-hub/selenium-locators?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;locator strategies&lt;/a&gt; are mentioned below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;STRATEGY&lt;/td&gt;
        &lt;td&gt;DESCRIPTION&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Accessibility ID&lt;/td&gt;
        &lt;td&gt;Reads a unique identifier for a UI element. For XCUITest, it is the element’s accessibility-id attribute. For Android, it is the element’s content-desc attribute. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Test that you can filter for an item on the filter box.&lt;/td&gt;
        &lt;td&gt;For iOS, it is the full name of the XCUI element and begins with XCUIElementType. For Android, it is the full name of the UIAutomator2 class (e.g., android.widget.TextView) &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;ID&lt;/td&gt;
        &lt;td&gt;Native element identifier. resource-id for Android; name for iOS.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Name&lt;/td&gt;
        &lt;td&gt;    Name of element.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;XPath&lt;/td&gt;
        &lt;td&gt;    Searches the app XML source using xpath (not recommended, has performance issues).&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Image&lt;/td&gt;
        &lt;td&gt;    Locates an element by matching it with a base 64 encoded image file.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;iOS UIAutomation&lt;/td&gt;
        &lt;td&gt;When automating an iOS application, Apple’s Instruments framework can be used to find elements.&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In most real time projects, one public webelement is created, and element identification for Android and iOS is mentioned, as shown below. The nameOfMobileElement mentioned below is just an example. You can replace the same with the name of the locator used to identify the webelement of the targeted mobile app. We have identified the iOS element using iOSNsPredicate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        @iOSXCUITFindBy(iOSNsPredicate = "name=='&amp;lt;nameOfMobileElement&amp;gt;'")
        @AndroidFindBy(uiAutomator = "text(\"&amp;lt;textOf TheMobileElement&amp;gt;\")")
        public MobileElement elementName;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also use XPath as mentioned below for identification in iOS, in-fact all type of axes methods in XPath can be used to identify the element uniquely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            @iOSXCUITFindBy(xpath = "//*[@name='&amp;lt;nameOfMobileElement&amp;gt;']/following-sibling::XCUIElementTypeStaticText")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Though in my past experiences the most used identification I have used is accessibility as below, “GO TO APP” is just an example, it should be replaced with the accessibility for the app used for testing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   @iOSXCUITFindBy(accessibility = “GO TO APP”)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While identifying iOS elements, we need to remember that the element should always be unique and try the locators first and give XPath identification the least priority. I would suggest not using XPath locators unless there is no other alternative.&lt;/p&gt;

&lt;p&gt;In general, XPath locators might be much slower than other locators like accessibility id, class name, and predicate (up to 100 times slower in some special cases). They are so slow because Apple’s XCTest framework does not natively support the XPath location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: &lt;a href="https://www.lambdatest.com/learning-hub/agile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Agile Testing&lt;/a&gt; Tutorial: A Comprehensive Guide With Examples and Best Practices&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo Code for automating iOS app using Appium
&lt;/h2&gt;

&lt;p&gt;Before running the tests, we need to perform below two steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Make sure the device which will be used for testing is unlocked, and if it asks you to “Trust the Computer”, tap the button to trust our Mac. You’ll need to do this the first time, and it won’t ask for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Start the Appium server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  import io.appium.java_client.MobileBy;
    import io.appium.java_client.MobileElement;
    import io.appium.java_client.ios.IOSDriver;
    import java.net.MalformedURLException;
    import java.net.URL;

    import io.appium.java_client.remote.MobileCapabilityType;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;

    public class iOS_Test {
        private IOSDriver driver;

        @Before
        public void setUp() throws MalformedURLException {
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("platformName", "iOS");
            capabilities.setCapability("platformVersion", "15.5");
            capabilities.setCapability("deviceName", "Sidiphone");
            capabilities.setCapability("udid", "auto");
            capabilities.setCapability("bundleId", "&amp;lt;your bundle id&amp;gt;");
            capabilities.setCapability("xcodeOrgId", "&amp;lt;your org id&amp;gt;");
            capabilities.setCapability("xcodeSigningId", "iPhone Developer");
            capabilities.setCapability("updatedWDABundleId", "&amp;lt;bundle id in scope of provisioning profile&amp;gt;");
            capabilities.setCapability(MobileCapabilityType.APP, "[PATH_TO_YOUR_.IPA_FILE_COMPILED]");
            driver = new IOSDriver&amp;lt;&amp;gt;(new URL("http://localhost:4723/wd/hub"), capabilities);
        }

        @Test
        public void testClickAnElement() throws InterruptedException {
            //Opens the browser
            MobileElement browser = (MobileElement) driver.findElementByAccessibilityId("Browser");
            browser.click();
            Thread.sleep(3000);

            WebDriverWait el7 =  new WebDriverWait(driver, 30);
            el7.until(ExpectedConditions.elementToBeClickable(MobileBy.id("url")));
            driver.findElementById("url").sendKeys("https://www.lambdatest.com/");

            //Clicks on the text box
            WebDriverWait el = new WebDriverWait(driver,90);
            MobileElement el4 = (MobileElement) driver.findElementByAccessibilityId("find");
            el.until(ExpectedConditions.elementToBeClickable(el4));
            el4.click();
            el4.sendKeys("LambdaTest");

            //((JavascriptExecutor) driver).executeScript("lambda-status=passed");
            driver.quit();

        }
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, the Test method we have used is testClickAnElement(), and the element we are trying to click is from the iOS app shared in this post on how to automate iOS app using Appium.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rh4osvoqsvkv2z356u8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rh4osvoqsvkv2z356u8.png" width="156" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting Tips
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Make sure UDID is correct by checking it in XCode Organizer or iTunes. It is a long string (approx 20+ chars).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure the following settings are &lt;strong&gt;enabled&lt;/strong&gt; on your device:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;A.&lt;/strong&gt; Settings -&amp;gt; Developer -&amp;gt; &lt;strong&gt;Enable UI Automation&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;B.&lt;/strong&gt; Settings -&amp;gt; Safari -&amp;gt; Advanced -&amp;gt; &lt;strong&gt;Web Inspector&lt;/strong&gt; and &lt;strong&gt;Remote&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;3- Consider generating a provisioning profile with a .xctrunner identifier if you do not want to generate a wildcard one for manual configuration. The .xctrunner config support has been added since XCode 11.&lt;/p&gt;

&lt;p&gt;4- Make sure the provisioning profile has an iOS Distribution certificate. An active XCode/xcodebuild connection/session is necessary to interact with WebDriverAgentRunner because of Apple’s security design. The certificate affects the limitation.&lt;/p&gt;

&lt;p&gt;5- The keyboard preference in the device under test is Apple’s official one, and the input language is set to English to send texts to XCUIElementTypeSecureTextField, as Non-official or non-English keyboards may not be able to send keys to XCUIElementTypeSecureTextField.&lt;/p&gt;
&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;p&gt;Given that Appium uses instruments underneath, we have all of the limitations of using Apple’s automation framework. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A slower response time between actions, automation that can only run over a USB tether, and only one device can execute automation simultaneously per host.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each physical device or simulator requires a separate host running on a Mac to communicate with each device. This is due to the hosts being the one who determines where the commands are communicated, regardless of what parameters are passed into the automation. This may be a bug in the Appium infrastructure or requires a special command to determine the device to execute from the automation code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Instruments log files are not returned as part of the test, and the data given back to the running test is much less than what is seen in a typical Instruments test case.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  How to automate iOS app using Appium on a real device cloud?
&lt;/h2&gt;

&lt;p&gt;In this blog on how to automate iOS app using Appium, you must have realized that testing on real devices is not a cakewalk, especially iOS real device testing is tedious. The important thing is that real iOS device testing can only take place on a Mac, so we can’t even perform real iOS device testing without a Mac.&lt;/p&gt;

&lt;p&gt;As a result, most organizations prefer to use &lt;a href="https://www.lambdatest.com/blog/real-device-cloud-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;real cloud devices for testing&lt;/a&gt;. You can try LambdaTest cloud devices, which are quite easy to use, and we can avoid setting up all the prerequisites on local machines.&lt;/p&gt;

&lt;p&gt;LambdaTest provides a cloud-based solution for &lt;a href="https://www.lambdatest.com/mobile-automation-test?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;mobile automation testing&lt;/a&gt;. It lets you automate native and hybrid mobile apps on an &lt;a href="https://www.lambdatest.com/online-device-farm?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;online device farm&lt;/a&gt; of 3000+ real iOS. It is a scalable, secure, and high-performing Appium testing platform that empowers development and testing teams to accelerate their release cycles.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/vDHFbEjXxdc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Below we have executed the test suite using LambdaTest real cloud devices. Just use the below code along with your username and password. We used the iPhone 12 for our test run. You can use the model as per the requirement.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    import io.appium.java_client.AppiumDriver;
    import io.appium.java_client.MobileBy;
    import io.appium.java_client.MobileElement;
    import io.appium.java_client.ios.IOSDriver;

    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;

    import java.net.URL;

    public class vanilla_ios {

        public static String userName = System.getenv("LT_USERNAME") == null ? "sidharth****"  //Add username here
                : System.getenv("LT_USERNAME");
        public static String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "********" //Add accessKey here
                : System.getenv("LT_ACCESS_KEY");

        public static final String URL = "https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub";
        public static IOSDriver driver = null;

        public static void main(String[] args) throws Exception {

           try {
                DesiredCapabilities caps = new DesiredCapabilities();
                caps.setCapability("platformVersion", "15");
                caps.setCapability("deviceName", "iPhone 12");
                caps.setCapability("isRealMobile", true);
                caps.setCapability("app", "******"); //Enter your app url
                caps.setCapability("platformName", "iOS");
                caps.setCapability("build", "Java Vanilla - iOS");
                caps.setCapability("name", "Sample Test Java");
                caps.setCapability("devicelog", true);
                caps.setCapability("network", true);


            driver = new IOSDriver(new URL("https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"), caps);


                Thread.sleep(2000);

                //Opens the browser
                MobileElement browser = (MobileElement) driver.findElementByAccessibilityId("Browser");
                browser.click();
                Thread.sleep(3000);

               WebDriverWait el7 =  new WebDriverWait(driver, 30);
               el7.until(ExpectedConditions.elementToBeClickable(MobileBy.id("url")));
               driver.findElementById("url").sendKeys("https://www.lambdatest.com/");

                //Clicks on the text box
                WebDriverWait el = new WebDriverWait(driver,90);
                MobileElement el4 = (MobileElement) driver.findElementByAccessibilityId("find");
                el.until(ExpectedConditions.elementToBeClickable(el4));
                el4.click();
                el4.sendKeys("Lambdatest");

                //((JavascriptExecutor) driver).executeScript("lambda-status=passed");
                driver.quit();

            } catch (Exception t) {
               System.out.println(t);
               driver.quit();

           }
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above script, we have first done the capabilities setup and then automated the iOS app with two steps:&lt;/p&gt;

&lt;p&gt;The first one is to open the browser and the second one is to click on the text box and then enter text “LambdaTest” on the text box. For ease of execution, we have used thread.sleep in this blog on how to automate iOS app using Appium. You can ignore the same while executing in your setup.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To execute the same, you need to use the below two commands on your terminal:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; mvn clean install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2- Once you execute the command, you should get the Build Success message as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vp984trguhzx7ootpp3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vp984trguhzx7ootpp3.png" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, we need to execute the test cases using the below command on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    mvn test -P ios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3- Once the above command executes successfully, we must go to the LambdaTest website and validate the runs. Navigate to the Real Device ⇒ App Automation Section. You should be able to see “Java Vanilla — iOS” as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxfquh3396cvcshurw0v6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxfquh3396cvcshurw0v6.png" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4- Now click on the recent execution. You will be redirected to the build view page, where all the details about the execution will be displayed along with the video:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x4q6g19rea50ljrdey2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x4q6g19rea50ljrdey2.png" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5- In the above, we can check the Test Logs and Network details. Isn’t it relatively easy to run the automation suite on real cloud devices compared to doing the entire setup on a local machine? The best part is selecting any iPhone model required for your testing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpg96y853i4390lkjxc6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpg96y853i4390lkjxc6.jpg" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check this out: Jest Tutorial: Complete Guide to &lt;a href="https://www.lambdatest.com/jest?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jan02_sd&amp;amp;utm_term=sd&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Jest Testing&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With this, we have concluded this tutorial on how to automate iOS app using Appium. As per my suggestion, we should only consider real iOS devices for Sanity or Smoke suite execution. For regression, it is always advised to use either simulators or cloud devices.&lt;/p&gt;

&lt;p&gt;Though we have simulators, we should never release a product without being tested on real devices, so better to prepare an automation suite and run the real devices on the cloud, saving time and ensuring quality.&lt;/p&gt;

&lt;p&gt;We can address most app-related issues by ensuring that the app works on a real device. iOS testing with Appium will help provide that confidence in the product and confirm the app’s success when it is released to users.&lt;/p&gt;

&lt;p&gt;Happy testing, and do share what should be the next topic you want to learn.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tsgef4349f2tmgu9qm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tsgef4349f2tmgu9qm7.png" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>design</category>
      <category>watercooler</category>
    </item>
  </channel>
</rss>
