Skip to content

Commit f0dd98c

Browse files
authored
Merge pull request #580 from diemol/remove-flaky-test
Replacing flaky test in new test suite
2 parents 1a2c03d + 83df320 commit f0dd98c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/SeleniumTests/__init__.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@ def test_with_frames(self):
1616
driver.switch_to.frame('frame-middle')
1717
self.assertTrue(driver.find_element_by_id('content').text == "MIDDLE", "content should be MIDDLE")
1818

19-
# https://github.com/tourdedave/elemental-selenium-tips/blob/master/04-work-with-multiple-windows/python/windows.py
20-
def test_with_windows(self):
19+
# https://github.com/tourdedave/elemental-selenium-tips/blob/master/05-select-from-a-dropdown/python/dropdown.py
20+
def test_select_from_a_dropdown(self):
2121
driver = self.driver
22-
driver.get('http://the-internet.herokuapp.com/windows')
23-
driver.find_element_by_css_selector('.example a').click()
24-
driver.switch_to_window(driver.window_handles[0])
25-
self.assertTrue(driver.title != "New Window", "title should not be New Window")
26-
driver.switch_to_window(driver.window_handles[-1])
27-
self.assertTrue(driver.title == "New Window", "title should be New Window")
22+
driver.get('http://the-internet.herokuapp.com/dropdown')
23+
dropdown_list = driver.find_element_by_id('dropdown')
24+
options = dropdown_list.find_elements_by_tag_name('option')
25+
for opt in options:
26+
if opt.text == 'Option 1':
27+
opt.click()
28+
break
29+
for opt in options:
30+
if opt.is_selected():
31+
selected_option = opt.text
32+
break
33+
self.assertTrue(selected_option == 'Option 1', "Selected option should be Option 1")
2834

2935
# https://github.com/tourdedave/elemental-selenium-tips/blob/master/13-work-with-basic-auth/python/basic_auth_1.py
3036
def test_visit_basic_auth_secured_page(self):

0 commit comments

Comments
 (0)