Unable to find any element using UiSelectors

I am using AppiumDriver and Selendroid for hybrid app. In native context, not able to find any element using uiautomator selectors, because I am getting next error:

Selenium::WebDriver::Error::WebDriverError Exception: unexpected response, code=500, content-type="undefined"

My code (Ruby):

$app_driver.find_element(:uiautomator, 'new UiSelector().text("Notifications")')


info: --> POST /wd/hub/session/e905e901-eb52-5d9a-e864-1662a20734b7/element {"using":"-android uiautomator","value":"new UiSelector().text(\"Notifications\")"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/e905e901-eb52-5d9a-e864-1662a20734b7/element","method":"POST","json":{"using":"-android uiautomator","value":"new UiSelector().text(\"Notifications\")"}}
info: [debug] Proxied response received with status 500: undefined
info: <-- POST /wd/hub/session/e905e901-eb52-5d9a-e864-1662a20734b7/element 500 32.457 ms - -

What version of the appium server are you using?

1.3.1, before was using 1.3.0.

uiselectors are specific to uiautomator. Selendroid doesn’t support them.

How can I execute uiautomator tests using Appium?

The platformName must be Android. I recommend trying the appium ruby console to test out the locators.

Yeah, I have Android set as platformName. I am using byebug debugger :smile:

when using ruby…

irb: d.find_elements :uiautomator, ‘new UiSelector().clickable(true)’
ArgumentError: cannot find elements by :uiautomator
from /Users/GoProVideoSQA/.rvm/gems/ruby-2.1.3/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/search_context.rb:59:in find_elements' from (irb):70 from /Users/GoProVideoSQA/.rvm/rubies/ruby-2.1.3/bin/irb:11:in

nothing happens in Appium logs (obviously)

What am I doing wrong?

appium 1.3.4

1 Like

Within what context are you trying to do that?
Are you using usual Appium or with Selendroid?

ah it would help if I had been using the
Android uiautomator driver used by Appium.

Sometimes you just have to say it out loud to answer your own questions.