Skip to content

Commit 1122835

Browse files
Clean up python form handling tests
1 parent a05085a commit 1122835

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

py/test/selenium/webdriver/common/form_handling_tests.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
from selenium.common.exceptions import NoSuchElementException
2121
from selenium.common.exceptions import WebDriverException
22+
from selenium.webdriver.support import expected_conditions as EC
23+
from selenium.webdriver.support.ui import WebDriverWait
2224

2325

2426
class TestFormHandling(object):
@@ -27,7 +29,6 @@ class TestFormHandling(object):
2729
def testShouldClickOnSubmitInputElements(self, driver, pages):
2830
pages.load("formPage.html")
2931
driver.find_element_by_id("submitButton").click()
30-
driver.implicitly_wait(5)
3132
assert driver.title == "We Arrive Here"
3233

3334
def testClickingOnUnclickableElementsDoesNothing(self, driver, pages):
@@ -37,25 +38,22 @@ def testClickingOnUnclickableElementsDoesNothing(self, driver, pages):
3738
def testShouldBeAbleToClickImageButtons(self, driver, pages):
3839
pages.load("formPage.html")
3940
driver.find_element_by_id("imageButton").click()
40-
driver.implicitly_wait(5)
41-
assert driver.title == "We Arrive Here"
41+
WebDriverWait(driver, 3).until(EC.title_is("We Arrive Here"))
42+
4243

4344
def testShouldBeAbleToSubmitForms(self, driver, pages):
4445
pages.load("formPage.html")
4546
driver.find_element_by_name("login").submit()
46-
driver.implicitly_wait(5)
4747
assert driver.title == "We Arrive Here"
4848

4949
def testShouldSubmitAFormWhenAnyInputElementWithinThatFormIsSubmitted(self, driver, pages):
5050
pages.load("formPage.html")
5151
driver.find_element_by_id("checky").submit()
52-
driver.implicitly_wait(5)
5352
assert driver.title == "We Arrive Here"
5453

5554
def testShouldSubmitAFormWhenAnyElementWihinThatFormIsSubmitted(self, driver, pages):
5655
pages.load("formPage.html")
5756
driver.find_element_by_xpath("//form/p").submit()
58-
driver.implicitly_wait(5)
5957
assert driver.title == "We Arrive Here"
6058

6159
def testShouldNotBeAbleToSubmitAFormThatDoesNotExist(self, driver, pages):

0 commit comments

Comments
 (0)