Hi All
I am trying to run a simple script to launch chrome browser and open facebook website using latest appium client and server verision. My Details are below
Appium Version : 1.6.3 (I am running it on Terminal using npm appium)
Appium Client Version : 4.1.2
OS : Mac
Android Version : 6.0.1
Script:
public class LaunchDefaultBrowserTest {
AndroidDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
@BeforeClass public void setUp() throws MalformedURLException { capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID); capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0.1"); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Redmi Note 3"); capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.CHROME); driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); }
@Test public void testLaunchingDefaultBrowserAndroid() throws Exception { driver.get("http://facebook.com"); System.out.println(driver.getTitle()); System.out.println();
}
@AfterClass public void tearDown() { driver.quit(); System.out.println("Driver Session is closed"); }
}
Error Logs:
[debug] [ADB] Getting all processes with uiautomator [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running '/Users/computerUserName/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","1890d7e2","shell","ps"] [ADB] No uiautomator process found to kill, continuing... [debug] [UiAutomator] Starting UIAutomator [debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","1890d7e2","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.android.chrome","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false] [debug] [UiAutomator] Moving to state 'online' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] json loading complete. [AndroidBootstrap] Android bootstrap socket is now connected [AndroidDriver] Starting a chrome-based browser session [debug] [AndroidDriver] A port was not given, using random port: 8000 [debug] [Chromedriver] Changed state to 'starting' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers. [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [Chromedriver] Set chromedriver binary as: /Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver [Chromedriver] Killing any old chromedrivers, running: pkill -15 -f "/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver.*--port=8000" [Chromedriver] No old chromedrivers seemed to exist [Chromedriver] Spawning chromedriver with: /Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver --url-base=wd/hub --port=8000 --adb-port=5037 [Chromedriver] [STDOUT] Starting ChromeDriver 2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1) on port 8000 Only local connections are allowed. [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Mac OS X\",\"version\":\"10.11.6\"}}}" [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"1890d7e2"}}} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"316e0bf24b157c2d97a586ed8b308ad9","status":13,"value":{"message":"unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 9864 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.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}} [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"1890d7e2"}}} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"1be23e11ef6008360f6dff77c7ea5ad4","status":13,"value":{"message":"unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 9913 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.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}} [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"1890d7e2"}}} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"586c941c200eb5f7a7c961269a3e3aee","status":13,"value":{"message":"unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 9943 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.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}} [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"1890d7e2"}}} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"4afe01c9d6c0f1a0459c3b1017c79dfb","status":13,"value":{"message":"unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 10076 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.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}} [Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM [debug] [Chromedriver] Changed state to 'stopped' [Chromedriver] Error: unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 10076 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome
(Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64) at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:177:15) at tryCatch (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21) at GeneratorFunctionPrototype.invoke (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37) Error: unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 10076 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome
(Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64) at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:177:15) at tryCatch (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21) at GeneratorFunctionPrototype.invoke (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37) [debug] [AndroidDriver] Shutting down Android driver [debug] [ADB] Pressing the HOME button [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running '/Users/computerUserName/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","1890d7e2","shell","input","keyevent",3] [debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"} [debug] [AndroidBootstrap] Received command result from bootstrap [debug] [UiAutomator] Shutting down UiAutomator [debug] [UiAutomator] Moving to state 'stopping' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection [debug] [UiAutomator] UiAutomator shut down normally [debug] [UiAutomator] Moving to state 'stopped' [debug] [ADB] Attempting to kill all uiautomator processes [debug] [ADB] Getting all processes with uiautomator [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running '/Users/computerUserName/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","1890d7e2","shell","ps"] [ADB] No uiautomator process found to kill, continuing... [debug] [UiAutomator] Moving to state 'stopped' [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running '/Users/computerUserName/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","1890d7e2","shell","am","force-stop","io.appium.unlock"] [debug] [Logcat] Stopping logcat capture [debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted. [MJSONWP] Encountered internal error running command: Error: unknown error: Failed to clear data for com.android.chrome on device 1890d7e2: Error: java.lang.SecurityException: PID 10076 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome
(Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64) at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:177:15) at tryCatch (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21) at GeneratorFunctionPrototype.invoke (/Users/computerUserName/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37) [HTTP] <-- POST /wd/hub/session 500 27610 ms - 492
Kindly help on this. Thank you.