You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With views and ROOT approach, we have a lot of situations when only 1 widget of kind is present in single view. Or different use case - we have widgets, which in 99% cases have the same locator, e.g. some .//div[contains(@class, "progress progress-striped")].
For such cases it's very handy to be able not to specify any locator at all and have some default one used instead:
classMyView(View):
progress=ProgressBar()
But to be able to do that, i have to override widget's __init__ each time with smth like that:
def__init__(self, parent, locator=None, logger=None):
"""Provide common progress bar locator if it wasn't specified."""Widget.__init__(self, parent, logger=logger)
ifnotlocator:
locator='.//div[contains(@class, "progress progress-striped")]'self.locator=locator
It would be really nice to have such ability out of the box.
My suggestion - we could define some class attr for widget, e.g. DEFAULT_LOCATOR and slightly update GenericLocatorWidget with smth like:
With views and ROOT approach, we have a lot of situations when only 1 widget of kind is present in single view. Or different use case - we have widgets, which in 99% cases have the same locator, e.g. some
.//div[contains(@class, "progress progress-striped")]
.For such cases it's very handy to be able not to specify any locator at all and have some default one used instead:
But to be able to do that, i have to override widget's
__init__
each time with smth like that:It would be really nice to have such ability out of the box.
My suggestion - we could define some class attr for widget, e.g.
DEFAULT_LOCATOR
and slightly updateGenericLocatorWidget
with smth like:This way i could optionally specify class attr DEFAULT_LOCATOR for my widget and i wouldn't have to override entire method each time:
Thoughts, other ideas?
The text was updated successfully, but these errors were encountered: