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";
}
}
}