From d5dc40879779cc56f4666f4a04b5daf7735f4eef Mon Sep 17 00:00:00 2001 From: omkarkhatavkar Date: Thu, 5 Nov 2020 20:34:20 +0530 Subject: [PATCH] fixed the modal test --- src/widgetastic_patternfly/__init__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/widgetastic_patternfly/__init__.py b/src/widgetastic_patternfly/__init__.py index de83d77..1e1b862 100644 --- a/src/widgetastic_patternfly/__init__.py +++ b/src/widgetastic_patternfly/__init__.py @@ -1808,14 +1808,17 @@ class Modal(View): def __init__(self, parent, id=None, logger=None): self.id = id - if id: - self.ROOT = ParametrizedLocator( - './/div[normalize-space(@id)={@id|quote} and ' - 'contains(@class, "modal") and contains(@class, "fade") ' - 'and @role="dialog"]') - View.__init__(self, parent, logger=logger) + def __locator__(self): + """If id was passed, parametrize it into a locator, otherwise use ROOT""" + if self.id is not None: + return ('//div[normalize-space(@id)="{}" and contains(@class, "modal")' + 'and contains(@class, "fade") and @role="dialog"]' + .format(self.id)) + else: + return self.ROOT + @property def title(self): return self.header.title.read()