def download_orderid_template(self): helper.wait_element_visible(self.driver,*OrderLocator.charge_download_link) order_link = self.driver.find_element(*OrderLocator.charge_download_link) # order_link.click() url = datagen.get_current_dashboard_url()+"/page/download/batch_refund_by_order_id" path = helper.current_path() helper.downloadRemoteFile(url,path+"/chargeid.csv")
def fill_batchPay_csv(self): path = helper.current_path() # batch pay detail information batch_no = get_current_time() current_date = get_current_formatdate() pay_alipay_account = "*****@*****.**" pay_alipay_account_name = u"上海简米网络科技有限公司" sum_amount = "0.1" sum_order = "1" order_number = "1" order_amount = "0.1" recipent_account = "*****@*****.**" recipent_name ="tester" comment = "test batch pay" linenum = 1 f = open(path+"/batchPay.csv",'r') f_written = open(path+"/batchPay_w.csv",'w') for line in f.readlines(): line = line.decode("GB18030") if linenum == 2: newline = batch_no+","+current_date+","+pay_alipay_account+","+pay_alipay_account_name+","+sum_amount+","+sum_order+","+"\n" f_written.write(newline.encode("GB18030")) elif linenum == 4: newline = order_number+","+recipent_account+","+recipent_name+","+order_amount+","+comment+",\n" f_written.write(newline.encode("GB18030")) else: f_written.write(line.encode("GB18030")) linenum = linenum + 1 f.close() f_written.close()
def download_batchPay_csv(self): # download_links = self.driver.find_elements(*OrderLocator.blue_download_links) # for link in download_links: # if link.text == "csv": # link.click() url = datagen.get_current_dashboard_url()+"/page/download/batch_transfer_sample_file?type=csv" path = helper.current_path() helper.downloadRemoteFile(url,path+"/batchPay.csv")
def upload_batchPay_csv(self): helper.wait_element(self.driver,*OrderLocator.batch_pay_upload_Input) file_input = self.driver.find_element(*OrderLocator.batch_pay_upload_Input) self.driver.execute_script("document.getElementById('batch_pay_file').style.display = 'inherit';") helper.save_screen_shot(self.driver,"upload_template") path = helper.current_path()+"/batchPay_w.csv" file_input.send_keys(path) # self.driver.executePhantomJS("var page = this; page.uploadFile('input[type=file]', path);") time.sleep(2)
def upload_template(self): # helper.wait_element_visible(self.driver,*OrderLocator.batch_upload_link) # upload = self.driver.find_element(*OrderLocator.batch_upload_link) #upload.click() helper.wait_element(self.driver,*OrderLocator.batch_upload_input) file_input = self.driver.find_element(*OrderLocator.batch_upload_input) self.driver.execute_script("document.getElementById('upload_test_csv').style.display = 'inherit';") helper.save_screen_shot(self.driver,"upload_template") path = helper.current_path()+"/chargeid.csv" file_input.send_keys(path) #self.driver.executePhantomJS("var page = this; page.uploadFile('input[type=file]', path);") time.sleep(2)
def fill_template(self): path = helper.current_path() file = open(path+"/chargeid.csv",'w') file.truncate() charge_list = GetCharge.GetChargeList_NotRefund(0) for ch in charge_list: file.write(ch) file.write(", 0.10") file.write("\n") file.close()
home_page.check_if_loaded() home_page.click_app("contest") home_page.check_app_loaded() home_page.click_webhooks_link() webhook_page = WebHookPage(self.driver) assert webhook_page.check_page_loaded() webhook_page.delete_all_webhooks() self.driver.quit() if __name__ == "__main__": # 读文件,存入url path = helper.current_path() f = open("./Data/webhook_url.txt", "r") url_queue = Queue.Queue() for line in f.readlines(): if line: line = line.rstrip('\n') url_queue.put(line) #delete all webhooks first delete_all_webhooks() # ThreadPoolSize = settings.QUEUE_SIZE ThreadPoolSize = 3 for i in range(ThreadPoolSize):