diff --git a/cms/djangoapps/contentstore/features/advanced-settings.py b/cms/djangoapps/contentstore/features/advanced-settings.py index 91daf70718..4ce9421ad3 100644 --- a/cms/djangoapps/contentstore/features/advanced-settings.py +++ b/cms/djangoapps/contentstore/features/advanced-settings.py @@ -1,6 +1,7 @@ from lettuce import world, step from common import * import time +from selenium.common.exceptions import WebDriverException from nose.tools import assert_equal from nose.tools import assert_true @@ -42,7 +43,11 @@ def edit_the_name_of_a_policy_key(step): @step(u'I press the "([^"]*)" notification button$') def press_the_notification_button(step, name): - world.browser.click_link_by_text(name) + try: + world.browser.click_link_by_text(name) + except WebDriverException, e: + css = 'a.%s-button' % name.lower() + css_click_at(css) @step(u'I edit the value of a policy key$') diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 3ad037b5a9..a8da3dc2eb 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -3,6 +3,7 @@ from lettuce.django import django_url from nose.tools import assert_true from nose.tools import assert_equal from selenium.webdriver.support.ui import WebDriverWait +from selenium.common.exceptions import WebDriverException from terrain.factories import UserFactory, RegistrationFactory, UserProfileFactory from terrain.factories import CourseFactory, GroupFactory @@ -95,10 +96,16 @@ def assert_css_with_text(css, text): def css_click(css): ''' - Rather than click in the middle of an element, - click in the upper left + First try to use the regular click method, + but if clicking in the middle of an element + doesn't work it might be that it thinks some other + element is on top of it there so click in the upper left ''' - css_click_at(css) + try: + assert_true(world.browser.is_element_present_by_css(css, 5)) + world.browser.find_by_css(css).first.click() + except WebDriverException, e: + css_click_at(css) def css_click_at(css, x=10, y=10):