Unable switch to Android App Webview if Hybrid app using Crosswalk

I am trying to do an execute_script method in ruby using appium_lib for our Android app. The app is compiled to a Native app where is built from web components (ie, if I examine the app using chrome tools you can see all the css that makes up the pages). When I try to use execute_script I get the following:

 Selenium::WebDriver::Error::UnknownError:
   Not yet implemented. Please help us: http://appium.io/get-involved.html

Is there a way to use execute_script on and Android App when there is no webview?

What function are you trying to accomplish by calling execute_script? We have almost no calls to execute_script because all of those functions exist in ruby for Android, and we make extensive use of native Android apps

I am trying to do this:

driver.execute_script(’$(".navbar-menu").click()’)

Trying this because with the way the app is build (its a cordova built app), its built using html/css, but complies to a native app, yet when I use the appium inspector there are elements it can’t find. But if I use the chrome inspector I can find all the css elements and use jQuery or JS to do things like clicks. Figured that was a good work around but you can’t execute it.

Kinda stumped so was hoping someone might have some ideas. Does that clarify things?

Some more information on this issue. So I have an app that has the following:

android.webkit.WebView,

but it does not have any other contexts besides “Native_app.” Since there is no webview context I cannot execute javascript. However, the elements in the Native_app context aren’t able to be found by the Appium inspector. Just can’t figure out how to access this stuff.

Which version of Android are you running the test on? I think starting with Android KitKat and newer, you have to tell the system that you want to enable debugging for your webviews in the native portion of your application (See here). I’m not too familiar with Cordova, so you’ll have to get more details from someone who knows more about Cordova or do some digging on your own.

After doing more digging I found the root of the problem seem to be related to this: https://github.com/appium/appium/issues/4597#issuecomment-164540456

So I have used this: https://github.com/piotrekkmt/chromedriver-appium

I have updated to this version of chromedriver and now see both Native_APP and Chromium as contexts in the app. However, it doesn’t seem to allow me to switch to the Chromium context.

I do:
driver.set_context(‘CHROMIUM’)

But the server freezes at this point. I get the following error:

 [Chromedriver] Error: An error occurred (Original error: chrome not reachable
 (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS        X 10.11.4 x86_64))
at JWProxy.command$ (lib/proxy.js:139:15)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:104:47)
at /usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:115:28
at flush (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
at nextTickCallbackWith0Args (node.js:415:9)
at process._tickCallback (node.js:344:13)
{ [Error: An error occurred (Original error: chrome not reachable
 (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS   X 10.11.4 x86_64))]
 status: 100,
value: { message: 'chrome not reachable\n  (Driver info: chromedriver=2.21.371459    (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64)' },
 httpCode: 200 }
[MJSONWP] Encountered internal error running command: Error: An error occurred (Original error: chrome not reachable
 (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64))
at JWProxy.command$ (lib/proxy.js:139:15)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:104:47)
at /usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:115:28
at flush (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
at nextTickCallbackWith0Args (node.js:415:9)
at process._tickCallback (node.js:344:13)

any ideas?

Sincerely,