Skip to content

Commit

Permalink
Merge pull request #118 from tpapaioa/flashmessages_msg_count_fix
Browse files Browse the repository at this point in the history
[RFR] Add NoSuchElementException handling back into FlashMessages.
  • Loading branch information
mshriver authored Mar 5, 2020
2 parents 9730981 + 6274acf commit 4b32fa7
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 4b32fa7

Please sign in to comment.