I want to automate the Android Hybrid app in JavaScript. But not able to open it in webview

I have added all the required capabilities but nothing happens.

autoWebview: true,
setWebContentsDebuggingEnabled: true,

When I use this one in the capabilities, it gives me an error that deriver is not defined.

driver.Contexts().then(function (contexts) { // get list of available views. Returns array: [“NATIVE_APP”,“WEBVIEW_1”]
** return driver.context(contexts[1]); // choose the webview context**
** })**
And after adding this under the seaction I want to open it gives me this error:
TypeError: driver.getContexts(…).then is not a function