Automating tests using the new ios-driver

Ilyas Patel picture Ilyas Patel · May 1, 2013 · Viewed 8.1k times · Source

I’m trying to automate tests on an iphone simulator or device for a web application running in Safari. The documentation for IPhoneDriver says it is now deprecated and to use ios-driver or appium. The documentation for both these tools is lacking so has anyone else had experience using ios-driver to test a site running in Safari. What I have tried so far is updating the MobileSafari Info.plist to allow ios-driver to edit it:

sudo chmod 666 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk/Applications/MobileSafari.app/Info.plist

I then start up selenium-standalone 2.32 on port 3001 on the Mac. I then run the sample code provided on the ios-driver site:

public static void main(String[] args) throws Exception {
    DesiredCapabilities safari = IOSCapabilities.iphone("Safari");
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:3001/wd/hub"), safari);

    driver.get("http://www.ebay.co.uk/");

    System.out.println(driver.getTitle());
    driver.quit();
}

I get unable to connect error. Am I supposed to install webdriver on the simulator/device as well which I think is how the IPhoneDriver works?

I am using OSX Mountain Lion with all up-to-date software.

Thanks

Answer

Oscar Rieken picture Oscar Rieken · May 28, 2013

You need to start up ios-driver, Launching ios-driver section here http://ios-driver.github.io/ios-driver/?page=setup

If you want to connect to the grid you need to start up ios-driver and point it to your grid http://ios-driver.github.io/ios-driver/?page=scaling