Commit 91c1fa02 by Ben McMorran Committed by cahrens

Restore set_input_value

parent 206e4a95
......@@ -11,7 +11,7 @@ from selenium.webdriver.common.keys import Keys
from .course_page import CoursePage
from .container import ContainerPage
from .utils import set_input_value_and_save, click_css, confirm_prompt
from .utils import set_input_value_and_save, set_input_value, click_css, confirm_prompt
class CourseOutlineItem(object):
......@@ -82,7 +82,7 @@ class CourseOutlineItem(object):
"""
Enters new_name as the item's display name.
"""
set_input_value_and_save(self, self._bounded_selector(self.NAME_INPUT_SELECTOR), new_name)
set_input_value(self, self._bounded_selector(self.NAME_INPUT_SELECTOR), new_name)
def change_name(self, new_name):
"""
......
......@@ -127,15 +127,22 @@ def confirm_prompt(page, cancel=False):
click_css(page, confirmation_button_css, require_notification=(not cancel))
def set_input_value_and_save(page, css, value):
def set_input_value(page, css, value):
"""
Sets the text field with given label (display name) to the specified value, and presses Save.
Sets the text field with the given label (display name) to the specified value.
"""
input_element = page.q(css=css).results[0]
# Click in the input to give it the focus
action = ActionChains(page.browser).click(input_element)
# Delete all of the characters that are currently there
for _x in range(0, len(input_element.get_attribute('value'))):
action = action.send_keys(Keys.BACKSPACE)
# Send the new text, then hit the enter key so that the change event is triggered).
action.send_keys(value).send_keys(Keys.ENTER).perform()
input_element.click()
# Select all, then input the value
input_element.send_keys(Keys.CONTROL + 'a')
input_element.send_keys(value)
# Return the input_element for chaining
return input_element
def set_input_value_and_save(page, css, value):
"""
Sets the text field with given label (display name) to the specified value, and presses Save.
"""
set_input_value(page, css, value).send_keys(Keys.ENTER)
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