Skip to content

Commit

Permalink
Merge pull request #111 from digitronik/texinput_warnning
Browse files Browse the repository at this point in the history
warning property for Input
  • Loading branch information
mshriver committed Nov 15, 2019
2 parents 697a09d + 2cd12f4 commit 8553b34
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/widgetastic_patternfly/__init__.py
Expand Up @@ -219,16 +219,27 @@ class Input(TextInput):
Has some additional methods.
"""
WARNING_LOCATOR = "./following-sibling::div"
HELP_BLOCK_LOCATOR = "./following-sibling::span"

@property
def help_block(self):
e = self.browser.element(self)
try:
help_block = self.browser.element('./following-sibling::span', parent=e)
help_block = self.browser.element(self.HELP_BLOCK_LOCATOR, parent=e)
except NoSuchElementException:
return None
else:
return self.browser.text(help_block)

@property
def warning(self):
try:
self.browser.wait_for_element(self.WARNING_LOCATOR, timeout=3)
return self.browser.text(self.WARNING_LOCATOR)
except NoSuchElementException:
return None


class FlashMessages(Widget):
"""Represents the block of flash messages."""
Expand Down

0 comments on commit 8553b34

Please sign in to comment.