Skip to content

Commit

Permalink
Add NoSuchElementException handling back into FlashMessages.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpapaioa committed Mar 5, 2020
1 parent 9730981 commit 6274acf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/widgetastic_patternfly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ def select_by_visible_text(self, *items):
self.logger.info('selecting by visible text: %r', item)
try:
self.browser.click(self.BY_VISIBLE_TEXT.format(quote(item)),
parent=self, force_scroll=True)
parent=self, force_scroll=True)
except NoSuchElementException:
try:
# Added this as for some views(some tags pages) dropdown is separated from
Expand Down Expand Up @@ -2818,7 +2818,12 @@ def __getitem__(self, msg_filter):

@property
def msg_count(self):
return len(self.browser.elements(self.MSG_LOCATOR, parent=self))
c = 0
try:
c = len(self.browser.elements(self.MSG_LOCATOR, parent=self))
except NoSuchElementException:
pass
return c

def messages(self, **msg_filter):
"""Return a generator for all notifications matching the msg_filter.
Expand Down

0 comments on commit 6274acf

Please sign in to comment.