mercredi 27 mai 2015

Appium - setting Desired Capabilities in both terminal and test code

I am trying to set some appium desired capabilities in the terminal window so that I can, for example, run my tests against different simulator devices:

Terminal: $ appium --device-name 'iPhone 6'

However, I am have to setup desired capabilities in my actual code, so I have a valid instance of IOSDriver. I use this code:

    capabilities.setCapability("platformName", "iOS");
    capabilities.setCapability("platformVersion", "8.3");
    capabilities.setCapability("app","../Build/Products/Debug-iphonesimulator/LightAlarm.app");      
        driver = new IOSDriver(new URL("http://ift.tt/1sv2im4"),capabilities);

When I run my tests I get an error that deviceName is not being set:

The following desired capabilities are required, but were not provided: deviceName

However, my terminal appium server is all setup correctly:

info: Welcome to Appium v1.4.0 (REV dc30dae9e8fe8c85eeea707dbdbd60350fdff55b)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: [debug] Non-default server args: {"deviceName":"iPhone 6"}
info: Console LogLevel: debug

Any ideas what might be going wrong?

Thanks, Charlie

Aucun commentaire:

Enregistrer un commentaire