[HELP] Switching to WEBVIEW context does not succeed

Hi, I come across a problem when I try to switch from NATIVE_APP context to WEBVIEW context. The phenomenon is when I call self.driver.switch_to.context(webview), where webview is a variable assigned value from self.driver.contexts and I am sure it is a WEBVIEW, the code just stops there and ends with the following error message:

ERROR: test_kanrenao (main.ContactsAndroidTests)

Traceback (most recent call last):
File “wei_test.py”, line 193, in test_kanrenao
self.driver.switch_to.context(webview);
File “D:\Appuim\python-client\appium\webdriver\switch_to.py”, line 31, in cont
ext
self._driver.execute(MobileCommand.SWITCH_TO_CONTEXT, {‘name’: context_name}
)
File “C:\Python27\lib\site-packages\selenium-2.44.0-py2.7.egg\selenium\webdriv
er\remote\webdriver.py”, line 173, in execute
self.error_handler.check_response(response)
File “D:\Appuim\python-client\appium\webdriver\errorhandler.py”, line 29, in c
heck_response
raise wde
WebDriverException: Message: An unknown server-side error occurred while process
ing the command. (Original error: Did not get session redirect from Chromedriver
)

And here is the Appium log info:

info: [debug] returning process name: com.bluestacks.s2p
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.wei.mm:tools,WEBVIEW_com.bluestacks.s2p
info: [debug] [“WEBVIEW_com.wei.mm:tools”,“WEBVIEW_com.bluestacks.s2p”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.wei.mm:tools,WEBVIEW_com.bluestacks.s2p
info: [debug] Connecting to chrome-backed webview
info: [debug] Creating Chrome session
info: [debug] Set chromedriver binary as: D:\Appuim\AppiumForWindows\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Ensuring Chromedriver exists
info: [debug] 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 %b))
info: [debug] No old chromedrivers seemed to exist
info: [debug] Spawning chromedriver with: D:\Appuim\AppiumForWindows\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] [CHROMEDRIVER] Starting ChromeDriver (v2.10.267521) on port 9515
Only local connections are allowed.
info: [debug] Making http request with opts: {“url”:“http://127.0.0.1:9515/wd/hub/session",“method”:“POST”,“json”:{“sessionId”:null,“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.wei.mm”,“androidUseRunningApp”:true,“androidDeviceSerial”:"emulator-5554”}}}}
info: [debug] Didn’t get a new command in 60 secs, shutting down…
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.exe -s emulator-5554 shell “input keyevent 3”
info: [debug] Resetting IME to ‘io.appium.android.ime/.UnicodeIME’
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.exe -s emulator-5554 shell “ime set io.appium.android.ime/.UnicodeIME”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM

I use:

  • AppiumForWindows 1.3.4.1
  • Bluestacks 0.9.8 Emulator
  • Appium python client
  • Android 4.4, API 19

Capabilities:
desired_caps[‘platformName’] = ‘Android’
desired_caps[‘platformVersion’] = ‘4.4’
desired_caps[‘deviceName’] = ‘Android Emulator’
desired_caps[‘appPackage’] = ‘com.wei.mm’
desired_caps[‘unicodeKeyboard’] = True
desired_caps[‘resetKeyboard’] = True
desired_caps[‘automationName’] = ‘appium’

I have tested against the example from appium official site named AndroidWebViewTests(selendroid-test-app-0.13.0.apk) successfully in the same environment as the failed test I mentioned above.

Any help would be appreciated. Thanks in advance!