Webview cannot be automated

WebView automation was working fine till last week for 4.4.4 Android OS

There seem to be a huge delay before chromedriver moves from Starting state to online state.

Now its broken.
Appium : 1.5.3
Appium client Java : 3.4.1

Refer below logs -

Refer below logs -
[debug] [AndroidDriver] WEBVIEW_9283 mapped to pid 9283
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/rbaliga/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s",“HT452WM04416”,“shell”,“ps”]

[debug] [AndroidDriver] Parsed pid: 9283 pkg: com…xxx.mobile!
[debug] [AndroidDriver] from: u0_a269,9283,363,1350448,288164,ffffffff,00000000,S,com.xxx.mobile
[debug] [AndroidDriver] returning process name: com.xxx.mobile
[debug] [AndroidDriver] Found webviews: [“WEBVIEW_com.xxx.mobile”]
[debug] [AndroidDriver] Available contexts: [“NATIVE_APP”,“WEBVIEW_com.xxx.mobile”]
[debug] [AndroidDriver] Connecting to chrome-backed webview context ‘WEBVIEW_com.xxx.mobile’
[debug] [Chromedriver] Changed state to ‘starting’
[Chromedriver] Set chromedriver binary as: /Applications/Appium_1.5.3.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver
[Chromedriver] Killing any old chromedrivers, running: pkill -15 -f “/Applications/Appium_1.5.3.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver.*–port=9515”
[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Spawning chromedriver with: /Applications/Appium_1.5.3.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver --url-base=wd/hub --port=9515 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.24.417412 (ac882d3ce7c0d99292439bf3405780058fcca0a6) on port 9515
Only local connections are allowed.

[JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
[JSONWP Proxy] Got response with status 200: “{“sessionId”:”","stat…
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {“desiredCapabilities”:{"ch…

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 11 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 8 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 8 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 13 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 8 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 8 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 7 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 9 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 9 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 8 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 9 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 10 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 9 ms - 83

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…
[HTTP] <-- GET /wd/hub/status 200 7 ms - 83

[HTTP] <-- POST /wd/hub/session/cef819a1-d313-41d1-b578-bba7cc076a71/context - - ms - -

[Chromedriver] [STDERR] [600.997][SEVERE]: Timed out receiving message from renderer: 600.000

[JSONWP Proxy] Got response with status 200: {“sessionId”:"9798f7a9761bc…
[debug] [Chromedriver] Changed state to 'online’
[MJSONWP] Responding to client with driver.setContext() result: null

More logs - Not sure why Chromedriver suddenly goes to stop state.

[debug] [AndroidDriver] Available contexts: [“NATIVE_APP”,“WEBVIEW_com.xxx.mobile”]
[debug] [AndroidDriver] Connecting to chrome-backed webview context ‘WEBVIEW_com.xxx.mobile’
[debug] [AndroidDriver] A port was not given, using random port: 8000
[debug] [Chromedriver] Changed state to ‘starting’
[Chromedriver] Set chromedriver binary as: /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver
[Chromedriver] Killing any old chromedrivers, running: pkill -15 -f “/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver.*–port=8000”
[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Spawning chromedriver with: /usr/local/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.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 8000
Only local connections are allowed.
[JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[JSONWP Proxy] Got response with status 200: “{“sessionId”:”",“stat…
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {“desiredCapabilities”:{“ch…
[JSONWP Proxy] Got response with status 200: {“sessionId”:“8a9eda9e490ea…
[debug] [Chromedriver] Changed state to ‘online’
[MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/0ee350a4-af38-4923-9711-f82580994e27/context 200 1209 ms - 76
[HTTP] --> POST /wd/hub/session/0ee350a4-af38-4923-9711-f82580994e27/element {“using”:“id”,“value”:“step1”}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[JSONWP Proxy] Proxying [POST /wd/hub/session/0ee350a4-af38-4923-9711-f82580994e27/element] to [POST http://127.0.0.1:8000/wd/hub/session/8a9eda9e490ea7d16c0038574a495cf8/element] with body: {“using”:“id”,“value”:“step1”}
[JSONWP Proxy] Got response with status 200: {“sessionId”:“8a9eda9e490ea…
[JSONWP Proxy] Replacing sessionId 8a9eda9e490ea7d16c0038574a495cf8 with 0ee350a4-af38-4923-9711-f82580994e27
[HTTP] <-- POST /wd/hub/session/0ee350a4-af38-4923-9711-f82580994e27/element 200 128 ms - 326
[HTTP] --> DELETE /wd/hub/session/0ee350a4-af38-4923-9711-f82580994e27 {}
[MJSONWP] Calling AppiumDriver.deleteSession() with args: [“0ee350a4-af38-4923-9711-f…
[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Stopping chromedriver for context WEBVIEW_com.xxx.mobile
[debug] [Chromedriver] Changed state to ‘stopping’
[JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8000/wd/hub/session/8a9eda9e490ea7d16c0038574a495cf8] with no body
[JSONWP Proxy] Got response with status 200: “{“sessionId”:“8a9eda9e4…
[debug] [Chromedriver] Changed state to ‘stopped’
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/rbaliga/Library/Android/sdk/platform-tools/adb’ with args: [”-P”,5037,”-s”,“HT452WM04416”,“shell”,“am”,“force-stop”,“com.xxx.mobile”]
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/rbaliga/Library/Android/sdk/platform-tools/adb’ with args: [”-P”,5037,”-s",“HT452WM04416”,“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: {“value”:“OK, shutting down”,“status”:0}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 223.083
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state ‘stopping’
[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…

I faced something similar last week. I was able to resolve it by updating the version of the chrome driver used by Appium from 2.21 to 2.25.

I downloaded the latest version of chrome driver for MAC navigated to:
node_modules > appium > node_modules > appium-android-driver > node_modules > appium-chromedriver > chromedriver > mac (copied the existing version as a back up) and then replaced the existing chromedriver file with the new version.

My webview tests started passing!

Hope that helps.

Thanks Will try that.
My problem was it works fine for a webview which I hit initially in the flow.

But later flow in the app is the issue…I initially ran into this issue on 5.0 and greater versions of android, but 4.4.4 was working fine. so our automation was limited to 4.4.4

Now even thats broken.

I will update if i get it working with your suggestion.

We are not getting response for the last post call in below log -

[> Chromedriver] Killing any old chromedrivers, running: pkill -15 -f “/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver.*–port=9515”

[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Spawning chromedriver with: /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver --url-base=wd/hub --port=9515 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0) on port 9515
Only local connections are allowed.

[JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
[JSONWP Proxy] Got response with status 200: "{"sessionId":"","stat…
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {“desiredCapabilities”:{"ch…

Looks like issue occurred as we upgrade compileSDK version in build.gradle to API 24.
Worked fine on API 23 once.
Will update after detailed investigation.

Is anyone aware of issue with Chrome driver and Google SDK 24[compile] ?