Running appium for ios from windows

137 views
Skip to first unread message

Abhijit Shelar

unread,
May 12, 2014, 2:46:02 AM5/12/14
to appium-...@googlegroups.com
Hi,

I need to run .app file on simulator on mac machine and I need to send commands from windows 7.

How it is possible using windows platform?

I have install appium on mac and start

java -jar ios-server-standalone-0.6.6-SNAPSHOT.jar -aut InternationalMountains.app on mac

Now I need to connect it from windows and run test in simulator
How I can achieve it?

using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AppiumDriverDemo
{
    class TestiOS
    {
        private AppiumDriver driver;

        public void beforeAll()
        {
            // find the test application
            Console.WriteLine("Finding Test App");
            string appPath = _GetTestAppPath();
            Console.WriteLine("Using Test App @ \"" + appPath + "\"");

            // set up the remote web driver
            Console.WriteLine("Connecting to Appium server");
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability("appium-version", "1.0");
            capabilities.SetCapability("platformName", "iOS");
            capabilities.SetCapability("platformVersion", "6.1");
            capabilities.SetCapability("deviceName", "iPhone Simulator");
            capabilities.SetCapability("app", appPath);
            driver = new AppiumDriver(new Uri("http://192.168.1.28:5555/wd/hub"), capabilities);
        }
       
        public void afterAll()
        {
            // shutdown
            driver.Quit();
        }

        public void RegularWebdriverMethodsTestCase()
        {
            // enter random numbers in all text fields
            Console.WriteLine("Entering addends");
            List<int> addends = new List<int>();
            Random randomNumberGenerator = new Random();

            var element = driver.FindElementByIosUIAutomation(".textFields()[\"TextField1\"];");
            int randomNumber = randomNumberGenerator.Next(0, 10);
            element.SendKeys(randomNumber.ToString());
            addends.Add(randomNumber);

            element = driver.FindElementByIosUIAutomation(".textFields()[\"TextField2\"];");
            randomNumber = randomNumberGenerator.Next(0, 10);
            element.SendKeys(randomNumber.ToString());
            addends.Add(randomNumber);

            // calculate the expected result
            int expectedResult = 0;
            foreach (int i in addends)
                expectedResult += i;

            Console.WriteLine("Submitting the form");
            // submit for computation
            var button = driver.FindElementByIosUIAutomation(".buttons()[\"ComputeSumButton\"]");
            button.Click();

            // TODO check the result
        }

        /// <summary>retrieves the path of the locally installed app</summary>
        /// <returns>the path to the Test App</returns>
        private static string _GetTestAppPath()
        {
            string appiumDir = Regex.Replace(System.Reflection.Assembly.GetExecutingAssembly().Location, "/appium/.*$", "/appium");
            return appiumDir = "/Users/mac/Projects/InternationalMountains.app";
        }
    }
}

Isaac Murchie

unread,
May 12, 2014, 11:56:17 AM5/12/14
to Abhijit Shelar, appium-...@googlegroups.com
Yes, just point the AppiumDriver to the Mac computer on which Appium is running.

driver = new AppiumDriver(new Uri("http://192.168.1.28:5555/wd/hub"), capabilities);

Make sure the Uri (192.168.1.28) is the address of the Mac, and that Appium is running on the port listed (5555 here, though by default it is 4723.


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.

Abhijit Shelar

unread,
May 12, 2014, 12:48:20 PM5/12/14
to Isaac Murchie, appium-...@googlegroups.com
It gives error to appiumDir = "/Users/mac/Projects/InternationalMountains.app";
--
Thanks & Regards,
*Abhijit Shelar*
(8983729507)
(Skype: abhijit.shelar1)

*Internet Communications cannot be guaranteed to be secure or error-free as information could be delayed, intercepted, corrupted, lost, or contain viruses. I am not accept any liability for any errors, omissions, viruses or computer problems experienced by any recipient as a result of this e-mail.*



Isaac Murchie

unread,
May 12, 2014, 12:53:30 PM5/12/14
to Abhijit Shelar, appium-...@googlegroups.com
You will need to specify the file as a uri (e.g., "file://...").

If you are still getting an error, can you give the whole error log?

Abhijit Shelar

unread,
May 12, 2014, 1:01:50 PM5/12/14
to Isaac Murchie, appium-...@googlegroups.com
Hi,

My c# code is on windows? It it problem as .app file is not for windows?

Isaac Murchie

unread,
May 12, 2014, 1:04:28 PM5/12/14
to Abhijit Shelar, appium-...@googlegroups.com
The .app code is not going to run on Windows, so it is not a problem. The file is remote, existing on the Mac running Appium, and needs to be specified as so.

Abhijit Shelar

unread,
May 12, 2014, 1:06:59 PM5/12/14
to Isaac Murchie, appium-...@googlegroups.com
Hi,

Ok i will post whole error log tomorrow Many Thanks
Reply all
Reply to author
Forward
0 new messages