In this StackOverflow posting Bryan Oakley suggested subclassing AppiumLibrary and gave an example of doing so. I’m trying to do this and I can’t seem to get it to work. 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 Bryan and AronS and not now for me?
Thanks, Martin