简体   繁体   中英

Appium \ MAC OS \ Android \ Java - org.openqa.selenium.SessionNotCreatedException

I am trying to test Android device on MAC OS X, using Appium (in Java). The build path includes these:

    java-client-<version>.jar
    java-client-<verson>-sources.jar
    selenium-java-<version>.jar
    selenium-server-standalone-<version>.jar

(the version of the last 2 is the same), and TestNG.

Starting the Appium server (i am using the GUI) works fine and the application (which is already installed on the device) launches. Starting to debug my eclipse project which contains the following lines, i am getting the error for the 3rd line.

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("deviceName", "Plus");
    AppiumDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

The full error i am getting is:

    org.openqa.selenium.SessionNotCreatedException: A new session could not be created. Details: Problem getting session data for driver type AndroidDriver; does it implement 'get driverData'?

You're saying that using the GUI launches the application? If that's the case, and what you're showing in code is your full DesiredCapabilities, then your capabilities would be the problem.

You can see what the capabilities the Appium GUI is using at the top with the text "Launching Appium with command".

If you set those flags in your capabilities, then the driver should connect properly.

You forgot to close the appium session by use driver.close() ?

Try to restart your appium server.

P/s: When you don't want to close driver , you need enable Session override in appium GUI settings or add --session-override in appium command line. Then you don't need to restart appium server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM