Problem with switching context

hi,

I’ve getting some issues in my tests when switching contexts from Native app to web view.

My scenario is that I’m running with testNG and have 3 iterations of the test to go through, with data provided by data providers. On the first iteration, I can get the contexts, see there is a native app view, and web view (on a given screen). I can switch to the web view successfully, click an element, and return to native app. I moved to the next screen and successfully repeated the process. The test carries on and completes, then loops around to run with the next set of data.

On the first page that has the web view, it can see both native app and web view. However, when i call driver.context(WEBVIEW) this time, it just sits there. It gets stuck and i have to stop the test. There are no signs of error at the end of the log.

info: [debug] Parsed pid: 11356 pkg: com.xxx.acr

info: [debug] from: u0_a194,11356,123,827088,104728,ffffffff,00000000,S,com.xxxx.acr
info: [debug] returning process name: com.xxxx.acr
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.xxxx.acr
info: [debug] [“WEBVIEW_com.xxxx.acr”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.xxxx.acr
info: [debug] Responding to client with success: {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_com.xxxx.acr”],“sessionId”:“5e08284c-fa97-4ee6-870a-7a021dbce38b”}
info: <-- GET /wd/hub/session/5e08284c-fa97-4ee6-870a-7a021dbce38b/contexts 200 118.504 ms - 110 {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_com.xxxx.acr”],“sessionId”:“5e08284c-fa97-4ee6-870a-7a021dbce38b”}

info: --> POST /wd/hub/session/5e08284c-fa97-4ee6-870a-7a021dbce38b/context {“name”:“WEBVIEW_com.xxxx.acr”}
info: [debug] Getting a list of available webviews

info: [debug] executing cmd: /Users/Hugo/Applications/android-sdk/sdk/platform-tools/adb -s 015d4a5f6b53f012 shell “cat /proc/net/unix”

info: [debug] WEBVIEW_11356 mapped to pid 11356

info: [debug] Getting process name for webview
info: [debug] executing cmd: /Users/Hugo/Applications/android-sdk/sdk/platform-tools/adb -s 015d4a5f6b53f012 shell “ps”

info: [debug] Parsed pid: 11356 pkg: com.xxxx.acr

info: [debug] from: u0_a194,11356,123,827088,104728,ffffffff,00000000,S,com.xxxx.acr
info: [debug] returning process name: com.xxxx.acr
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.xxxx.acr
info: [debug] [“WEBVIEW_com.xxxx.acr”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.xxxx.acr
info: [debug] Connecting to chrome-backed webview
info: [debug] Found existing Chromedriver for context ‘WEBVIEW_com.xxxx.acr’. Using it.
info: [debug] Making http request with opts: {“url”:“http://127.0.0.1:9515/wd/hub/session/22015fdb5df445ad89c02dcbb2d96e84/url",“method”:"GET”}

info: --> GET /wd/hub/status {}

info: [debug] Proxying command to 127.0.0.1:9515
info: [debug] Making http request with opts: {“url”:“http://127.0.0.1:9515/wd/hub/status",“method”:"GET”}

info: [debug] Proxied response received with status 200: “{“sessionId”:”",“status”:0,“value”:{“build”:{“version”:“alpha”},“os”:{“arch”:“x86_64”,“name”:“Mac OS X”,“version”:“10.10.2”}}}"
info: <-- GET /wd/hub/status 200 6.483 ms - 126

info: --> GET /wd/hub/status {}

info: [debug] Proxying command to 127.0.0.1:9515
info: [debug] Making http request with opts: {“url”:“http://127.0.0.1:9515/wd/hub/status",“method”:"GET”}

i just posted a simpler case where it does not work for me. check it out.