I Am new to Appium. I was doing for Coding for Launching the Chrome Browser and Native App But I got "SessionNotCreatedException" Exception. Can anyone Guide me where I have done Mistake
PFB more details
Console Output
[Exception in thread "main" 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: Failed to clear data for com.android.chrome on device ccdcb242: Error: java.lang.SecurityException: PID 31419 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome]
/
Program
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
public class launchWebApp {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("automationName", "Appium");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion","6.0.1");
cap.setCapability("browserName", "Chrome");
cap.setCapability("deviceName", "ccdcb242");
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.get("http://m.sears.com/home");
Thread.sleep(5000);
driver.quit();
}
}
Appium Server Logs
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Failed to clear data for com.android.chrome on device ccdcb242: Error: java.lang.SecurityException: PID 31016 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome\r\n\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64)))","status":13,"value":{"message":"unknown error: Failed to clear data for com.android.chrome on device ccdcb242: Error: java.lang.SecurityException: PID 31016 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome\r\n\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64)"},"httpCode":200,"origValue":"An unknown server-side error occurred while processing the command. (Original error: unknown error: Failed to clear data for com.android.chrome on device ccdcb242: Error: java.lang.SecurityException: PID 31016 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome\r\n\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64))"},"sessionId":null}