@@ -2941,6 +2941,37 @@ def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
2941
2941
return page_actions .wait_for_element_visible (
2942
2942
self .driver , selector , by , timeout )
2943
2943
2944
+ def wait_for_element_not_present (self , selector , by = By .CSS_SELECTOR ,
2945
+ timeout = None ):
2946
+ """ Same as self.wait_for_element_absent()
2947
+ Waits for an element to no longer appear in the HTML of a page.
2948
+ A hidden element still counts as appearing in the page HTML.
2949
+ If an element with "hidden" status is acceptable,
2950
+ use wait_for_element_not_visible() instead. """
2951
+ if not timeout :
2952
+ timeout = settings .LARGE_TIMEOUT
2953
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
2954
+ timeout = self .__get_new_timeout (timeout )
2955
+ selector , by = self .__recalculate_selector (selector , by )
2956
+ return page_actions .wait_for_element_absent (
2957
+ self .driver , selector , by , timeout )
2958
+
2959
+ def assert_element_not_present (self , selector , by = By .CSS_SELECTOR ,
2960
+ timeout = None ):
2961
+ """ Same as self.assert_element_absent()
2962
+ Will raise an exception if the element stays present.
2963
+ Returns True if successful. Default timeout = SMALL_TIMEOUT. """
2964
+ if not timeout :
2965
+ timeout = settings .SMALL_TIMEOUT
2966
+ if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
2967
+ timeout = self .__get_new_timeout (timeout )
2968
+ self .wait_for_element_absent (selector , by = by , timeout = timeout )
2969
+ return True
2970
+
2971
+ def wait (self , seconds ):
2972
+ """ Same as sleep() - Some JS frameworks use this method name. """
2973
+ self .sleep (seconds )
2974
+
2944
2975
def _print (self , msg ):
2945
2976
print (msg )
2946
2977
0 commit comments