Friday, 6 December 2013

Appium Native iOS App Testing | WebDriver

Appium is an open source, cross-platform test automation tool for native, hybrid and mobile web apps. Appium tests can be written in your favorite Webdriver-compatible language.


Requirements & installation

1| MAC OS X 10.7 (minimum version required)
2| Xcode updated version (prefer)
3| Node.js
4| Appium.app
5| Eclipse Kepler (prefer)
6| TestNG framework


Pre-Appium setup

iOS .app file is enough to inspect elements. In this example, I have used the project, 'InternationalMountains' from Apple DEV site.

1| Download the project, 'InternationalMountains'
2| Double click and extract it
3| Import it into Xcode by opening the Xcode file
4| Run the project
5| Make sure that the simulator is opened with the application
6| Open Terminal and move to the project folder
7| Run the following command to build the .app file

xcodebuild -sdk iphonesimulator6.1

8| It will build the app and generate the file, 'InternationalMountains.app' under
/InternationalMountains/Build/Products/Release-iphonesimulator/


Appium iOS setup

1| Download & Install Node.js
// npm represents that Node.js Package Manager
$ sudo npm install wd


2| Run the Appium server using node.js;  There are couple of ways to do so..

#1 Using Node.js
//install Appium
$ npm install -g appium (or) $ sudo npm install appium -g
//start Appium server
$ appium & 


#2 Using the App
Download Appium, install and Run it

