@@ -437,13 +437,16 @@ def get_current_url(self):
437437        return  self .driver .current_url 
438438
439439    def  get_page_source (self ):
440+         self .wait_for_ready_state_complete ()
440441        return  self .driver .page_source 
441442
442443    def  get_page_title (self ):
444+         self .wait_for_ready_state_complete ()
443445        return  self .driver .title 
444446
445447    def  get_title (self ):
446448        """ The shorter version of self.get_page_title() """ 
449+         self .wait_for_ready_state_complete ()
447450        return  self .driver .title 
448451
449452    def  go_back (self ):
@@ -2065,6 +2068,19 @@ def wait_for_text_visible(self, text, selector="html", by=By.CSS_SELECTOR,
20652068        return  page_actions .wait_for_text_visible (
20662069            self .driver , text , selector , by , timeout )
20672070
2071+     def  wait_for_exact_text_visible (self , text , selector = "html" ,
2072+                                     by = By .CSS_SELECTOR ,
2073+                                     timeout = settings .LARGE_TIMEOUT ):
2074+         if  self .timeout_multiplier  and  timeout  ==  settings .LARGE_TIMEOUT :
2075+             timeout  =  self .__get_new_timeout (timeout )
2076+         if  page_utils .is_xpath_selector (selector ):
2077+             by  =  By .XPATH 
2078+         if  page_utils .is_link_text_selector (selector ):
2079+             selector  =  page_utils .get_link_text_from_selector (selector )
2080+             by  =  By .LINK_TEXT 
2081+         return  page_actions .wait_for_exact_text_visible (
2082+             self .driver , text , selector , by , timeout )
2083+ 
20682084    def  wait_for_text (self , text , selector = "html" , by = By .CSS_SELECTOR ,
20692085                      timeout = settings .LARGE_TIMEOUT ):
20702086        """ The shorter version of wait_for_text_visible() """ 
@@ -2108,6 +2124,29 @@ def assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
21082124            self .__highlight_with_assert_success (messenger_post , selector , by )
21092125        return  True 
21102126
2127+     def  assert_exact_text (self , text , selector = "html" , by = By .CSS_SELECTOR ,
2128+                           timeout = settings .SMALL_TIMEOUT ):
2129+         """ Similar to assert_text(), but the text must be exact, rather than 
2130+             exist as a subset of the full text. 
2131+             (Extra whitespace at the beginning or the end doesn't count.) 
2132+             Raises an exception if the element or the text is not found. 
2133+             Returns True if successful. Default timeout = SMALL_TIMEOUT. """ 
2134+         if  self .timeout_multiplier  and  timeout  ==  settings .SMALL_TIMEOUT :
2135+             timeout  =  self .__get_new_timeout (timeout )
2136+         self .wait_for_exact_text_visible (
2137+             text , selector , by = by , timeout = timeout )
2138+ 
2139+         if  self .demo_mode :
2140+             if  page_utils .is_xpath_selector (selector ):
2141+                 by  =  By .XPATH 
2142+             if  page_utils .is_link_text_selector (selector ):
2143+                 selector  =  page_utils .get_link_text_from_selector (selector )
2144+                 by  =  By .LINK_TEXT 
2145+             messenger_post  =  ("ASSERT TEXT {%s} in %s: %s" 
2146+                               %  (text , by , selector ))
2147+             self .__highlight_with_assert_success (messenger_post , selector , by )
2148+         return  True 
2149+ 
21112150    # For backwards compatibility, earlier method names of the next 
21122151    # four methods have remained even though they do the same thing, 
21132152    # with the exception of assert_*, which won't return the element, 
0 commit comments