@@ -161,6 +161,7 @@ def PyPrint(message):
161161
162162class JavascriptExternal :
163163 mainBrowser = None
164+ stringVisitor = None
164165
165166 def __init__ (self , mainBrowser ):
166167 self .mainBrowser = mainBrowser
@@ -206,10 +207,21 @@ def PyCallback(self, *args):
206207 self .mainBrowser .GetMainFrame ().ExecuteJavascript (
207208 "window.alert(\" %s\" )" % message )
208209
210+ def GetSource (self ):
211+ # Must keep a strong reference to the StringVisitor object
212+ # during the visit.
213+ self .stringVisitor = StringVisitor ()
214+ self .mainBrowser .GetMainFrame ().GetSource (self .stringVisitor )
215+
216+ def GetText (self ):
217+ # Must keep a strong reference to the StringVisitor object
218+ # during the visit.
219+ self .stringVisitor = StringVisitor ()
220+ self .mainBrowser .GetMainFrame ().GetText (self .stringVisitor )
221+
209222 # -------------------------------------------------------------------------
210223 # Cookies
211224 # -------------------------------------------------------------------------
212-
213225 cookieVisitor = None
214226
215227 def VisitAllCookies (self ):
@@ -255,6 +267,13 @@ def DeleteCookies(self):
255267 "Created_Via_Python" )
256268 print ("\n Cookie deleted! Visit html-kit cookietester to see the result" )
257269
270+ class StringVisitor :
271+ def Visit (self , string ):
272+ print ("\n StringVisitor.Visit(): string:" )
273+ print ("--------------------------------" )
274+ print (string )
275+ print ("--------------------------------" )
276+
258277class CookieVisitor :
259278 def Visit (self , cookie , count , total , deleteCookie ):
260279 if count == 0 :
0 commit comments