3| Now, the Appium server gets started in the default port 4723 and IP Address 0.0.0.0
i.e., [http://0.0.0.0:4723]


Appium inspector

Appium inspector is a record and playback tool just like Selenium IDE for web.

1| Open Appium
2| Change the default IP address to 127.0.0.1 and port 4725




3| Now, enable the check box, 'App path'
4| Click on the 'Choose' button and locate the .app local directory. i.e., InternationalMountains.app



5| Click on the 'Launch' button [Appium server launches now]
6| Now, a blue-colored icon found beside the 'Launch' button is enabled
7| Clicking blue-colored icon open up the Appium inspector with Simulator
8| Now, click the 'Record' button in Appium inspector
9| Every action will be generating a script at bottom of the Appium inspector




Run the script in Eclipse IDE

package packagename;

import java.io.File;
import java.net.URL;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class AppiumTest {
public WebDriver driver = null;

@BeforeMethod
public void setUp() throws Exception {
// set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(CapabilityType.VERSION, "6.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("app","/Users/username/Downloads/InternationalMountains/build/Release-iphonesimulator/InternationalMountains.app");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
}

@AfterMethod
public void tearDown() throws Exception {
driver.quit();
}

@Test
public void test01() throws InterruptedException {
driver.findElement(By.xpath("//window[1]/tableview[1]/cell[2]")).click();
driver.findElement(By.xpath("//window[1]/navigationBar[1]/button[1]")).click();
driver.findElement(By.xpath("//window[1]/tableview[1]/cell[7]/text[1]")).click();
}
}
  

Note: 
1| Currently, there is no Appium inspector support for Windows

69 comments:

  1. Hi Your article is very usefull...I am also apply in demo application... can we use this software in Android Application.

    ReplyDelete
    Replies
    1. Yes Tehsil , we can use for Android; but there is no Appium inspector for Android currently [work is in progress]

      Delete
    2. Thanks for sharing this Information, Got to learn new things from your Blog on APPIUM.
      Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

      Delete
    3. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about APPIUM.
      http://thecreatingexperts.com/appium-training-in-chennai/

      Delete
  2. I executed the steps exactly and the simulator crashes after enabling recording and interacting with the application.

    ReplyDelete
  3. After generating the scripts through Appium inspector, I am unable to run the same script through eclipse. Is there any other process to be followed before running in eclipse?

    ReplyDelete
  4. Hi Prasanth,

    I am new to mobile testing.

    Can we execute the scripts in windows machine or only on Mac?

    ReplyDelete
    Replies
    1. Thanks for sharing this Information, Got to learn new things from your Blog on Appium
      Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

      Delete
  5. Awesome work Buddy ....very cool i really loved your work

    ReplyDelete
  6. Hi Prasant,

    My application is a video player. I want to test the progress that is displayed while playing a video. Can you please tell how to get the current position of the progress bar and how to handle it using web driver.

    ReplyDelete
  7. Hi I can't see the blue button next to launch button, please hlep me?

    ReplyDelete
    Replies
    1. If you don't see Blue button, just click on magnifying glass icon (inspector icon). That should launch

      Delete
  8. hi i am working on sauce ios app sing node js , so can anyone provide node js script how to upload app and test on sauce.

    ReplyDelete
  9. Does appium inspector work on windows 7??

    ReplyDelete
    Replies
    1. Thanks for sharing this Information, Got to learn new things from your Blog on APPIUM.
      Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

      Delete
  10. Could you please publish configuration steps for Appium + Android apps automation.

    ReplyDelete
  11. Hello, I implemented the above code and everything in Eclipse IDE, but at run i have 'run configurations'. Can you please help me on how to start the tests?

    ReplyDelete
  12. Hi,
    I am using circleci for ios app build, I want to do BDD test with headless Appium, I have written it in python, Can i run this using headless driver

    ReplyDelete

  13. nice blogs.
    videocon Data plan Post announcement of much awaited spectrum-sharing policy, Videocon Telecom plans to pool spectrum with other operators to provide 4G LTE services

    ReplyDelete
  14. am unable to launch appium inspector and the error was

    Could Not start a new session Be sure the Appium server is running with an application opened by using the "App Path" parameter in Appium.app (along with package and activity for Android) or by connecting with selenium client and supplying this in the desired capabilities object.

    ReplyDelete
  15. APPIUM Training in Chennai
    We provide best APPIUM training in Chennai with real time Scenarios .Our training institute has the best trainer who has around 5+ years in core automation. Here the training is practical and real time based.If you want to learn the APPIUM you should have the basic knowledge in Coding.So don’t worry if you don’t have we will teach you from the basics.
    Contact us: 9677211551 , 9003085882
    Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  16. APPIUM Training in Chennai
    We provide best APPIUM Training in Chennai with real time Scenarios .Our training institute has the best trainer who has around 5+ years in core automation. Here the training is practical and real time based.If you want to learn the APPIUM you should have the basic knowledge in Coding.So don’t worry if you don’t have we will teach you from the basics.
    Contact us: 9677211551 , 9003085882
    Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  17. Thanks for sharing this Information, Got to learn new things from your Blog on ANDROID .
    Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  18. Thanks for sharing this Information, Got to learn new things from your Blog on APPIUM.
    Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  19. Thanks for sharing this Information, Got to learn new things from your Blog on APPIUM.
    Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  20. Thanks for sharing this Information, Got to learn new things from your Blog on APPIUM.
    Ref link : http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  21. Thanks for sharing information.
    recharge offers
    videocontelecom offers new Customers the proposition will be available on Plan voucher (PV) priced at Rs 76, offering All Local Calls at 25P/min only for 6 months including Rs 63 Talk time; 1050 MB data for 3 month and 100 SMS free/day, with first 2 SMS of the day chargeable at rack rate only in Haryana.

    ReplyDelete
  22. Thanks for sharing this information.It was very nice blog to learn about Appium.
    http://thecreatingexperts.com/appium-training-in-chennai/

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. Hay hi its good article, actually i am working on react-native ios app and could not locate the child elements by appium, this was the primary issue, now simple i am not able to use xpath and in details tab name field is empty so what to use and how

    ReplyDelete
  25. Thanks for the great information in your blog Selenium Training in Chennai

    ReplyDelete
  26. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about SAP BASIS.SAP basis

    ReplyDelete
  27. The Appium Native iOS App Testing information was very amazing, it's very useful at a my studies time. I do trust all of the concepts you’ve presented on your post. They’re really convincing and will definitely work.

    IOS Training in Chennai

    ReplyDelete
  28. It was very nice blog to learn about SAP BASIS. Thanks for sharing.SAP basis

    ReplyDelete
  29. hi, where can i find latest appium 1.6+ version for mac os ? i could not find in appium downloads site.

    ReplyDelete
  30. Best place to learn Appium Android IOS Automation Testing Training in Chennai

    Go for Appium training in chennai for real time mobile automation testing training with real time project support.
    UI Automation Tools with real time scenarios You can contact 8122241286 for Best APPIUM and selenium Training in Chennai

    ReplyDelete
  31. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    Mobile App Development Company in Chennai
    Android app Development Company in Chennai
    ios app development Company in Chennai

    ReplyDelete
  32. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  33. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving.. very specific nice content. And tell people specific ways to live their lives.Sometimes you just have to yell at people and give them a good shake to get your point across.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete

  34. Nice it seems to be good post... It will get readers engagement on the article since readres engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

    ReplyDelete
  35. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  36. This article is so informatic and it really helped me to know more about the Selenium Testing. This selenium article helps the beginners to learn the best training course. So keep updating the content regularly.
    Selenium Training in Chennai | Best Selenium Training institute in Chennai | Selenium Course in Chennai

    ReplyDelete
  37. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    Mobile App Development Company
    Mobile App Development Companies

    ReplyDelete
  38. You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
    Mobile App Development Company
    Mobile App Development Companies

    ReplyDelete
  39. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai

    ReplyDelete
  40. thanks for providing the valuable information ..keep update with your blogs..i found this article similar to your blog once check it out
    ios online training Hyderabad

    ReplyDelete
  41. This article is so informatic and it really helped me to know more about the Selenium Testing. This selenium article helps the beginners to learn the best training course. So keep updating the content regularly.
    Selenium Training in Chennai | Best Selenium Training institute in Chennai | Selenium Course in Chennai

    ReplyDelete
  42. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...

    Android App Development Company

    ReplyDelete
  43. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    PHP training in chennai

    ReplyDelete
  44. http://letusnotifyyou.com/appium-selenium-configuration-latest-ios-version-10-3-2/

    ReplyDelete
  45. I just want to say that all the information you have given here is awesome...great and nice blog thanks sharing..Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
    Web Design Development Company
    Web design Company in Chennai
    Web development Company in Chennai

    ReplyDelete
  46. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
    ios app training

    ReplyDelete
  47. it is really amazing...thanks for sharing....provide more useful information...
    Mobile app development company

    ReplyDelete
  48. Awesome,
    Thank you so much for sharing such an awesome blog...
    mobile app training institutes

    ReplyDelete
  49. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    iOS App Development Company

    ReplyDelete
  50. Informative article, just what I was looking for.seo services chennai

    ReplyDelete
  51. Nice blog..! I really loved reading through this article... Thanks for sharing such an amazing post with us and keep blogging...
    iphone app training course

    ReplyDelete
  52. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
    Fitness SMS
    Fitness Text
    Salon SMS
    Salon Text
    Investor Relation SMS
    Investor Relation Text

    ReplyDelete
  53. Thanks for sharing such an interesting post with us. You have made some valuable points which are very useful for all readers
    Iphone Course in chnadigarh

    ReplyDelete
  54. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    ios App Development Company
    Mobile App Development Company
    Best Mobile App Development Company

    ReplyDelete
  55. DIAC provides Classroom training on PLC, SCADA, HMI, DCS, AC Drives- Motors, Panel Designing, Instrumentation. Get 100% life time job assistance.Call @91-9310096831

    ReplyDelete
  56. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India

    ReplyDelete