Chetan
Chetan

Reputation: 2400

A new session could not be created exception occurs

i will try to open chrome browser & automate the facebook (try to open any site so that i can check my appium configuration is ok or not)

After execution of following code got exception as,

@Test
public void test1() throws MalformedURLException
{
    DesiredCapabilities capabilities=DesiredCapabilities.android();
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
    capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "my phone");
    capabilities.setCapability(MobileCapabilityType.VERSION, "6.0.1");

    URL url=new URL("http://127.0.0.1:4727/wd/hub");
    //java.net.URL url=new URL("http://127.0.0.1:4727/wd/hub");

    //URL url=new URL("http://127.0.0.1:4727/wd/hub");

    WebDriver driver=new AndroidDriver(url, capabilities);
    //WebDriver driver = new RemoteWebDriver(new URL( http://****:4723/wd/hub), capabilities);
    //  WebDriver driver = new RemoteWebDriver(new URL("http://****:4723/wd/hub", capabilities);
    //driver.get("http://www.yahoo.com"); 
    driver.get("https://www.facebook.com/");
    System.out.println(driver.getTitle());

exception as,

@BeforeTest setUp org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device 4e89be7c is not online (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 9.05 seconds Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'

please help

Upvotes: 1

Views: 1142

Answers (1)

David Ep
David Ep

Reputation: 270

I see in the stacktrace that "Device 4e89be7c is not online"

I'm pretty sure that you avd is open and running so please time in terminal "adb devices"

if your avd is shown and its status is "offline" then type: "adb kill-server"

IMPORTANT: Close any instances of adb in the Task Manager

now type in terminal "adb start-server" and "adb devices" -> if the status of the adb has changed, you are good to go.

Upvotes: 1

Related Questions