Driver.contexts raise exception on iOS

Hi, all
I try to get driver.contexts, but an unknown error occurred.

My target platform: iOS 8 (real device)

my tools version are:

Appium-Python-Client==0.17

enum34==1.0.4

selenium==2.47.3

appium ==1.4.11

developing OS:Mac 10.10.5

Error message is as below:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED 127.0.0.1:27753

Error message from appium is as below:

info: --> GET /wd/hub/session/092fb9d1-fa92-4994-8a46-960b68b86a88/contexts {}
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
error: [REMOTE] Could not connect to WebKitRemoteDebugger server
info: [debug] Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED 127.0.0.1:27753)”,“code”:“ECONNREFUSED”,“errno”:“ECONNREFUSED”,“syscall”:“connect”,“address”:“127.0.0.1”,“port”:27753,“origValue”:“connect ECONNREFUSED 127.0.0.1:27753”},“sessionId”:“092fb9d1-fa92-4994-8a46-960b68b86a88”}
info: <-- GET /wd/hub/session/092fb9d1-fa92-4994-8a46-960b68b86a88/contexts 500 2.531 ms - 360
info: --> DELETE /wd/hub/session/092fb9d1-fa92-4994-8a46-960b68b86a88 {}

I cant find further information on official document.
Does anyone know what happened?

Thanks a lot

Met the same problem, my appium 1.5.1. Did you have had resolved it?
@Camilla_Ke

Hi,
I think the function not implemented for python client.

I’ve resolved it as below:

  1. Install ios_webkit_debug_proxy(you can use brew command to install it) and run it like this:
    ./ios_webkit_debug_proxy -c your_device’s_udid:27753 -d
  2. Restart your appium service and run your script.

I can get all the contexts now(with python).

But still can NOT switch to a webview and locate elements with appium 1.5.1;
and I just saw appim 1.5.2, which said “fix issues with getting webview contexts on real devices” with this link “Appium 1.5.2 released”, you can have a try, and I’ll also try it later.