Commit 6207de94 by Jesse Zoldak

[fixup] fix quality violations

parent cfe21a70
......@@ -207,13 +207,16 @@ def select_option_by_text(select_browser_query, option_text):
from being raised while the DOM is still being rewritten
"""
def select_option(query, value):
""" Get the first select element that matches the query and select the desired value. """
try:
select = Select(query.first.results[0])
select.select_by_visible_text(value)
return True
except StaleElementReferenceException:
return False
EmptyPromise(lambda: select_option(select_browser_query, option_text), 'Selected option {}'.format(option_text)).fulfill()
msg = 'Selected option {}'.format(option_text)
EmptyPromise(lambda: select_option(select_browser_query, option_text), msg).fulfill()
def get_selected_option_text(select_browser_query):
......@@ -224,8 +227,9 @@ def get_selected_option_text(select_browser_query):
from being raised while the DOM is still being rewritten
"""
def get_option(query):
""" Get the first select element that matches the query and return its value. """
try:
select = Select(select_browser_query.first.results[0])
select = Select(query.first.results[0])
return (True, select.first_selected_option.text)
except StaleElementReferenceException:
return (False, None)
......@@ -233,6 +237,7 @@ def get_selected_option_text(select_browser_query):
text = Promise(lambda: get_option(select_browser_query), 'Retrieved selected option text').fulfill()
return text
def get_options(select_browser_query):
"""
Returns all the options for the given select.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment