Hi,
I’m a newbie to Appium and would appreciate any help on the below.
I’ve used the below DesiredCapabilities object for my Android hybrid app.
Can anyone please help me with why emulator shows up as offline on trying to set driver.context to webview availabe
Emulator android version: 4.4.1
Appium version : 1.4.0
Chrome driver version: 2.15
Chrome version installed on emulator: 35.0
Error: Emulator status displayed as not online after connecting to
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Nexus_5_API_19");
capabilities.setCapability("platformVersion", "4.4.2");
capabilities.setCapability("browserName", "Browser");
capabilities.setCapability("app", "C:\\Users\\test\\Downloads\\xm-blue-tps-release-6.7.8.180908.apk");
capabilities.setCapability("appPackage", "com.test.xm.tps");
capabilities.setCapability("appActivity", "com.test.xm.view.activity.StartupActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
Thread.sleep(15000);
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName);
if (contextName.contains("WEBVIEW")){
driver.context(contextName);
Thread.sleep(10000);
}}
Appium Logs:
C:\Users\test>cd C:\Program Files (x86)\Appium2\node_modules\appium\bin
C:\Program Files (x86)\Appium2\node_modules\appium\bin>node appium
info: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: --> POST /wd/hub/session {“desiredCapabilities”:{“app”:“C:\Users\test
\Downloads\xhm-blue-tps-release-6.7.8.180908.apk”,“appPackage”:“com.test.xhm.tps”,“appActivity”:“com.test.xhm.view.activity.Star
tupActivity”,“platformVersion”:“4.4.2”,“browserName”:“Browser”,“platformName”:“A
ndroid”,“deviceName”:“Nexus_5_API_19”}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_31)
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session c5b79357-ce93-441d-ab6a-6a4232e62718
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s alr
eady on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium2\node_mo
dules\appium\build\chromedriver\windows\chromedriver.exe
info: Set chromedriver binary as: C:\Program Files (x86)\Appium2\node_modules\ap
pium\build\chromedriver\windows\chromedriver.exe
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 install “C:\Program Files (x86)\Appium2\node_mod
ules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 push “C:\Program Files (x86)\Appium2\node_mod
ules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: C:\Users\test\AppData\Local\Android\sdk\platform
-tools\adb.exe -s emulator-5554 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Users\test\AppData\Local\Android\sdk\platform-tool
s\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.a
ppium.android.bootstrap.Bootstrap -e pkg com.android.chrome -e disableAndroidWat
chers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”
:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:"/data",“status”:0
}
info: [debug] dataDir set to: /data
info: Killing any old chromedrivers, running: FOR /F “usebackq tokens=5” %a in (
netstat -nao ^| findstr /R /C:"9515 "
) do (FOR /F “usebackq” %b in (TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe
) do (IF NOT %b=="" TASKKILL /F /
PID %a))
info: No old chromedrivers seemed to exist
info: Spawning chromedriver with: C:\Program Files (x86)\Appium2\node_modules\ap
pium\build\chromedriver\windows\chromedriver.exe --url-base=wd/hub --port=9515
info: [CHROMEDRIVER STDOUT] Starting ChromeDriver 2.15.322448 (52179c1b310fec179
7c81ea9a20326839860b7d3) on port 9515
Only local connections are allowed.
info: Proxying [GET /status] to [GET http:/ 127 0 0 1:9515/wd/hub/status] with n
o body
info: Got response with status 200: {“sessionId”:"",“status”:0,“value”:{“build”:
{“version”:“alpha”},“os”:{“arch”:“x86_64”,“name”:“Windows NT”,“version”:“6.3”}}}
info: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] wi
th body: {“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.android.
chrome”,“androidDeviceSerial”:“emulator-5554”}}}
info: Got response with status 200: {“sessionId”:“9ad9443805971ca1c7efedefc6b0f2
54”,“status”:13,“value”:{“message”:"unknown error: com.android.chrome is not ins
talled on device emulator-5554\n (Driver info: chromedriver=2.15.322448 (52…
info: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] wi
th body: {“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.android.
chrome”,“androidDeviceSerial”:“emulator-5554”}}}
info: Got response with status 200: {“sessionId”:“d07c872ff35a3f6334a1e89783ea92
c4”,“status”:13,“value”:{“message”:"unknown error: Device emulator-5554 is not o
nline\n (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20…
info: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] wi
th body: {“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.android.
chrome”,“androidDeviceSerial”:“emulator-5554”}}}
info: Got response with status 200: {“sessionId”:“b2bcc34af0b9ec47c88570f3eea1aa
45”,“status”:13,“value”:{“message”:“unknown error: Device emulator-5554 is not o
nline\n (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20…
info: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] wi
th body: {“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.android.
chrome”,“androidDeviceSerial”:“emulator-5554”}}}
info: Got response with status 200: {“sessionId”:“da3626c2d563e1bb3690fe78a7a42f
62”,“status”:13,“value”:{“message”:“unknown error: Device emulator-5554 is not o
nline\n (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20…
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: An unknown server-side
error occurred while processing the command. (Original error: unknown error: De
vice emulator-5554 is not online
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7
d3),platform=Windows NT 6.3 x86_64))
info: [debug] Error: An unknown server-side error occurred while processing the
command. (Original error: unknown error: Device emulator-5554 is not online
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7
d3),platform=Windows NT 6.3 x86_64))
at JWProxy.command$ (lib/proxy.js:146:15)
at tryCatch (C:\Program Files (x86)\Appium2\node_modules\appium\node_modules
\appium-chromedriver\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Ap
pium2\node_modules\appium\node_modules\appium-chromedriver\node_modules\babel-ru
ntime\regenerator\runtime.js:231:22)
at GeneratorFunctionPrototype.Gp.(anonymous function) [as next] (C:\Program
Files (x86)\Appium2\node_modules\appium\node_modules\appium-chromedriver\node_mo
dules\babel-runtime\regenerator\runtime.js:264:19)
at tryCatch (C:\Program Files (x86)\Appium2\node_modules\appium\node_modules
\appium-chromedriver\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.step (C:\Program Files (x86)\Appium2\node_modu
les\appium\node_modules\appium-chromedriver\node_modules\babel-runtime\regenerat
or\runtime.js:116:22)
at runMicrotasksCallback (node.js:337:7)
at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:”
A new session could not be created. (Original error: An unknown server-side erro
r occurred while processing the command. (Original error: unknown error: Device
emulator-5554 is not online\n (Driver info: chromedriver=2.15.322448 (52179c1b3
10fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.3 x86_64)))”,“status”:13,
“value”:{“message”:“unknown error: Device emulator-5554 is not online\n (Driver
info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platf
orm=Windows NT 6.3 x86_64)”},“httpCode”:200,“origValue”:“An unknown server-side
error occurred while processing the command. (Original error: unknown error: Dev
ice emulator-5554 is not online\n (Driver info: chromedriver=2.15.322448 (52179
c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.3 x86_64))”},“session
Id”:null}
info: <-- POST /wd/hub/session 500 14810.293 ms - 842