Commit fced72e4 by Jay Zoldak

Merge pull request #4557 from edx/zoldak/remove-action-chains

Use clear and send_keys instead of action chains in page object methods
parents 79945533 cac47598
from bok_choy.page_object import PageObject from bok_choy.page_object import PageObject
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from utils import click_css from utils import click_css
from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import Select
...@@ -57,12 +56,12 @@ class ComponentEditorView(PageObject): ...@@ -57,12 +56,12 @@ class ComponentEditorView(PageObject):
Sets the text field with given label (display name) to the specified value, and presses Save. Sets the text field with given label (display name) to the specified value, and presses Save.
""" """
elem = self.get_setting_element(label) elem = self.get_setting_element(label)
# Click in the field, delete the value there.
action = ActionChains(self.browser).click(elem) # Clear the current value, set the new one, then
for _x in range(0, len(elem.get_attribute('value'))): # Tab to move to the next field (so change event is triggered).
action = action.send_keys(Keys.BACKSPACE) elem.clear()
# Send the new text, then Tab to move to the next field (so change event is triggered). elem.send_keys(value)
action.send_keys(value).send_keys(Keys.TAB).perform() elem.send_keys(Keys.TAB)
self.save() self.save()
def set_select_value_and_save(self, label, value): def set_select_value_and_save(self, label, value):
......
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