Hi all,
I’m trying to open the XCode default app in the emulator using Java on Eclpise, this is the code:
public static void main(String[] args) throws MalformedURLException { DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(MobileCapabilityType.DEVICE_NAME, "IPhone 7"); caps.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS); caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST); caps.setCapability(MobileCapabilityType.APP, "/PATH/UICatalog.app"); IOSDriver<IOSElement> driver = new IOSDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), caps); }
And after trying different combinations of devices names and other possible capabilities online, I keep on getting this error:
Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=/PATH/UICatalog.app, automationName=XCuiTest, platformName=iOS, deviceName=IPhone 7}], required capabilities = Capabilities [{}]
Build info: version: ‘unknown’, revision: ‘unknown’, time: ‘unknown’
System info: host: ‘HOST’, ip: ‘IP’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.12.6’, java.version: ‘1.8.0_121’
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumProtocolHandShake.lambda$1(AppiumProtocolHandShake.java:96)
at java.util.Optional.orElseThrow(Optional.java:290)
at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:96)
at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:111)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112)
at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:78)
at iosapps.BaseTest.main(BaseTest.java:23)
I was wondering if anyone else faced the same issue and came with a solution or there’s anything wrong with my code. Just confirm that I’m using the latest version of Appium, Selenium, Java and OSX.
Thank you all in advance.