Skip to content

Instantly share code, notes, and snippets.

@weissjeffm
Created February 13, 2014 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weissjeffm/8975661 to your computer and use it in GitHub Desktop.
Save weissjeffm/8975661 to your computer and use it in GitHub Desktop.
diff2
diff --git a/cfme/web_ui/flash.py b/cfme/web_ui/flash.py
index bb7c631..0486c4b 100644
--- a/cfme/web_ui/flash.py
+++ b/cfme/web_ui/flash.py
@@ -5,6 +5,7 @@
from cfme.web_ui import Region
from selenium.webdriver.common.by import By
import cfme.fixtures.pytest_selenium as sel
+import itertools
area = Region(locators=
{'message': (By.XPATH, "//div[@id='flash_text_div' or @id='flash_div']//li")})
@@ -42,6 +43,22 @@ def get_messages():
return map(message, sel.elements(area.message))
+def dismiss():
+ """Dismiss the current flash message"""
+ sel.click(area.message)
+
+
+def get_all_message():
+ """Returns a list of all flash messages, (including ones hidden behind
+ the currently showing one, if any). All flash messages will be
+ dismissed."""
+ all_messages = []
+ while sel.is_displayed(area.message):
+ all_messages = all_messages + get_messages()
+ dismiss()
+ return all_messages
+
+
def is_error(message):
""" Checks a given message to see if is an Error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment