diff options
author | Prabhu Ramachandran | 2017-08-24 12:03:56 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2017-08-24 12:03:56 +0530 |
commit | 7e159fff8d802f49d01b3e83bb220f3844271a11 (patch) | |
tree | bb57de0a5c2d7f8013189a58adba7d14ac977e19 /yaksh/live_server_tests/selenium_test.py | |
parent | 6bc86acb799e8ac43f94eb293214f45a549731a8 (diff) | |
parent | 055d0d1c51f90b4496a096a13bab5e4978fe9b92 (diff) | |
download | online_test-7e159fff8d802f49d01b3e83bb220f3844271a11.tar.gz online_test-7e159fff8d802f49d01b3e83bb220f3844271a11.tar.bz2 online_test-7e159fff8d802f49d01b3e83bb220f3844271a11.zip |
Merge branch 'improve-code-server' of github.com:prathamesh920/online_test into improve-code-server
Diffstat (limited to 'yaksh/live_server_tests/selenium_test.py')
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 00e1847..859d032 100644 --- a/yaksh/live_server_tests/selenium_test.py +++ b/yaksh/live_server_tests/selenium_test.py @@ -7,7 +7,23 @@ from selenium.common.exceptions import WebDriverException import multiprocessing import argparse -import time + + +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) + a = element.value_of_css_property("display") == "none" + print(a) + return a + except Exception as e: + print(e) + return False + class SeleniumTestError(Exception): pass @@ -49,11 +65,13 @@ class SeleniumTest(): def submit_answer(self, question_label, answer, loop_count=1): self.driver.implicitly_wait(2) for count in range(loop_count): - time.sleep(15) + print("in") self.driver.find_element_by_link_text(question_label).click() 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 |