0

When I run the Appium test for the below code

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Interfaces;
using OpenQA.Selenium.Appium.MultiTouch;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.iOS;
using NUnit.Framework;

namespace Hof.Mobile.Tests.UIAutomation
{

    [TestFixture()]
    public class TestAppium
    {
        public static IWebDriver driver = null;

        [TestFixtureSetUp]
        public void SetUp()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability("browserName", "Safari");
            capabilities.SetCapability("deviceName", "iOS");
            capabilities.SetCapability("platformName", "ios");
            capabilities.SetCapability("udid", "<<my udid >>");

             driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
        }  

        public void OpenHomePage()
        {
            driver.Navigate().GoToUrl("http://url");
            Console.WriteLine("Page title is : " +driver.Title);
            //Assert.IsTrue(driver.Title.Equals("test")," Sorry , the website didnt open!!");
        }

        public void AssertTitle(string title)
        {

            Assert.IsTrue(driver.Title.Equals(title),"Title doesn't match!!");
        }



        [TearDown]
        public void End()
        {
            driver.Dispose();
        }
    }
}

On connecting my iPad device with Windows, I get this error:

System.InvalidOperationException : A new session could not be created. (Original error: Command failed: 'xargs' is not recognized as an internal or external command, operable program or batch file.) (33)

The same code is running perfectly for Android phones when I change the respective parameters, but it is not working for iOS.

Andry
  • 16,172
  • 27
  • 138
  • 246
Arpan Buch
  • 1,380
  • 5
  • 19
  • 41

1 Answers1

2

You cannot automate iOS devices using Appium on Windows because you need XCode and XCode does not come for Windows but only for MAC.

So basically, you need to run Appium on Mac if you want to automate iPad or iPhone.

Limitations of Appium

Appium is great tool but it has some limitations and it depends on automation engines. So here:

  • If you run Appium on Windows, you can automate only Android apps.

  • If you run Appium on Mac, you can automate both Android and iOS apps.

A more detailed explanation can be found in this article of mine. There is a table which describes what I just told you in the central part of the article's body.

Community
  • 1
  • 1
Andry
  • 16,172
  • 27
  • 138
  • 246
  • Thanks Andry. I think that was the quickest ans. – Arpan Buch Feb 24 '15 at 13:21
  • Glad I could help. Appium has this limitation which is not really its fault... The iOS SDK is available only for Apple operating systems thus not much to do about it. On the other hand the Android SDK is available on Windows, Mac and Unix. Appium needs SDKs to communicates with devices. – Andry Feb 24 '15 at 14:27
  • Thanks Andry. Please look at my question and please give me ur valuable inputs. http://stackoverflow.com/questions/28768576/appium-unable-to-run-script-in-multiple-android-device-connected – Arpan Buch Mar 01 '15 at 12:58