Connecting to chrome-backed webview fails

Doing a simple ‘setContext(webViewVariable)’ caused the following exception in the Appium logs;

info: [debug] Connecting to chrome-backed webview
error: Unhandled error: TypeError: undefined is not a function
    at [object Object].androidHybrid.setupNewChromedriver (C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-hybrid.js:171:33)
    at [object Object].androidHybrid.startChromedriverProxy (C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-hybrid.js:127:10)
    at [object Object].<anonymous> (C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-context-controller.js:75:12)
    at [object Object].<anonymous> (C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-context-controller.js:39:5)
    at [object Object].<anonymous> (C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-hybrid.js:61:7)
    at done (C:\Users\james\AppData\Roaming\npm\node_modules\appium\node_modules\async\lib\async.js:132:19)
    at C:\Users\james\AppData\Roaming\npm\node_modules\appium\node_modules\async\lib\async.js:32:16
    at [object Object].<anonymous> (C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-hybrid.js:53:9)
    at C:\Users\james\AppData\Roaming\npm\node_modules\appium\lib\devices\android\android-hybrid.js:111:5
    at [object Object].<anonymous> (C:\Users\james\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
    at ChildProcess.exithandler (child_process.js:742:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5) context: [POST /wd/hub/session/2eb40d69-da15-481f-b4a1-3f730a5608f0/context {"name":"WEBVIEW_com.barracuda.ngfirewall.sslvpn.mobileapp"}]
info: Chromedriver: Set chromedriver binary as: C:\Users\james\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
info: Chromedriver: 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 %a))

This is using 5.1.1 Android emulator with Appium 1.4.3.

Also:
npm -v
2.10.1
node -v
v0.12.4

NOTE:: I am able to get the list of contexts without issue.

let me know if you need any more!

Regards
James

Did you configure the following in your view:
setWebContentsDebuggingEnabled(true)

I am getting the same problem. Can anyone please help. ?

Regards,
Nitish

Yes i have enabled this and can inspect it . But the problem is i am getting the same error as mentioned above while running the test cases using appium

This seems to be a regression as it worked on 1.3.7. I have tried swapping out the version of chromedriver being used but that did not work, I reverted back to 1.3.7 and once again i could interact with web view elements. Maybe there has been a change to the required capabilities between the two versions that I am missing?

the capabilities i used are;

{app=D:\\cl\\myapp_Android_MASTER_build_n80.apk, appium-version=1.4.3, platformVersion=5.1.1, automationName=, bundleid=D:\\cl\\myapp_Android_MASTER_build_n80.apk, browserName=, platformName=Android, deviceName=emulator-5554}

Can anyone please tell how to add the chromedriver with appium ?

If i understand you correctly…

For windows just update the chromedriver.exe in \AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win

Sorry but i am using macbook for my android app automation

just tried 1.4.6 that seems to have sorted it :slight_smile:

rapid releases rock!!

@James_Douglas_Robins Hey, man. Can you post your working code?

the code is a bit … integrated, what are you looking for specifically?

I have a problem connecting to chrome-backed webview. It says

     info: [debug] Connecting to chrome-backed webview
info: Chromedriver: Set chromedriver binary as: /home/kacinauskasl/.nvm/versions/node/v0.12.5/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64
info: Chromedriver: Killing any old chromedrivers, running: ps -ef | grep /home/kacinauskasl/.nvm/versions/node/v0.12.5/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64 | grep -v grep |grep -e '--port=9515\(\s.*\)\?$' | awk '{ print $2 }' | xargs kill -15
info: Chromedriver: No old chromedrivers seemed to exist
info: Chromedriver: Spawning chromedriver with: /home/kacinauskasl/.nvm/versions/node/v0.12.5/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64 --url-base=wd/hub --port=9515
error: Chromedriver: Chromedriver exited unexpectedly with code 1, signal null

If I delete chromedriver, i get this error:

info: [debug] Connecting to chrome-backed webview
error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress

I am using linux. Do you provide binary location for chromedriver?

no, i use npm do you? make sure that npm/node/android sdk are all up to date, if they are out of sync you can have problems.