Selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selector

Hi guys!

I’m really get stuck with the trivial thing. I’m trying to execute the simplest operation for my mobile app like:

 el = driver.find_element_by_class_name("android.widget.Button")

or

 el = driver.find_element_by_name("Add Contact")

or

 el = driver.find_element_by_id("com.example.android.contactmanager:id/addContactButton")

But neither of them work. I’m always receiving Invalid locator strategy: css selector
Here is full traceback:

  File "C:/Users/admin/PycharmProjects/automation-mobile/sample-code/examples/python/first_test.py", line 30, in <module>
     el = driver.find_element_by_class_name("android.widget.Button")
  File "C:\Python34\lib\site-packages\selenium-2.46.1-py3.4.egg\selenium\webdriver\remote\webdriver.py", line 370, in find_element_by_class_name
     return self.find_element(by=By.CLASS_NAME, value=name)
  File "C:\Python34\lib\site-packages\selenium-2.46.1-py3.4.egg\selenium\webdriver\remote\webdriver.py", line 692, in find_element
     {'using': by, 'value': value})['value']
  File "C:\Python34\lib\site-packages\selenium-2.46.1-py3.4.egg\selenium\webdriver\remote\webdriver.py", line 193, in execute
     self.error_handler.check_response(response)
  File "C:\Python34\lib\site-packages\appium_python_client-0.17-py3.4.egg\appium\webdriver\errorhandler.py", line 29, in check_response
  File "C:\Python34\lib\site-packages\appium_python_client-0.17-py3.4.egg\appium\webdriver\errorhandler.py", line 24, in check_response
  File "C:\Python34\lib\site-packages\selenium-2.46.1-py3.4.egg\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
     raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selector

I’m looking into selenium\webdriver\remote\webdriver.py and wondering that by locator strategy is always assigned to By.CSS_SELECTOR value:

def find_element(self, by=By.ID, value=None):
    
    if not By.is_valid(by) or not isinstance(value, str):
        raise InvalidSelectorException("Invalid locator values passed in")
    if by == By.ID:
        by = By.CSS_SELECTOR
        value = '[id="%s"]' % value
    elif by == By.TAG_NAME:
        by = By.CSS_SELECTOR
    elif by == By.CLASS_NAME:
        by = By.CSS_SELECTOR
        value = ".%s" % value
    elif by == By.NAME:
        by = By.CSS_SELECTOR
        value = '[name="%s"]' % value
    return self.execute(Command.FIND_ELEMENT,
                         {'using': by, 'value': value})['value']

I’m using Appium 1.4.0.0 for Windows and latest Appium-Python-Client binding 0.17.
I would appreciate any assistance, really don’t know what to do.

Cheers,
Alex