diff options
Diffstat (limited to 'yaksh/live_server_tests/selenium_test.py')
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index bc400fd..31efcac 100644 --- a/yaksh/live_server_tests/selenium_test.py +++ b/yaksh/live_server_tests/selenium_test.py @@ -8,6 +8,20 @@ from selenium.common.exceptions import WebDriverException import multiprocessing import argparse + +class ElementDisplay(object): + '''Custom expected condition ''' + def __init__(self, locator): + self.locator = locator + + def __call__(self, driver): + try: + element = EC._find_element(driver, self.locator) + return element.value_of_css_property("display") == "none" + except Exception as e: + return False + + class SeleniumTestError(Exception): pass @@ -53,6 +67,8 @@ class SeleniumTest(): submit_answer_elem = self.driver.find_element_by_id("check") self.driver.execute_script('global_editor.editor.setValue({});'.format(answer)) submit_answer_elem.click() + WebDriverWait(self.driver, 90).until(ElementDisplay( + (By.XPATH, "//*[@id='ontop']"))) def test_c_question(self, question_label): # Incorrect Answer |