1
votes

I have been trying to access a webview from the my native context for the app but i have been unable to do so with the following error.

WebDriverException: Message: An unknown server-side error occurred while processing the command. (Original error: Did not get session redirect from Chromedriver)

I have tried to run my script using appium 1.3.7.2 on android emulators with multiple configurations including 4.4.2, 5.1, and 4.3. none of the three seem to work and they are throwing the same error.

I have also looked into:

https://code.google.com/p/chromedriver/issues/detail?id=845&thanks=845&ts=1404927199

And followed a few steps, changed the chromedriver binaries but with no luck.

I have multiple webviews present , but i dont think that should be the issue here. can somebody please help me with this ?

Please look at the following stack trace :

o: [debug] executing cmd: C:\Users***\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps"

info: [debug] WEBVIEW_2767 mapped to pid 2767 info: [debug] Getting process name for webview info: [debug] executing cmd: C:\Users***\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps" info: [debug] Parsed pid: 2767 pkg: * info: [debug] from: u0_a53,2767,944,800448,111104,ffffffff,b75152d2,S, info: [debug] returning process name: info: [debug] Parsed pid: 2785 pkg: info: [debug] from: u0_a53,2785,944,593196,52692,ffffffff,b7577355,S, info: [debug] returning process name: info: [debug] Available contexts: NATIVE_APP,, info: [debug] ["WEBVIEW_","WEBVIEW_"] info: [debug] Available contexts: NATIVE_APP,WEBVIEW_,WEBVIEW_ info: [debug] Connecting to chrome-backed webview info: [debug] Creating Chrome session info: [debug] Set chromedriver binary as: C:\Program Files (x86)\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: C:\Program Files (x86)\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe info: [debug] [CHROMEDRIVER] Starting ChromeDriver (v2.10.289383) 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":"","androidUseRunningApp":true,"androidDeviceSerial":"emulator-5554"}}}} info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: Did not get session redirect from Chromedriver)","origValue":"Did not get session redirect from Chromedriver"},"sessionId":"ac576cc4-fea0-450d-a4bf-f2b5f2ca9dc4"} info: <-- POST /wd/hub/session/ac576cc4-fea0-450d-a4bf-f2b5f2ca9dc4/context 500 416.371 ms - 280 at Chromedriver.onClose (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\chromedriver.js:144:10) at ChildProcess.EventEmitter.emit (events.js:98:17) at Process.ChildProcess._handle.onexit (child_process.js:797:12) context: [POST /wd/hub/session/ac576cc4-fea0-450d-a4bf-f2b5f2ca9dc4/context {"sessionId":"ac576cc4-fea0-450d-a4bf-f2b5f2ca9dc4","name":"WEBVIEW_*"}] info: [debug] [CHROMEDRIVER STDERR] [0.008][SEVERE]: Could not bind socket to 127.0.0.1:9515 info: [debug] [CHROMEDRIVER] Port not available. Exiting... info: --> DELETE /wd/hub/session/ac576cc4-fea0-450d-a4bf-f2b5f2ca9dc4 {} info: Shutting down appium session info: [debug] Pressing the HOME button info: [debug] executing cmd: C:\Users***\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "input keyevent 3" info: [debug] Chromedriver exited with code 1 info: [debug] Stopping logcat capture info: [debug] Logcat terminated with code null, signal SIGTERM info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"} info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"} info: [debug] [BOOTSTRAP] [debug] Closed client connection info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream= info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=. info: [debug] [UIAUTOMATOR STDOUT] Time: 53.474 info: [debug] [UIAUTOMATOR STDOUT] OK (1 test) info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1 info: [debug] Sent shutdown command, waiting for UiAutomator to stop... info: [debug] UiAutomator shut down normally info: [debug] Cleaning up android objects info: [debug] Cleaning up appium session

1

1 Answers

0
votes

December 5,2012.

I hope at present this problem is resolved using AppiumDriver and then switching the context to Webview using this :

Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {    
System.out.println(contextName); //prints out something like NATIVE_APP, WEBVIEW_com.example.android etc..}
String setContext = contextNames.toArray()[1].toString();
driver.context(setContext);// set context to WEBVIEW_com.example.android

Perform your action using css and classname. Switch back to Native context using driver.context(NATIVE_APP);