Open UI Automation

Widgetastic provides a support of OUIA compatible components. There are three base classes: widgetastic.ouia.OUIAMixin, widgetastic.ouia.OUIAGenericView and widgetastic.ouia.OUIAGenericWidget.

In order to start creating an OUIA compatible widget or view just inherit a respectful class. Children classes must have the same name as the value of data-ouia-component-type attribute of the root HTML element. Besides children classes should define OUIA_NAMESPACE class attribute if it’s appicable.


Consider this html excerpt:

<button data-ouia-component-type="PF/Button" data-ouia-component-id="This is a button">
    This is a button

According to OUIA this is Button component in PF namespace with id This is a button. Basing on that information we can create the following widget:

from widgetastic.ouia import OUIAGenericWidget

class Button(OUIAGenericWidget):

As you can see you don’t need to specify any locator. If a component complies with OUIA spec the locator can be generated. The only argument you may provide is component_id. After that you can add this class to some view and use in automation:

class Details(View):
    ROOT = ".//div[@id='some_id']"
    button = Button("This is a button")

view = Details(browser)