Example #1
0
    def search (self, key_word):
        mybrowser.go( self.base_url )

        #Silent Mode default True'
        if self.silent:
            mybrowser.redirect_error("/dev/null")       
            mybrowser.redirect_output("/dev/null")
        try:    
            mybrowser.formclear("1")#reset For first Form
            mybrowser.fv("1", "q", key_word) #change First Form with Key Word
            mybrowser.submit("btnG") #Click Search in Google not
            print "Request Finished"
        except HTTPError, httpe:
            print "\nError: %s\n%s\n%s" % (httpe.code, httpe.msg, httpe.__doc__)
Example #2
0
 def __init__ ( self ):
     #self.base_url     = "http://www.webcamps.com.br/"
     #self.base_url     = "http://localhost"
     self.base_url     = "http://www.scarpan.com.br"
     self.links   = []
     self.visited = ["%s/" % self.base_url]
     browsers = ["webdriver.firefox", "webdriver.chrome", "zope.testbrowser"]
     self.browser =  Browser(browsers[randint(0,2)])
     #Redirect Messages
     firefox.redirect_error("/tmp/twill.err")
     firefox.redirect_output("/tmp/twill.out")  
     firefox.go( self.base_url )
     self.browser.visit( self.base_url )
     self.extractAllLinks ( firefox.showlinks() )
     self.visitAllLinks()