Cordova version 3.6.3-0.2.13 does not work with Appium

I have an Android hybrid app, which uses internally Cordova. My problem is, when we compile our app with with Cordova version 3.6.3-0.2.13, the Appium crashes on error, when I do: driver.driver.find_element_by_xpath(valid_xpath). In appium logs, I see this error:

debug: Responding to client
with error:
{“status”:13,“value”:{“message”:“An unknown
server-side error occurred while processing the command.”,“origValue”:“Did
not successfully proxy server
command”},“sessionId”:“e5a3b0fe-1b82-b93b-09cb-673c114d9052”}

By looking Android SDK monitor, I see this error in the logs:
E/SELENDROID(13597): io.selendroid.util.SelendroidLogger#error:22 - An error occured while configuring the web view: io.selendroid.server.model.SelendroidWebDriver$SelendroidWebChromeClient cannot be cast to org.apache.cordova.CordovaChromeClient

Now when we compile our app with older version of Cordova (3.5.X) all works well. I am just wondering has anyone encountered a similar problem and if they have, how they did resolve the problem?

The detailed description is:

  1. I use python bindings on windows 7 Appium-Python-Client==0.10
  2. I have Appium client 1.2.3.1 installed on my
  3. On python I do this:
    desired_caps = {‘appPackage’: ‘com.mycompany.myApp’,
    ‘appActivity’: ‘.myActivity’,
    ‘platformName’: ‘android’,
    ‘platformVersion’: ‘4.2.2’,
    ‘deviceName’: ‘Samsung’
    }
    remote_server = ‘http://127.0.0.1:4723/wd/hub
    driver = webdriver.Remote(remote_server, desired_caps)
    driver.switch_to.context(‘WEBVIEW_1’)
    driver.driver.find_element_by_xpath(valid_xpath) <= Here is the crash
1 Like

Did finally found a reason for this. There was two different version of selendroid apk installed on the phone (for some odd reason). After uninstalling the all Appium related apk’s from the phone, all did start working like a charm.

Hi,

Could you let me know which locators to use for a Cordova app, as we do not see any resource-id or content-desc provided for elements? Is there anything to be added during app creation using Cordova?

Thanks in advance

Ugh

It is just like in the example detailed description. After one changes to WEBVIEW, one has a normal browser DOM tree available. Because this makes looking the selectors difficult, one can, usually access the URL directly also by using normal desktop browser.

-Tatu

Hi,

When we try to use a WebView context, an error comes up saying “Not yet implemented”. And when printing contexts available we can see only NATIVE_APP context, is anything wrong while app creation? Please help.

Thanks

Ugh

I recall seeing similar error on iOS devices. iOS and android hybrid apps are totally different, at least on my case. And same logic and selectors don’t apply.

For iOS Appium inspector is quite good and when you get that working,seeing selectors is quite easy.

Ok, thank you for replying. One more question is there anything from developers’ end we need to get implemented to work easily with Appium on Cordova applications?

Thanks