@@ -39,22 +39,22 @@ def throw_sere(driver):
3939def test_should_fail_with_invalid_selector_exception (driver , pages ):
4040 pages .load ("dynamic.html" )
4141 with pytest .raises (InvalidSelectorException ):
42- WebDriverWait (driver , 0.7 ).until (EC .presence_of_element_located ((By .XPATH , "//*[contains(@id,'something'" )))
42+ WebDriverWait (driver , 1 ).until (EC .presence_of_element_located ((By .XPATH , "//*[contains(@id,'something'" )))
4343
4444
4545def test_should_explicitly_wait_for_a_single_element (driver , pages ):
4646 pages .load ("dynamic.html" )
4747 add = driver .find_element (By .ID , "adder" )
4848 add .click ()
49- WebDriverWait (driver , 3 ).until (
49+ WebDriverWait (driver , 5 ).until (
5050 EC .presence_of_element_located ((By .ID , "box0" ))
5151 ) # All is well if this doesn't throw.
5252
5353
5454def test_should_still_fail_to_find_an_element_with_explicit_wait (driver , pages ):
5555 pages .load ("dynamic.html" )
5656 with pytest .raises (TimeoutException ):
57- WebDriverWait (driver , 0.7 ).until (EC .presence_of_element_located ((By .ID , "box0" )))
57+ WebDriverWait (driver , 0.01 ).until (EC .presence_of_element_located ((By .ID , "box0" )))
5858
5959
6060def test_should_explicitly_wait_until_at_least_one_element_is_found_when_searching_for_many (driver , pages ):
@@ -64,14 +64,14 @@ def test_should_explicitly_wait_until_at_least_one_element_is_found_when_searchi
6464 add .click ()
6565 add .click ()
6666
67- elements = WebDriverWait (driver , 3 ).until (EC .presence_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
67+ elements = WebDriverWait (driver , 5 ).until (EC .presence_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
6868 assert len (elements ) >= 1
6969
7070
7171def test_should_fail_to_find_elements_when_explicit_waiting (driver , pages ):
7272 pages .load ("dynamic.html" )
7373 with pytest .raises (TimeoutException ):
74- WebDriverWait (driver , 0.7 ).until (EC .presence_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
74+ WebDriverWait (driver , 0.01 ).until (EC .presence_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
7575
7676
7777def test_should_wait_until_at_least_one_visible_elements_is_found_when_searching_for_many (driver , pages ):
@@ -91,14 +91,14 @@ def __call__(self, driver):
9191 elements = [element for element in driver .find_elements (* self .locator ) if EC ._element_if_visible (element )]
9292 return elements if len (elements ) == 2 else False
9393
94- elements = WebDriverWait (driver , 3 ).until (wait_for_two_elements ((By .CLASS_NAME , "redbox" )))
94+ elements = WebDriverWait (driver , 5 ).until (wait_for_two_elements ((By .CLASS_NAME , "redbox" )))
9595 assert len (elements ) == 2
9696
9797
9898def test_should_fail_to_find_visible_elements_when_explicit_waiting (driver , pages ):
9999 pages .load ("hidden_partially.html" )
100100 with pytest .raises (TimeoutException ):
101- WebDriverWait (driver , 0.7 ).until (EC .visibility_of_any_elements_located ((By .CLASS_NAME , "redbox" )))
101+ WebDriverWait (driver , 0.01 ).until (EC .visibility_of_any_elements_located ((By .CLASS_NAME , "redbox" )))
102102
103103
104104def test_should_wait_until_all_visible_elements_are_found_when_searching_for_many (driver , pages ):
@@ -108,7 +108,7 @@ def test_should_wait_until_all_visible_elements_are_found_when_searching_for_man
108108 add_visible .click ()
109109 add_visible .click ()
110110
111- elements = WebDriverWait (driver , 3 ).until (EC .visibility_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
111+ elements = WebDriverWait (driver , 5 ).until (EC .visibility_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
112112 assert len (elements ) == 2
113113
114114
@@ -120,7 +120,7 @@ def test_should_fail_if_not_all_elements_are_visible(driver, pages):
120120 add_visible .click ()
121121 add_hidden .click ()
122122 with pytest .raises (TimeoutException ):
123- WebDriverWait (driver , 0.7 ).until (EC .visibility_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
123+ WebDriverWait (driver , 0.01 ).until (EC .visibility_of_all_elements_located ((By .CLASS_NAME , "redbox" )))
124124
125125
126126def test_should_wait_only_as_long_as_timeout_specified_when_implicit_waits_are_set (driver , pages ):
@@ -145,44 +145,44 @@ def test_wait_until_not_returns_if_evaluates_to_false(driver, pages):
145145def test_wait_should_still_fail_if_produce_ignored_exception (driver , pages ):
146146 ignored = (InvalidElementStateException , StaleElementReferenceException )
147147 with pytest .raises (TimeoutException ):
148- WebDriverWait (driver , 1 , 0.7 , ignored_exceptions = ignored ).until (throw_sere )
148+ WebDriverWait (driver , 0.01 , ignored_exceptions = ignored ).until (throw_sere )
149149
150150
151151def test_wait_should_still_fail_if_produce_child_of_ignored_exception (driver , pages ):
152152 ignored = WebDriverException
153153 with pytest .raises (TimeoutException ):
154- WebDriverWait (driver , 1 , 0.7 , ignored_exceptions = ignored ).until (throw_sere )
154+ WebDriverWait (driver , 0.01 , ignored_exceptions = ignored ).until (throw_sere )
155155
156156
157157def test_wait_until_not_should_not_fail_if_produce_ignored_exception (driver , pages ):
158158 ignored = (InvalidElementStateException , StaleElementReferenceException )
159- assert WebDriverWait (driver , 1 , 0.7 , ignored_exceptions = ignored ).until_not (throw_sere )
159+ assert WebDriverWait (driver , 0.01 , ignored_exceptions = ignored ).until_not (throw_sere )
160160
161161
162162def test_expected_condition_title_is (driver , pages ):
163163 pages .load ("blank.html" )
164164 WebDriverWait (driver , 1 ).until (EC .title_is ("blank" ))
165165 driver .execute_script ("setTimeout(function(){document.title='not blank'}, 200)" )
166- WebDriverWait (driver , 2 ).until (EC .title_is ("not blank" ))
166+ WebDriverWait (driver , 1 ).until (EC .title_is ("not blank" ))
167167 assert driver .title == "not blank"
168168 with pytest .raises (TimeoutException ):
169- WebDriverWait (driver , 0.7 ).until (EC .title_is ("blank" ))
169+ WebDriverWait (driver , 0.01 ).until (EC .title_is ("blank" ))
170170
171171
172172def test_expected_condition_title_contains (driver , pages ):
173173 pages .load ("blank.html" )
174174 driver .execute_script ("setTimeout(function(){document.title='not blank'}, 200)" )
175- WebDriverWait (driver , 2 ).until (EC .title_contains ("not" ))
175+ WebDriverWait (driver , 1 ).until (EC .title_contains ("not" ))
176176 assert driver .title == "not blank"
177177 with pytest .raises (TimeoutException ):
178- WebDriverWait (driver , 0.7 ).until (EC .title_contains ("blanket" ))
178+ WebDriverWait (driver , 0.01 ).until (EC .title_contains ("blanket" ))
179179
180180
181181@pytest .mark .xfail_safari
182182def test_expected_condition_visibility_of_element_located (driver , pages ):
183183 pages .load ("javascriptPage.html" )
184184 with pytest .raises (TimeoutException ):
185- WebDriverWait (driver , 0.7 ).until (EC .visibility_of_element_located ((By .ID , "clickToHide" )))
185+ WebDriverWait (driver , 0.01 ).until (EC .visibility_of_element_located ((By .ID , "clickToHide" )))
186186 driver .find_element (By .ID , "clickToShow" ).click ()
187187 element = WebDriverWait (driver , 5 ).until (EC .visibility_of_element_located ((By .ID , "clickToHide" )))
188188 assert element .is_displayed () is True
@@ -193,7 +193,7 @@ def test_expected_condition_visibility_of(driver, pages):
193193 pages .load ("javascriptPage.html" )
194194 hidden = driver .find_element (By .ID , "clickToHide" )
195195 with pytest .raises (TimeoutException ):
196- WebDriverWait (driver , 0.7 ).until (EC .visibility_of (hidden ))
196+ WebDriverWait (driver , 0.01 ).until (EC .visibility_of (hidden ))
197197 driver .find_element (By .ID , "clickToShow" ).click ()
198198 element = WebDriverWait (driver , 5 ).until (EC .visibility_of (hidden ))
199199 assert element .is_displayed () is True
@@ -202,35 +202,35 @@ def test_expected_condition_visibility_of(driver, pages):
202202def test_expected_condition_text_to_be_present_in_element (driver , pages ):
203203 pages .load ("booleanAttributes.html" )
204204 with pytest .raises (TimeoutException ):
205- WebDriverWait (driver , 0.7 ).until (EC .text_to_be_present_in_element ((By .ID , "unwrappable" ), "Expected" ))
205+ WebDriverWait (driver , 0.01 ).until (EC .text_to_be_present_in_element ((By .ID , "unwrappable" ), "Expected" ))
206206 driver .execute_script (
207207 "setTimeout(function(){var el = document.getElementById('unwrappable'); el.textContent = el.innerText = 'Unwrappable Expected text'}, 200)"
208208 )
209- WebDriverWait (driver , 2 ).until (EC .text_to_be_present_in_element ((By .ID , "unwrappable" ), "Expected" ))
209+ WebDriverWait (driver , 5 ).until (EC .text_to_be_present_in_element ((By .ID , "unwrappable" ), "Expected" ))
210210 assert "Unwrappable Expected text" == driver .find_element (By .ID , "unwrappable" ).text
211211
212212
213213def test_expected_condition_text_to_be_present_in_element_value (driver , pages ):
214214 pages .load ("booleanAttributes.html" )
215215 with pytest .raises (TimeoutException ):
216- WebDriverWait (driver , 1 ).until (EC .text_to_be_present_in_element_value ((By .ID , "inputRequired" ), "Expected" ))
216+ WebDriverWait (driver , 0.01 ).until (EC .text_to_be_present_in_element_value ((By .ID , "inputRequired" ), "Expected" ))
217217 driver .execute_script (
218218 "setTimeout(function(){document.getElementById('inputRequired').value = 'Example Expected text'}, 200)"
219219 )
220- WebDriverWait (driver , 2 ).until (EC .text_to_be_present_in_element_value ((By .ID , "inputRequired" ), "Expected" ))
220+ WebDriverWait (driver , 5 ).until (EC .text_to_be_present_in_element_value ((By .ID , "inputRequired" ), "Expected" ))
221221 assert "Example Expected text" == driver .find_element (By .ID , "inputRequired" ).get_attribute ("value" )
222222
223223
224224def test_expected_condition_text_to_be_present_in_element_attribute (driver , pages ):
225225 pages .load ("booleanAttributes.html" )
226226 with pytest .raises (TimeoutException ):
227- WebDriverWait (driver , 1 ).until (
227+ WebDriverWait (driver , 0.01 ).until (
228228 EC .text_to_be_present_in_element_attribute ((By .ID , "inputRequired" ), "value" , "Expected" )
229229 )
230230 driver .execute_script (
231231 "setTimeout(function(){document.getElementById('inputRequired').value = 'Example Expected text'}, 200)"
232232 )
233- WebDriverWait (driver , 2 ).until (
233+ WebDriverWait (driver , 5 ).until (
234234 EC .text_to_be_present_in_element_attribute ((By .ID , "inputRequired" ), "value" , "Expected" )
235235 )
236236 assert "Example Expected text" == driver .find_element (By .ID , "inputRequired" ).get_attribute ("value" )
@@ -239,13 +239,13 @@ def test_expected_condition_text_to_be_present_in_element_attribute(driver, page
239239def test_expected_condition_frame_to_be_available_and_switch_to_it_by_locator (driver , pages ):
240240 pages .load ("blank.html" )
241241 with pytest .raises (TimeoutException ):
242- WebDriverWait (driver , 1 ).until (EC .frame_to_be_available_and_switch_to_it ((By .ID , "myFrame" )))
242+ WebDriverWait (driver , 0.01 ).until (EC .frame_to_be_available_and_switch_to_it ((By .ID , "myFrame" )))
243243 driver .execute_script (
244244 "setTimeout(function(){var f = document.createElement('iframe'); f.id='myFrame'; f.src = '"
245245 + pages .url ("iframeWithAlert.html" )
246246 + "'; document.body.appendChild(f)}, 200)"
247247 )
248- WebDriverWait (driver , 2 ).until (EC .frame_to_be_available_and_switch_to_it ((By .ID , "myFrame" )))
248+ WebDriverWait (driver , 5 ).until (EC .frame_to_be_available_and_switch_to_it ((By .ID , "myFrame" )))
249249 assert "click me" == driver .find_element (By .ID , "alertInFrame" ).text
250250
251251
@@ -254,9 +254,9 @@ def test_expected_condition_invisiblity_of_element(driver, pages):
254254 target = driver .find_element (By .ID , "clickToHide" )
255255 driver .execute_script ("delayedShowHide(0, true)" )
256256 with pytest .raises (TimeoutException ):
257- WebDriverWait (driver , 0.7 ).until (EC .invisibility_of_element (target ))
257+ WebDriverWait (driver , 0.01 ).until (EC .invisibility_of_element (target ))
258258 driver .execute_script ("delayedShowHide(200, false)" )
259- element = WebDriverWait (driver , 2 ).until (EC .invisibility_of_element (target ))
259+ element = WebDriverWait (driver , 5 ).until (EC .invisibility_of_element (target ))
260260 assert element .is_displayed () is False
261261 assert target == element
262262
@@ -265,33 +265,33 @@ def test_expected_condition_invisiblity_of_element_located(driver, pages):
265265 pages .load ("javascriptPage.html" )
266266 driver .execute_script ("delayedShowHide(0, true)" )
267267 with pytest .raises (TimeoutException ):
268- WebDriverWait (driver , 0.7 ).until (EC .invisibility_of_element_located ((By .ID , "clickToHide" )))
268+ WebDriverWait (driver , 0.01 ).until (EC .invisibility_of_element_located ((By .ID , "clickToHide" )))
269269 driver .execute_script ("delayedShowHide(200, false)" )
270- element = WebDriverWait (driver , 2 ).until (EC .invisibility_of_element_located ((By .ID , "clickToHide" )))
270+ element = WebDriverWait (driver , 5 ).until (EC .invisibility_of_element_located ((By .ID , "clickToHide" )))
271271 assert element .is_displayed () is False
272272
273273
274274@pytest .mark .xfail_safari
275275def test_expected_condition_element_to_be_clickable (driver , pages ):
276276 pages .load ("javascriptPage.html" )
277277 with pytest .raises (TimeoutException ):
278- WebDriverWait (driver , 0.7 ).until (EC .element_to_be_clickable ((By .ID , "clickToHide" )))
278+ WebDriverWait (driver , 0.01 ).until (EC .element_to_be_clickable ((By .ID , "clickToHide" )))
279279 driver .execute_script ("delayedShowHide(200, true)" )
280- WebDriverWait (driver , 2 ).until (EC .element_to_be_clickable ((By .ID , "clickToHide" )))
280+ WebDriverWait (driver , 5 ).until (EC .element_to_be_clickable ((By .ID , "clickToHide" )))
281281 element = driver .find_element (By .ID , "clickToHide" )
282282 element .click ()
283- WebDriverWait (driver , 4. 5 ).until (EC .invisibility_of_element_located ((By .ID , "clickToHide" )))
283+ WebDriverWait (driver , 5 ).until (EC .invisibility_of_element_located ((By .ID , "clickToHide" )))
284284 assert element .is_displayed () is False
285285
286286
287287def test_expected_condition_staleness_of (driver , pages ):
288288 pages .load ("dynamicallyModifiedPage.html" )
289289 element = driver .find_element (By .ID , "element-to-remove" )
290290 with pytest .raises (TimeoutException ):
291- WebDriverWait (driver , 0.7 ).until (EC .staleness_of (element ))
291+ WebDriverWait (driver , 0.01 ).until (EC .staleness_of (element ))
292292 driver .find_element (By .ID , "buttonDelete" ).click ()
293293 assert "element" == element .text
294- WebDriverWait (driver , 2 ).until (EC .staleness_of (element ))
294+ WebDriverWait (driver , 5 ).until (EC .staleness_of (element ))
295295 with pytest .raises (StaleElementReferenceException ):
296296 element .text
297297
@@ -300,52 +300,52 @@ def test_expected_condition_element_to_be_selected(driver, pages):
300300 pages .load ("formPage.html" )
301301 element = driver .find_element (By .ID , "checky" )
302302 with pytest .raises (TimeoutException ):
303- WebDriverWait (driver , 0.7 ).until (EC .element_to_be_selected (element ))
303+ WebDriverWait (driver , 0.01 ).until (EC .element_to_be_selected (element ))
304304 driver .execute_script ("setTimeout(function(){document.getElementById('checky').checked = true}, 200)" )
305- WebDriverWait (driver , 2 ).until (EC .element_to_be_selected (element ))
305+ WebDriverWait (driver , 5 ).until (EC .element_to_be_selected (element ))
306306 assert element .is_selected () is True
307307
308308
309309def test_expected_condition_element_located_to_be_selected (driver , pages ):
310310 pages .load ("formPage.html" )
311311 element = driver .find_element (By .ID , "checky" )
312312 with pytest .raises (TimeoutException ):
313- WebDriverWait (driver , 0.7 ).until (EC .element_located_to_be_selected ((By .ID , "checky" )))
313+ WebDriverWait (driver , 0.01 ).until (EC .element_located_to_be_selected ((By .ID , "checky" )))
314314 driver .execute_script ("setTimeout(function(){document.getElementById('checky').checked = true}, 200)" )
315- WebDriverWait (driver , 2 ).until (EC .element_located_to_be_selected ((By .ID , "checky" )))
315+ WebDriverWait (driver , 5 ).until (EC .element_located_to_be_selected ((By .ID , "checky" )))
316316 assert element .is_selected () is True
317317
318318
319319def test_expected_condition_element_selection_state_to_be (driver , pages ):
320320 pages .load ("formPage.html" )
321321 element = driver .find_element (By .ID , "checky" )
322- WebDriverWait (driver , 0.7 ).until (EC .element_selection_state_to_be (element , False ))
322+ WebDriverWait (driver , 0.01 ).until (EC .element_selection_state_to_be (element , False ))
323323 assert element .is_selected () is False
324324 with pytest .raises (TimeoutException ):
325- WebDriverWait (driver , 0.7 ).until (EC .element_selection_state_to_be (element , True ))
325+ WebDriverWait (driver , 0.01 ).until (EC .element_selection_state_to_be (element , True ))
326326 driver .execute_script ("setTimeout(function(){document.getElementById('checky').checked = true}, 200)" )
327- WebDriverWait (driver , 2 ).until (EC .element_selection_state_to_be (element , True ))
327+ WebDriverWait (driver , 5 ).until (EC .element_selection_state_to_be (element , True ))
328328 assert element .is_selected () is True
329329
330330
331331def test_expected_condition_element_located_selection_state_to_be (driver , pages ):
332332 pages .load ("formPage.html" )
333333 element = driver .find_element (By .ID , "checky" )
334- WebDriverWait (driver , 0.7 ).until (EC .element_located_selection_state_to_be ((By .ID , "checky" ), False ))
334+ WebDriverWait (driver , 0.01 ).until (EC .element_located_selection_state_to_be ((By .ID , "checky" ), False ))
335335 assert element .is_selected () is False
336336 with pytest .raises (TimeoutException ):
337- WebDriverWait (driver , 0.7 ).until (EC .element_located_selection_state_to_be ((By .ID , "checky" ), True ))
337+ WebDriverWait (driver , 0.01 ).until (EC .element_located_selection_state_to_be ((By .ID , "checky" ), True ))
338338 driver .execute_script ("setTimeout(function(){document.getElementById('checky').checked = true}, 200)" )
339- WebDriverWait (driver , 2 ).until (EC .element_located_selection_state_to_be ((By .ID , "checky" ), True ))
339+ WebDriverWait (driver , 5 ).until (EC .element_located_selection_state_to_be ((By .ID , "checky" ), True ))
340340 assert element .is_selected () is True
341341
342342
343343def test_expected_condition_alert_is_present (driver , pages ):
344344 pages .load ("blank.html" )
345345 with pytest .raises (TimeoutException ):
346- WebDriverWait (driver , 0.7 ).until (EC .alert_is_present ())
346+ WebDriverWait (driver , 0.01 ).until (EC .alert_is_present ())
347347 driver .execute_script ("setTimeout(function(){alert('alerty')}, 200)" )
348- WebDriverWait (driver , 2 ).until (EC .alert_is_present ())
348+ WebDriverWait (driver , 5 ).until (EC .alert_is_present ())
349349 alert = driver .switch_to .alert
350350 assert "alerty" == alert .text
351351 alert .dismiss ()
@@ -354,6 +354,6 @@ def test_expected_condition_alert_is_present(driver, pages):
354354def test_expected_condition_attribute_to_be_include_in_element (driver , pages ):
355355 pages .load ("booleanAttributes.html" )
356356 with pytest .raises (TimeoutException ):
357- WebDriverWait (driver , 1 ).until (EC .element_attribute_to_include ((By .ID , "inputRequired" ), "test" ))
358- value = WebDriverWait (driver , 2 ).until (EC .element_attribute_to_include ((By .ID , "inputRequired" ), "value" ))
357+ WebDriverWait (driver , 0.01 ).until (EC .element_attribute_to_include ((By .ID , "inputRequired" ), "test" ))
358+ value = WebDriverWait (driver , 5 ).until (EC .element_attribute_to_include ((By .ID , "inputRequired" ), "value" ))
359359 assert value is not None
0 commit comments