SessionNotCreatedException

When I try to create a new driver
driver = new AppiumDriver(new URL(“http://127.0.0.1:4723”), capabilities);
or
driver = new IOSDriver(new URL(“http://127.0.0.1:4723”), capabilities);

I have this bug.

How can I debug? Or to find a solution?

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: EISDIR: illegal operation on a directory, read
Host info: host: ‘MAC…’, ip: ‘…’
Build info: version: ‘4.5.3’, revision: ‘4b786a1e430’
System info: os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘12.6’, java.version: ‘11.0.17’
Driver info: io.appium.java_client.ios.IOSDriver
Command: [null, newSession {capabilities=[{appium:app=/Users/xxx/Projects/mobile-tests/src/app/IpaApk1/ipa/Example.app, appium:automationName=XCUITest, appium:deviceName=iPhone 12 Pro Max, platformName=IOS, appium:platformVersion=15.5}], desiredCapabilities=Capabilities {app: /Users/xxx/Projects/mobi…, automationName: XCUITest, deviceName: iPhone 12 Pro Max, platformName: IOS, platformVersion: 15.5}}]
Capabilities {}

@BeforeClass
void beforeClass(@Optional(“platform”) String platform) throws MalformedURLException {
platform = “ios”;
setIosCaps();
startServer(4723, “127.0.0.1”);
setDriver(platform, “http://127.0.0.0:4723”);
}

public void setDriver(String testPlatform, String url) throws MalformedURLException {
switch (testPlatform) {
case “ios”: {
System.out.println("------------ios--------" + url);
//driver = new AppiumDriver(new URL(url), capabilities);
// driver = new AppiumDriver(new URL(“http://127.0.0.1:4723”), capabilities); //v2 local
driver = new IOSDriver(new URL(“http://127.0.0.1:4723”), capabilities); //v2 local
break;
}

        default: {
            //System.out.println("android--------");
            driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), capabilities);
            break;
        }
    }

public void setIosCaps() {
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "15.5");
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 12 Pro Max");
    String appUrlIos = System.getProperty("user.dir") + "/src/app/IpaApk1/ipa/Example.app";
    capabilities.setCapability("app", appUrlIos);
}

.app = Simulator
.ipa = real device

Are you trying to test on real device?

I try to test on simulator. I have Xcode installed.

This is the structure of the app file/folder

enable DEBUG error logs with Appium server and check errors there. will be more info in DEBUG logs

1 Like

The appium server is started and the status is 200
[Appium] Welcome to Appium v2.0.0-beta.43
[Appium] Non-default server args:
[Appium] { address: ‘127.0.0.1’, sessionOverride: true }
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] { app:
[Appium] ‘/Users/…/app/swift/abc.app’,
[Appium] automationName: ‘XCUITest’,
[Appium] deviceName: ‘iPhone 12 Pro Max’,
[Appium] platformName: ‘IOS’,
[Appium] platformVersion: ‘15.5’ }
[Appium] Attempting to load driver xcuitest…
[…]
[debug] [AppiumDriver@73ea] Responding to client with driver.getStatus() result: {“build”:{“version”:“2.0.0-beta.43”}}
[HTTP] <-- GET /status 200 4 ms - 47

but after this is displayed

[XCUITestDriver@37aa (62217eea)] Session created with session id: 62217eea-89f0-4603-add2-5e6b83d5a9b6
[debug] [XCUITest] Current user: ‘xxxx’
[XCUITestDriver@37aa (62217eea)] iOS SDK Version set to ‘16.2’
[iOSSim] Constructing iOS simulator for Xcode version 14.2 with udid ‘D38F9903-AA4C-4E34-8ACF-876AE39B01B9’
[XCUITestDriver@37aa (62217eea)] Determining device to run tests on: udid: ‘D38F9903-AA4C-4E34-8ACF-876AE39B01B9’, real device: false
[debug] [XCUITestDriver@37aa (62217eea)] Event ‘xcodeDetailsRetrieved’ logged at 1681906091548 (15:08:11 GMT+0300 (Eastern European Summer Time))
[BaseDriver] Using local app ‘/Users/…/app/swift/abc.app’
[debug] [Support] Found ‘unzip’ at ‘/usr/bin/unzip’
[Support] unzip failed; falling back to JS: %s
[Support] unzip: cannot find or open /Users/…/app/swift/abc.app, /Users/…/app/swift/abc.app.zip or /Users/…/src/app/swift/abc.app.ZIP.
[Support]
[XCUITestDriver@37aa (62217eea)] {“cause”:{“errno”:-21,“code”:“EISDIR”,“syscall”:“read”},“isOperational”:true,“errno”:-21,“code”:“EISDIR”,“syscall”:“read”}
[DevCon Factory] Releasing connections for D38F9903-AA4C-4E34-8ACF-876AE39B01B9 device on any port number
[DevCon Factory] No cached connections have been found

tries to unzip the .app file ??? and normally it can’t be done
I want to use a simulator for the automated tests on swift application

looks like you provide wrong path to file.

[debug] [AppiumDriver@b850] Encountered internal error running command: Error: Simulator architecture is unsupported by the ‘/Users/me/githubProjects/src/app/abc.app’ application. Make sure the correct deployment target has been selected for its compilation in Xcode.

And this error?
I regenerated the .ipa file , make .zip, extract .app file, copy the .app filr into projects

For simulator you should generate app for Simulator!

1 Like