Пример #1
0
 def step_NavigateSearch(self):
     with timed.measure("%s, is navigating to search page."%(self.username)) as t:
         r = self.browser.click_link(text="Search")
         s = self.browser.open(r)
         
         cc.traffRec(wai(), len(s.read()))
         cc.rec(wai(), t)
Пример #2
0
    def step_SearchForFolder(self):
        with timed.measure("%s, is searching for root folder."%(self.username)) as t:
            self.browser.select_form(nr=0)
            self.browser['criteria'] = self.ssInfo[0][self.ssHeader.index('FOLDER')]
            r = self.browser.submit()

            cc.traffRec(wai(), len(r.read()))
            cc.rec(wai(), t)
 def step_Navigate(self, page, url):
     with timed.measure('%s, Navigating to %s.'%(self.username, page)) as t:
         try:
             r = self.browser.open(url)
             
             traffRec(wai(), len(r.read()))
         except: print "%s is moving on."
         rec(wai(), t)
Пример #4
0
 def step_NavigateRootFolder(self):
     with timed.measure("%s, is navigating to root folder."%(self.username)) as t:
         try:
             r = self.browser.click_link(text=self.ssInfo[0][self.ssHeader.index('FOLDER')])
             s = self.browser.open(r)
             
             cc.traffRec(wai(), len(s.read()))
         except: cc.errorRec("Couldn't find root folder in search results.")
         
         cc.rec(wai(), t)
 def step_Search(self, criteria):
     with timed.measure("%s, Searching for '%s'."%(self.username, criteria)) as t:
         self.browser.open(self.up["URI_search"])
         try:
             self.browser.select_form(nr=0)
             self.browser['criteria'] = criteria
             r = self.browser.submit()
             
             traffRec(wai(), len(r.read()))
         except: pass
         rec(wai(), t)
Пример #6
0
 def step_NavigateDocumentProfile(self):
     line = random.choice(self.ssInfo)
     doc = line[self.ssHeader.index('DOCUMENT NAME')]
     with timed.measure('%s, is navigating to %s profile page.'%(self.username, doc)) as t:
         try:
             r = self.browser.click_link(text=doc)
             s = self.browser.open(r)
             
             cc.traffRec(wai(), len(s.rread()))
         except: cc.errorRec("%s couldn't find expected document."%(self.username))
 
         cc.rec(wai(), t)
Пример #7
0
    def step_UploadFile(self, uploadFile):
        filename = uploadFile.split("\\")[-1]
        fsize = int(os.path.getsize(uploadFile))
        with timed.measure('%s, Uploading file %s.'%(self.username, filename)) as t:
            try:
                self.browser.select_form(nr=0)            
                self.browser.find_control("doc").readonly = False
                self.browser.form.add_file(open(uploadFile, "rb"), "", filename)
                r = self.browser.submit()

                cc.traffRec(wai(), fsize, False) #record to upload traffic
                cc.traffRec(wai(), len(r.read()))
            except: pass
            cc.rec(wai(), t)
Пример #8
0
 def step_DownloadDocument(self):
     with timed.measure('%s, is downloading document.'%(self.username)) as t:
         try:
             #determine file extension listed on the current page
             fileExtension = re.search('File extension:</span> <b>.(\w+)</b>', self.browser.response().read()).groups()[0]
             
             r = self.browser.click_link(text='Download')
             self.browser.open(r)
             a = self.browser.response().read()
 
             cc.traffRec(wai(), len(a))
             
             with open('%s\\%s.%s'%(tempFilesFolder, str(uuid.uuid4()), fileExtension), 'wb') as f:
                 f.write(a)    
         except: cc.errorRec("%s couldn't find download link in doc profile."%(self.username))
         
         cc.rec(wai(), t)
Пример #9
0
 def step_Login(self):
     def getServer(page):
         return filter(lambda x: "Patents" in x, page.split("</span>"))[0].split("(")[-1].strip(")")
     
     with timed.measure('%s, Logging in to netdocuments.'%(self.username)) as t:
         r = self.browser.open(self.up["URI_home"])
         s = r.read()
         cc.traffRec(wai(), len(s))
         cc.recServ(getServer(s))
         
         self.browser.select_form(name='loginform')
         self.browser['username'] = self.username
         self.browser['password'] = self.password
         r = self.browser.submit()
         
         cc.traffRec(wai(), len(r.read()))
         cc.rec(wai(), t)
Пример #10
0
 def step_Logout(self):
     with timed.measure("%s, is logging out."%(self.username)) as t:
         r = self.browser.open(self.up["URI_logout"])
         
         cc.traffRec(wai(), len(r.read()))
         cc.rec(wai(), t)
Пример #11
0
 def step_NavigateCabinetUpload(self):
     with timed.measure("%s, is navigating to cabinet upload page."%(self.username)) as t:
         r = self.browser.open(self.up["URI_cabUpload"] + self.cabID)
         
         cc.traffRec(wai(), len(r.read()))
         cc.rec(wai(), t)