TA的每日心情 | 奋斗 2017-7-20 15:47 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
用python写了一段自动化脚本,在循环的时候报ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。错误,第一次执行没有问题,就是不能循环,求个大神解答下,代码如下:
from selenium import webdriver
from selenium.webdriver.support.ui import Select
#import shenpiliu
import time
import bs4
import csv
import re
import xlrd
# xpath路径
file = 'C:\\Users\Administrator\Desktop\\2.xlsx'
data = xlrd.open_workbook(file)
table = data.sheets()[0]
i = 1
for p in range(table.nrows-1):
Driver = webdriver.Chrome()
import GeneralMethod
GM = GeneralMethod
x = 0
HT_data = table.row_values(i)
xpathName = '//*[@class="form-control"]'
xpathPwd = '//*[@type="password"]'
xpathid = "W2BtnLogin"
url1 = "http://60.12.232.90:8002/##_TAB"
url2 = "http://60.12.232.90:8004/workflow/task?TaskId=S0629137fcf5c6b93b6298338f25a8c&ProcessName=%E5%90%88%E5%90%8C%E5%AE%A1%E6%89%B9%E5%8D%95&ProcessVersion=1&FetchDraft=1"
user = "00019974"
HTDLeiXuanZe = '//div[@id="ConnectInfo"]//tr[2]/td[1]//span[@class="l-btn-left"]' # 合同大类选择
HTZLeiXuanZe = '//div[@id="ConnectInfo"]//tr[2]/td[2]//span[@class="l-btn-left"]' # 合同中类选择
HTXLeiXuanZe = '//div[@id="ConnectInfo"]//tr[2]/td[3]//span[@class="l-btn-left"]' # 合同小类选择
frame1 = "ifSYS_FORM"
HTMChengID = "_easyui_textbox_input9"
HT_Start_dateID = "_easyui_textbox_input36"
HT__End_dateID = "_easyui_textbox_input37"
HTKS_Xuanze = '//span[text()="合同开始日期"]/../div/span/span'
HTKSdate = '//div[@class="panel combo-p"][2]/div//tr//a[text()="今天"]'
HTJS_Xuanze = '//span[text()="合同结束日期"]/../div/span/span'
HTJSdate = '/html/body/div[3]/div/div[2]/table/tbody/tr/td[1]/a'
HT_JinE_ID = "_easyui_textbox_input25"
WFMC_xpath = '//span[text()="我方名称"]/..//span[text()="选择"]'
# 数据维护
HTDL = "收"
HTZL = "销售合同"
HTXL = "销售合同"
HTMC = "加盟合同1"
HTJE = 100000
fujian = 'C:\\Users\Administrator\Desktop\\1.docx'
DengLu = GM.Log_in(HT_data[0],url1,url2)
time.sleep(2)
GM.iframe_qiehuan_id('ifSYS_FORM')
GM.xuanze_click(HTDLeiXuanZe,HT_data[1],1)
GM.xuanze_click(HTZLeiXuanZe,HT_data[2],2)
GM.xuanze_click(HTXLeiXuanZe,HT_data[3],2)
GM.alert() # alert弹出框处理
GM.ID_text(HTMChengID,HT_data[4])
GM.Date_XuanZe(HTKS_Xuanze,HTKSdate)
GM.Date_XuanZe(HTJS_Xuanze,HTJSdate)
GM.ID_text(HT_JinE_ID,str(HT_data[5]))
GM.xuanze_click(WFMC_xpath,'',1)
GM.xuanze_click('//*[@id="CompanyDetailInfo"]/table/tbody/tr[2]/td[1]/div[1]/div/span/a/span/span','',2)
GM.ID_text('_easyui_textbox_input38',HT_data[6])
GM.ID_text('_easyui_textbox_input40',HT_data[7])
GM.ID_text('_easyui_textbox_input41',HT_data[8])
GM.ID_text('_easyui_textbox_input20',HT_data[9])
GM.ID_text('_easyui_textbox_input39',str(HT_data[10]))
GM.ID_text('_easyui_textbox_input22',str(HT_data[11]))
GM.ID_text('_easyui_textbox_input23',str(HT_data[12]))
GM.DianJi('//*[@id="nnfegRentPaymentDetail-toolbar"]/a[1]/span/span[1]')
GM.xuanze_click('//*[@id="divDetails1"]/tbody/tr[2]/td[1]/div[1]/div/span/a/span/span',HT_data[13],1)
GM.Date_XuanZe('//*[@id="divDetails1"]/tbody/tr[2]/td[2]/div/div/span/span/a','/html/body/div[4]/div/div[2]/table/tbody/tr/td[1]/a')
GM.Date_XuanZe('//*[@id="divDetails1"]/tbody/tr[2]/td[3]/div/div/span/span/a','/html/body/div[5]/div/div[2]/table/tbody/tr/td[1]/a')
GM.Date_XuanZe('//*[@id="divDetails1"]/tbody/tr[3]/td[1]/div/div/span/span/a','/html/body/div[6]/div/div[2]/table/tbody/tr/td[1]/a')
GM.ID_text('_easyui_textbox_input26',str(HT_data[14]))
GM.ID_text('_easyui_textbox_input27',str(HT_data[15]))
GM.ID_text('_easyui_textbox_input28',str(HT_data[16]))
GM.DianJi('//*[@id="nnfegRentPaymentDetail-dialog-buttons"]/a[1]/span/span[1]')
GM.xpath_text('//*[@id="ctl00_ContentPlaceHolder1_realContactFile"]//input',fujian)
GM.xpath_text('//*[@id="ctl00_ContentPlaceHolder1_realIDCardFiles"]/div/div[1]/a[2]//input','C:\\Users\Administrator\Desktop\\QQ截图20180627142856.png')
GM.xpath_text('//*[@id="ctl00_ContentPlaceHolder1_realLicenseFile"]//input','C:\\Users\Administrator\Desktop\\QQ截图20180627142856.png')
GM.xpath_text('//*[@id="ctl00_ContentPlaceHolder1_realTrusteeFile"]//input','C:\\Users\Administrator\Desktop\\QQ截图20180627142856.png')
GM.xpath_text('//*[@id="ctl00_ContentPlaceHolder1_realPropertyFile"]//input','C:\\Users\Administrator\Desktop\\QQ截图20180627142856.png')
GM.SQR_TiJiao("")
time.sleep(3)
user1 = GM.RWQD()
GM.To_quit()
time.sleep(30)
continue
|
|