Java-client: IOSDriver cannot be created from AppiumDriverLocalService, because of Problem getting session data for driver type IosDriver

Created on 14 Mar 2016  ·  19Comments  ·  Source: appium/java-client

Description

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. Details: Problem getting session data for driver type IosDriver; does it implement 'get driverData'? (WARNING: The server did not provide any stacktrace information)

Environment

  • java client build version or git revision if you use some shapshot: 3.4.0
  • Appium server version or git revision you is use some shapshot:1.5.0
  • Desktop OS/version used to run Appium if necessary:Mac OS X 10.11
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 5.6.0
  • Mobile platform/version under test: 8.1.1
  • Real device or emulator/simulator: iphone 5s

    Details

I run my test in testng
I created AppiumDriverLocalService and started() it in @BeforeSuite
then in @BeforeTest I created IOSDriver as follow:

IOSDriver<MobileElement> iosDriver = new IOSDriver<>(getLocalService().getUrl(), desiredCapabilities);

But this statement got stacks

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. Details: Problem getting session data for driver type IosDriver; does it implement 'get driverData'? (WARNING: The server did not provide any stacktrace information)

detailed full logs, please see https://gist.github.com/truebit/f017d57fc887ec0e3be6

Code To Reproduce Issue [ Good To Have ]

None

Ecxeption stacktraces

https://gist.github.com/truebit/f017d57fc887ec0e3be6

Link to Appium logs

https://gist.github.com/truebit/f017d57fc887ec0e3be6

User side probleproblem of an external tool

Most helpful comment

I just restarted appium and it worked for me

All 19 comments

It seems that something is wrong on the server side. This exception was thrown here: https://github.com/appium/appium/blob/5d324178c8246c0122f5dbc6302fcf24c0322d6a/lib/appium.js#L137

I have no device ti reproduce this problem. @imurchie Any idea?

@truebit
Which capabilities have been provided here (I need Java code)?

IOSDriver<MobileElement> iosDriver = new IOSDriver<>(getLocalService().getUrl(), desiredCapabilities);

This looks like two sessions happening at once? There is a second session starting here: https://gist.github.com/truebit/f017d57fc887ec0e3be6#file-gistfile1-txt-L139

The error is... odd.

@imurchie yes, It seems that the AppiumDriverLocalService have already created an session. and then IOSDriver tried to create another and failed.

@TikhomirovSergey I wrote a class to read desiredCapabilities from a properties file. The desiredCapabilities could be seen in the log gist actually.

@truebit @imurchie
As I know appium doesn't support the multisession mode yet, am I right?

@truebit
Do these sessions use the same port?

The infrastructure is there for multisession mode, but it hasn't been ironed out. Also, for iOS it is unlikely to happen until we support something other than Instruments.

@truebit I think the it could work out your problem:

it is possible to create two instance of AppiumDriverLocalServices which can use same binaries and work on different ports.

 new AppiumServiceBuilder().
                    usingAnyFreePort().build().start();

@imurchie @truebit What do you think about this?

Sorry, I have found the root cause.
The server was only launched once, but I created IOSDriver twice. It failed when trying to create another IOSDriver instance

appium 1.5.2

使用 appium --session-override 启动。

第一个session启动正常,在第二个session请求后,并没有覆盖第一个session,直接报错了。
错误信息:
{
"status": 33,
"value": {
"message": "A new session could not be created. Details: Problem getting session data for driver type IosDriver; does it implement 'get driverData'?"
},
"sessionId": null
}

I just restarted appium and it worked for me

hi @imurchie , could you help me how to update Automaion name from "UIAutomation" to "XCUITest" ?

bellow are the appium logs

image

Have you tried to define it in Capabilities?
For Java client it's something like capabilities.setCapability("automationName", "XCUITest");

Hi @ochubey , I have scripts in ruby and tried the same :automationName => config['XCUITest'] still i am seeing the same

can any one help me on this?

I have updated the script as :automationName => 'XCUITest' , since dont have the value in config file and now it is working fine
thanks @ochubey !

@babusurendra U welcome ;)

Hi @ochubey , i have xpath like "//UIAApplication[1]/UIAWindow/UIAAlert[contains(@label,'Notifications')] " but this is not working in 1.6 appium when i use "//*[contains(@label,'Notifications')]" it is working fine do we have any solution for this?

also below xpath working fine "//XCUIElementTypeApplication[1]/XCUIElementTypeWindow/XCUIElementTypeAlert[contains(@label,'Notifications')]

Run Appium.
It will create new session, Find the port number. (always it will be like - address "127.0.0.1" --robot-
port 4)
Port number should match with the capability.

Example: If my port number is 4, then

    AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4/wd/hub"),cap);

Thanks,
Shameed.

Was this page helpful?
0 / 5 - 0 ratings