Why can’t I sub-class AppiumLibrary in Python?

    I’m trying to create a custom library sub-classed from AppiumLibrary, as was suggested in an answer to this question, but it doesn’t seem to work. It somehow doesn’t expose the KW methods of the AppiumLibrary class in my derived class. For example:

    ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
    Python 2.7.2 (default, Jun 24 2011, 12:20:15)
    [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
    Type “help”, “copyright”, “credits” or “license” for more information.

    >>> from AppiumLibrary import AppiumLibrary
    >>> class foo(AppiumLibrary):
        pass

    >>> f = foo()
    >>> print f
    <__main__.foo object at 0x102097bd0>
    >>> print f.__dict__

    {‘_running_on_failure_routine’: False, ‘_screenshot_index’: 0, ‘_run_on_failure_keyword’: ‘Capture Page Screenshot’, ‘_element_finder’: <AppiumLibrary.locators.elementfinder.ElementFinder object at 0x1036f7e50>, ‘_timeout_in_secs’: 5.0, ‘_bi’: <robot.libraries.BuiltIn.BuiltIn object at 0x1036f7d50>, ‘_cache’: <AppiumLibrary.utils.applicationcache.ApplicationCache object at 0x1036f7d90>}

    >>> f.OpenApplication()
    Traceback (most recent call last):
    File “<stdin>”, line 1, in <module>
    AttributeError: ‘foo’ object has no attribute ‘OpenApplication’

    Why did this work for AronS, and not for me?

    Add Comment
  • 0 Answer(s)

    Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.