def DistributionlinePieSStDay_Fun(self): '''配电线路线损率分段统计结果核对''' #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(2) #点击配电网计算结果分析 self.driver.find_element_by_xpath(self.TheoreticalLineLosscalresultAnalysis_Xpath).click() time.sleep(2) #点击日分析 self.driver.find_element_by_xpath(self.DistributionLineDayAnalysis_Xpath).click() time.sleep(2) #点击配电线路线损率分段统计 self.driver.find_element_by_xpath(self.DistributionlineLossRateSegStatistics_Xpath).click() time.sleep(2) #切换到配电线路线损率分段统计的frame中 self.driver.switch_to.frame(self.DistributionlineLossRateSegStatistics_frame) time.sleep(2) self.driver.implicitly_wait(15) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file=u"C:\\Users\\Admin\Downloads\配电线路线损率分段统计表样一(日).xlsx" self.sheetname="Sheet1" self.Excel=ExcelData(self.data_file,self.sheetname) self.Excel_Data=self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
def DistrictEleQuamoncalcResult_Fun(self): '''400V月电量法计算结果验证''' #点击理论线损 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电线路计算结果查询xpath self.driver.find_element_by_xpath( self.TheoreticalLineLossManualcal_Xpath).click() time.sleep(2) #点击配线月报表 self.driver.find_element_by_xpath( self.DistributionLineMonthlyReport_Xpath).click() time.sleep(2) #点击台区线路线损表 self.driver.find_element_by_xpath( self.LinelossmeterofDistrict_Xpath).click() time.sleep(2) #切换到结果frame self.driver.switch_to_frame(self.DistrictCalcResult_frame) #self.driver.implicitly_wait(30) time.sleep(4) # a=self.driver.find_element_by_id(self.export_id).text # print a #点击导出按钮 self.driver.find_element_by_id(self.export_id).click() time.sleep(5) self.data_path = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\低压台区损耗表报表(月).xls' self.sheetname = u'低压台区损耗表报表(月)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() #return json.dumps(self.ExcelDataa, encoding="UTF-8", ensure_ascii=False) return self.ExcelDataa
def DistributionlineEleQuamoncalcResult_Fun(self): '''620kv月电量法计算结果验证''' #点击理论线损 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电线路计算结果查询xpath self.driver.find_element_by_xpath( self.TheoreticalLineLossManualcal_Xpath).click() time.sleep(2) #点击配线月报表 self.driver.find_element_by_xpath( self.DistributionLineMonthlyReport_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath( self.Linelossmeterofdistributionline_Xpath).click() time.sleep(2) #切换到结果frame self.driver.switch_to_frame(self.DistributionLineCalcResult_frame) self.driver.implicitly_wait(30) #点击导出按钮 self.driver.find_element_by_id(self.Daochu_id).click() time.sleep(10) self.data_path = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\配电线路损耗报表(月).xls' self.sheetname = u'配电线路损耗报表(月)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() #return json.dumps(self.ExcelDataa, encoding="UTF-8", ensure_ascii=False) return self.ExcelDataa '''for i in range(self.BeginNum,self.EndNum):
def DistrictEleQuamonWirecalcResult_Fun(self): # 点击理论线损计算 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) # 点击配电线路计算结果查询 self.driver.find_element_by_xpath(self.TheoreticalLineLossManualcal_Xpath).click() time.sleep(2) # 点击月报表 self.driver.find_element_by_xpath(self.DistributionLineMonthlyReport_Xpath).click() time.sleep(2) # 点击台区线路线损表 self.driver.find_element_by_xpath(self.LinelosswireofDistrict_Xpath).click() time.sleep(2) #切换到结果frame self.driver.switch_to_frame(self.TheoreticalwireResult_frame) time.sleep(5) self.driver.implicitly_wait(30) ##点击电表损耗链接 self.driver.find_element_by_xpath(self.Transformerwire_Xpath).click() time.sleep(5) self.driver.switch_to.parent_frame() ## 跳出当前iframe self.driver.implicitly_wait(10) ##切换到变压器损耗明细结果frame self.driver.switch_to_frame(self.DistrictCalcResult_frame) self.driver.implicitly_wait(30) # 导出按钮id self.driver.find_element_by_id(self.export_id).click() time.sleep(10) self.data_path = u'C:\\Users\\'+GetUsername()+u'\\Downloads\\低压台区导线损耗报表(月).xls' self.sheetname = u'低压台区导线损耗报表(月)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() return self.ExcelDataa
def DistributionlineFlowDayCalcResult_Fun(self): '''潮流精确算法配电线路线损表结果验证''' #点击理论线损 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电网计算结果查询 self.driver.find_element_by_xpath( self.TheoreticalLineLosscalresult_Xpath).click() time.sleep(2) #点击日报表 self.driver.find_element_by_xpath( self.DistributionLineDayReport_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath( self.DistributionlinedaycalcResult_Xpath).click() time.sleep(2) #切换到配电线路线损表的frame中 self.driver.switch_to_frame(self.DistributionlinedaycalcResult_frame) time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(10) self.data_file = u"C:\\Users\\Admin\Downloads\配电线路损耗报表(日).xls" self.sheetname = u"配电线路损耗报表(日)" self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() return self.Excel_Data
def NewtonMethodWholelossDayVoltCalcResult_Fun(self, *args): #点击理论线损 self.driver.find_element_by_id(self.LineLoss_ID).click() time.sleep(1) #点击输电网计算结果查询 self.driver.find_element_by_xpath( self.WholelossCalcResultQuery_Xpath).click() time.sleep(1) #点击日报表 self.driver.find_element_by_xpath(self.DayCalcResult_Xpath).click() time.sleep(1) #点击输电网分压线损表 self.driver.find_element_by_xpath( self.WholelossDayVoltCalcResult_Xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.WholelossDayVoltCalcResultIframe_ID) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\全网分电压损耗报表(日).xls' self.sheetname = u'全网分电压损耗报表(日)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
def NewtonMethodWholeLossAnalysisDayTrans_Fun(self,*args): #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(1) #点击输电网结果分析 self.driver.find_element_by_xpath(self.WholeLossResultAnalysis_xpath).click() time.sleep(1) #点击日分析 self.driver.find_element_by_xpath(self.MonAnalysis_xpath).click() time.sleep(1) #点击输电网综合分析 self.driver.find_element_by_xpath(self.WholeLossAnalysis_xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.WholelossAnalysisIframe_ID) #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击导线追溯链接 self.driver.find_element_by_xpath(self.Trans_xpath).click() time.sleep(5) self.driver.switch_to.parent_frame() #切换Iframe self.driver.switch_to_frame(self.TransIframe_ID) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file=u'C:\\Users\\'+GetUsername()+ u'\\Downloads\\输电网高损变压器分析(日).xls' self.sheetname=u'输电网高损变压器分析(日)' self.Excel=ExcelData(self.data_file,self.sheetname) self.Excel_Data=self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
def TranotherlossmonCalcResult_Fun(self): #进入理论线损模块 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #进入输电网计算结果查询 self.driver.find_element_by_xpath( self.TranotherlossManualcal_Xpath).click() time.sleep(2) #进入月报表 self.driver.find_element_by_xpath( self.TranotherlossmonReport_Xpath).click() time.sleep(2) #进入其他损耗表 self.driver.find_element_by_xpath( self.TranotherlossmonCalcResult_Xpath).click() time.sleep(5) #进入查询frame框 self.driver.switch_to_frame(self.TranotherlossmonCalcResult_frame) time.sleep(3) #点击导出 self.driver.find_element_by_id(self.Daochu_id).click() time.sleep(10) self.data_file = u'C:\\Users\\Admin\Downloads\输电网其他损耗报表(月).xls' self.sheetname = u'输电网其他损耗报表(月)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() return self.Excel_Data
def NewtonMethodAclineMonCalcResult_Fun(self, *args): #点击理论线损 self.driver.find_element_by_id(self.LineLoss_ID).click() time.sleep(1) #点击输电网计算结果查询 self.driver.find_element_by_xpath( self.WholelossCalcResultQuery_Xpath).click() time.sleep(1) #点击月报表 self.driver.find_element_by_xpath(self.MonCalcResult_Xpath).click() time.sleep(1) #点击导线损耗表 self.driver.find_element_by_xpath(self.AclineLossResult_Xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.AclineLossResultIframe_ID) #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\导线损耗月报表.xls' self.sheetname = u'导线损耗月报表' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
def DistributionlineVoluMonthCalcResult_Fun(self): # 点击理论线损树 time.sleep(1) self.driver.find_element_by_id( self.DistributionlineLossTree_id).click() # 点击配电网计算结果查询 time.sleep(1) self.driver.find_element_by_xpath( self.TheoreticalLineLossCalResult_Xpath).click() time.sleep(1) # 点击月报表 self.driver.find_element_by_xpath( self.DistributionLineMonthlyReport_Xpath).click() time.sleep(1) # 点击配电线路线损表 self.driver.find_element_by_xpath( self.LinelossmeterDistributionline_Xpath).click() time.sleep(1) # 切换frame到配电线路线损表frame self.driver.switch_to.frame(self.DistributionLineCalcResult_frame) time.sleep(1) # 点击左下方的导出按钮 self.driver.find_element_by_id(self.Export_id).click() time.sleep(10) #读取导出文件execl内容,生成列表返回 self.ExportExecl = ExcelData( u"C:\\Users\\" + GetUsername() + u"\\Downloads\\配电线路损耗报表(月).xls", u"配电线路损耗报表(月)") return self.ExportExecl.readExcel()
def DistributionlineComAStDay_Fun(self): '''潮流精确算法-配电线路综合分析日报表结果核对''' #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(2) #点击配电网计算结果分析 self.driver.find_element_by_xpath( self.TheoreticalLineLosscalresultAnalysis_Xpath).click() time.sleep(2) #点击日分析 self.driver.find_element_by_xpath( self.DistributionLineDayAnalysis_Xpath).click() time.sleep(2) #点击配电线路综合分析 self.driver.find_element_by_xpath( self.DistributionlinedaycalcAnalysis_Xpath).click() time.sleep(2) #切换到配电线路综合分析的frame中 self.driver.switch_to.frame(self.DistributionlinedaycalcAnalysis_frame) time.sleep(2) self.driver.implicitly_wait(15) #点击查询条件中日期的下拉框 self.driver.find_element_by_css_selector(self.DateDropBox_CSS).click() time.sleep(2) self.driver.find_element_by_css_selector(self.DateDropBox_CSS1).click() time.sleep(2) #切换到日期选择框中的frame cf = self.driver.find_element_by_css_selector(self.Date_frame) self.driver.switch_to.frame(cf) time.sleep(5) #点击日期下拉框年的下拉框 self.driver.find_element_by_id(self.DateYearDropBox_ID).click() time.sleep(2) #选择日期下拉框年中的2015 self.driver.find_element_by_xpath(self.YearSelect2015_Xpath).click() time.sleep(2) #点击日期下拉框代表日的下拉框 self.driver.find_element_by_id(self.DateRepresentativeDay_ID).click() time.sleep(2) #选择日期下拉框代表日中的2015-08-01 self.driver.find_element_by_xpath( self.DateRepresentativeDay20150801_Xpath).click() time.sleep(2) #点击日期下拉框中的确定按钮 self.driver.find_element_by_id(self.DateDropBoxSure_ID).click() time.sleep(2) self.driver.switch_to.parent_frame() ##跳出日期下拉框的frame self.driver.implicitly_wait(10) #点击页面中的查询按钮 self.driver.find_element_by_class_name(self.Query_Class).click() time.sleep(7) #点击左下角的导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u"C:\\Users\\Admin\Downloads\配电线路线损综合分析报表.xls" self.sheetname = u"配电线路线损综合分析报表" self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() return self.Excel_Data
def DistributionlinePieSSubDay_Fun(self): '''配电线路线损率分段变电站追溯统计结果核对''' #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(2) #点击配电网计算结果分析 self.driver.find_element_by_xpath(self.TheoreticalLineLosscalresultAnalysis_Xpath).click() time.sleep(2) #点击日分析 self.driver.find_element_by_xpath(self.DistributionLineDayAnalysis_Xpath).click() time.sleep(2) #点击配电线路线损率分段统计 self.driver.find_element_by_xpath(self.DistributionlineLossRateSegStatistics_Xpath).click() time.sleep(2) #切换到配电线路线损率分段统计的frame中 self.driver.switch_to.frame(self.DistributionlineLossRateSegStatistics_frame) time.sleep(2) self.driver.implicitly_wait(10) #切换到配电线路线损率分段统计查询结果的frame中 self.driver.switch_to.frame(self.DistributionlineLossRateSegStatisticsResult_frame) self.driver.implicitly_wait(10) #点击单位追溯 self.driver.find_element_by_css_selector(self.CompanyRetrospect_css).click() time.sleep(3) self.driver.switch_to.parent_frame() ##跳出结果框的frame time.sleep(5) self.driver.switch_to.default_content() ##跳出最开始的页面frame time.sleep(5) #切换到配电网线损率分段统计追溯报表(分单位日)frame中 self.driver.switch_to.frame(self.CompanyRetrospect_frame) time.sleep(2) self.driver.implicitly_wait(10) #切换到配电网线损率分段统计追溯报表(分单位日)结果frame中 self.driver.switch_to.frame(self.CompanyRetrospectResult_frame) self.driver.implicitly_wait(10) #点击变电站名称追溯 self.driver.find_element_by_link_text(self.SubstationRetrospect_link).click() time.sleep(3) self.driver.switch_to.parent_frame() ##跳出结果框的frame time.sleep(5) self.driver.switch_to.parent_frame() ##跳出分单位的页面frame time.sleep(5) #切换到配电网线损率分段统计追溯报表(分变电站日)frame中 self.driver.switch_to.frame(self.SubstationRetrospectResult_frame) time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file=u"C:\\Users\\Admin\Downloads\配电线路线损率分段统计表样三(日).xlsx" self.sheetname="Sheet1" self.Excel=ExcelData(self.data_file,self.sheetname) self.Excel_Data=self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
def NewtonMethodTransAnalysisMonRetrospect_Fun(self,*args): #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(1) #点击输电网结果分析 self.driver.find_element_by_xpath(self.WholeLossResultAnalysis_xpath).click() time.sleep(1) #点击月分析 self.driver.find_element_by_xpath(self.MonAnalysis_xpath).click() time.sleep(1) #点击变压器经济运行分析 self.driver.find_element_by_xpath(self.TransAnalysis_xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.TransAnalysisIframe_ID) time.sleep(1) #激活月份选择框 self.driver.find_element_by_id(self.Month_ID).click() time.sleep(1) #选择2015 self.driver.find_element_by_xpath(self.Year_xpath).click() time.sleep(1) #选择八月 self.driver.find_element_by_xpath(self.Month_xpath).click() time.sleep(1) #点击确定 self.driver.find_element_by_id(self.ConfirmButton_ID).click() time.sleep(1) #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击重载变追溯链接 self.driver.find_element_by_xpath(self.TransRetrospect_xpath).click() time.sleep(5) self.driver.switch_to.parent_frame() #切换Iframe self.driver.switch_to_frame(self.TransRetrospect_Iframe) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file=u'C:\\Users\\'+GetUsername()+ u'\\Downloads\\输电网变压器损耗明细(月)-重载变.xls' self.sheetname=u'输电网变压器损耗明细(月)-重载变' self.Excel=ExcelData(self.data_file,self.sheetname) self.Excel_Data=self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
class NewtonMethodTransAnalysisDayResult: def __init__(self, driver): #驱动 self.driver = driver #获取页面元素 self.ProjectFilePath = GetProjectFilePath() self.Page_object_file = open( self.ProjectFilePath + "\\Page_object\\Data\\NewtonMethodTransAnalysisDayResult.yaml") self.Page_Data = yaml.load(self.Page_object_file) self.Data = self.Page_Data['NewtonMethodTransAnalysisDayResult'] #线损分析ID self.LineLossAnalysis_ID = self.Data['LineLossAnalysis_ID'] #输电网结果分析ID self.WholeLossResultAnalysis_xpath = self.Data[ 'WholeLossResultAnalysis_xpath'] #日分析ID self.MonAnalysis_xpath = self.Data['MonAnalysis_xpath'] #变压器经济运行分析xpath self.TransAnalysis_xpath = self.Data['TransAnalysis_xpath'] #报表iframe的ID self.TransAnalysisIframe_ID = self.Data['TransAnalysisIframe_ID'] #查询按钮ID self.Query_ID = self.Data['Query_ID'] #导出按钮ID self.Export_ID = self.Data['Export_ID'] def NewtonMethodTransAnalysisDayResult_Fun(self, *args): #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(1) #点击输电网结果分析 self.driver.find_element_by_xpath( self.WholeLossResultAnalysis_xpath).click() time.sleep(1) #点击日分析 self.driver.find_element_by_xpath(self.MonAnalysis_xpath).click() time.sleep(1) #点击变压器经济运行分析 self.driver.find_element_by_xpath(self.TransAnalysis_xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.TransAnalysisIframe_ID) #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\输电网变压器经济运行(日).xls' self.sheetname = u'输电网变压器经济运行(日)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
class DistributionlineSquDaycalcResult: def __init__(self, driver): '''620kv日均方根电流法计算结果验证''' #self.driver=webdriver.Chrome() self.driver = driver self.ProjectFilePath = GetProjectFilePath() self.Page_object_data_file = open( self.ProjectFilePath + "\Page_object\Data\DistributionlineEleQuadaycalcResult.yaml") self.Page_Data = yaml.load(self.Page_object_data_file) self.Page_object_data_file.close() self.Data = self.Page_Data['DistributionlineEleQuadaycalcResult'] #理论线损id self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID'] #点击配电线路计算结果查询xpath self.TheoreticalLineLossManualcal_Xpath = self.Data[ 'TheoreticalLineLossManualcal_Xpath'] #点击配线日报表 self.DistributionLineDayReport_Xpath = self.Data[ 'DistributionLineDayReport_Xpath'] #点击配电线路线损表 self.Linelossmeterofdistributionline_Xpath = self.Data[ 'Linelossmeterofdistributionline_Xpath'] #切换到结果frame self.DistributionLineCalcResult_frame = self.Data[ 'DistributionLineCalcResult_frame'] #点击导出 self.Daochu_id = self.Data['Daochu_id'] def DistributionlineSquDaycalcResult_Fun(self): '''620kv日均方根电流法计算结果验证''' #点击理论线损 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电线路计算结果查询xpath self.driver.find_element_by_xpath( self.TheoreticalLineLossManualcal_Xpath).click() time.sleep(2) #点击配线日报表 self.driver.find_element_by_xpath( self.DistributionLineDayReport_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath( self.Linelossmeterofdistributionline_Xpath).click() time.sleep(2) #切换到结果frame self.driver.switch_to_frame(self.DistributionLineCalcResult_frame) self.driver.implicitly_wait(30) #点击导出按钮 self.driver.find_element_by_id(self.Daochu_id).click() time.sleep(10) self.data_path = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\配电线路损耗报表(日).xls' self.sheetname = u'配电线路损耗报表(日)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() #return json.dumps(self.ExcelDataa, encoding="UTF-8", ensure_ascii=False) return self.ExcelDataa
class NewtonMethodAclineMonCalcResult: def __init__(self, driver): #驱动 self.driver = driver #获取页面元素 self.ProjectFilePath = GetProjectFilePath() self.Page_object_file = open( self.ProjectFilePath + "\\Page_object\\Data\\NewtonMethodAclineMonCalcResult.yaml") self.Page_Data = yaml.load(self.Page_object_file) self.Data = self.Page_Data['NewtonMethodAclineMonCalcResult'] #理论线损ID self.LineLoss_ID = self.Data['LineLoss_ID'] #输电网计算结果查询xpath self.WholelossCalcResultQuery_Xpath = self.Data[ 'WholelossCalcResultQuery_Xpath'] #月报表xpath self.MonCalcResult_Xpath = self.Data['MonCalcResult_Xpath'] #导线损耗表xpath self.AclineLossResult_Xpath = self.Data['AclineLossResult_Xpath'] #报表iframe的ID self.AclineLossResultIframe_ID = self.Data['AclineLossResultIframe_ID'] #查询按钮ID self.Query_ID = self.Data['Query_ID'] #导出按钮ID self.Export_ID = self.Data['Export_ID'] def NewtonMethodAclineMonCalcResult_Fun(self, *args): #点击理论线损 self.driver.find_element_by_id(self.LineLoss_ID).click() time.sleep(1) #点击输电网计算结果查询 self.driver.find_element_by_xpath( self.WholelossCalcResultQuery_Xpath).click() time.sleep(1) #点击月报表 self.driver.find_element_by_xpath(self.MonCalcResult_Xpath).click() time.sleep(1) #点击导线损耗表 self.driver.find_element_by_xpath(self.AclineLossResult_Xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.AclineLossResultIframe_ID) #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\导线损耗月报表.xls' self.sheetname = u'导线损耗月报表' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
class DistrictEleQuamonWirecalcResult: def __init__(self,driver): self.driver=driver self.ProjectFilePath=GetProjectFilePath() self.page_object_date_file=open(self.ProjectFilePath+"\Page_object\Data\DistrictEleQuamonWirecalcResult.yaml") self.page_Data=yaml.load(self.page_object_date_file) self.page_object_date_file.close() self.Data = self.page_Data['DistrictEleQuamonWirecalcResult'] #点击理论线损 self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID'] # 点击配电线路计算结果查询xpath self.TheoreticalLineLossManualcal_Xpath = self.Data['TheoreticalLineLossManualcal_Xpath'] # 点击配线月报表 self.DistributionLineMonthlyReport_Xpath = self.Data['DistributionLineMonthlyReport_Xpath'] # 点击台区线损表 self.LinelosswireofDistrict_Xpath = self.Data['LinelosswireofDistrict_Xpath'] #点击frame self.TheoreticalwireResult_frame = self.Data['TheoreticalwireResult_frame'] ##点击导线链接 self.Transformerwire_Xpath = self.Data['Transformerwire_Xpath'] # 切换到结果frame self.DistrictCalcResult_frame = self.Data['DistrictCalcResult_frame'] # 点击导出 self.export_id = self.Data['export_id'] def DistrictEleQuamonWirecalcResult_Fun(self): # 点击理论线损计算 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) # 点击配电线路计算结果查询 self.driver.find_element_by_xpath(self.TheoreticalLineLossManualcal_Xpath).click() time.sleep(2) # 点击月报表 self.driver.find_element_by_xpath(self.DistributionLineMonthlyReport_Xpath).click() time.sleep(2) # 点击台区线路线损表 self.driver.find_element_by_xpath(self.LinelosswireofDistrict_Xpath).click() time.sleep(2) #切换到结果frame self.driver.switch_to_frame(self.TheoreticalwireResult_frame) time.sleep(5) self.driver.implicitly_wait(30) ##点击电表损耗链接 self.driver.find_element_by_xpath(self.Transformerwire_Xpath).click() time.sleep(5) self.driver.switch_to.parent_frame() ## 跳出当前iframe self.driver.implicitly_wait(10) ##切换到变压器损耗明细结果frame self.driver.switch_to_frame(self.DistrictCalcResult_frame) self.driver.implicitly_wait(30) # 导出按钮id self.driver.find_element_by_id(self.export_id).click() time.sleep(10) self.data_path = u'C:\\Users\\'+GetUsername()+u'\\Downloads\\低压台区导线损耗报表(月).xls' self.sheetname = u'低压台区导线损耗报表(月)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() return self.ExcelDataa
def TranotherlosshourCalcResult_Fun(self): #进入理论线损模块 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #进入输电网计算结果查询 self.driver.find_element_by_xpath( self.TranotherlossManualcal_Xpath).click() time.sleep(2) #进入整点报表 self.driver.find_element_by_xpath( self.TranotherlosshourReport_Xpath).click() time.sleep(2) #进入其他损耗表 self.driver.find_element_by_xpath( self.TranotherlosshourCalcResult_Xpath).click() time.sleep(5) #进入查询frame框 self.driver.switch_to_frame(self.TranotherlosshourCalcResult_frame) time.sleep(3) #打开日期控件 self.driver.find_element_by_id(self.Day_box_xpath).click() time.sleep(2) #选择20140801 self.driver.find_element_by_xpath(self.DayResult_xpath).click() time.sleep(2) #选择零点 self.driver.find_element_by_id(self.ZeroHour_ID).clear() time.sleep(2) self.driver.find_element_by_id(self.ZeroHour_ID).send_keys('0') time.sleep(2) #点击日期控件确定 self.driver.find_element_by_id(self.DayQueding_id).click() time.sleep(2) #点击查询 self.driver.find_element_by_id(self.Chaxun_id).click() time.sleep(3) #点击导出 self.driver.find_element_by_id(self.Daochu_id).click() time.sleep(10) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\输电网其他损耗报表(小时).xls' self.sheetname = u'输电网其他损耗报表(小时)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
class DistributionlineFlowDayCalcResult: def __init__(self, driver): '''潮流精确算法配电线路线损表结果验证''' self.driver = driver self.ProjectFilePath = GetProjectFilePath() self.Page_object_data_file = open( self.ProjectFilePath + "\Page_object\Data\DistributionlineFlowDayCalcResult.yaml") self.Page_Data = yaml.load(self.Page_object_data_file) self.Page_object_data_file.close() self.Data = self.Page_Data['DistributionlineFlowDayCalcResult'] #点击理论线损 self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID'] #点击配电网计算结果查询 self.TheoreticalLineLosscalresult_Xpath = self.Data[ 'TheoreticalLineLosscalresult_Xpath'] #点击日报表 self.DistributionLineDayReport_Xpath = self.Data[ 'DistributionLineDayReport_Xpath'] #点击配电线路线损表 self.DistributionlinedaycalcResult_Xpath = self.Data[ 'DistributionlinedaycalcResult_Xpath'] #切换到配电线路线损表的frame中 self.DistributionlinedaycalcResult_frame = self.Data[ 'DistributionlinedaycalcResult_frame'] #点击导出 self.Export_ID = self.Data['Export_ID'] def DistributionlineFlowDayCalcResult_Fun(self): '''潮流精确算法配电线路线损表结果验证''' #点击理论线损 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电网计算结果查询 self.driver.find_element_by_xpath( self.TheoreticalLineLosscalresult_Xpath).click() time.sleep(2) #点击日报表 self.driver.find_element_by_xpath( self.DistributionLineDayReport_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath( self.DistributionlinedaycalcResult_Xpath).click() time.sleep(2) #切换到配电线路线损表的frame中 self.driver.switch_to_frame(self.DistributionlinedaycalcResult_frame) time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(10) self.data_file = u"C:\\Users\\Admin\Downloads\配电线路损耗报表(日).xls" self.sheetname = u"配电线路损耗报表(日)" self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() return self.Excel_Data
class DistributionlineVoluMonthCalcResult(): def __init__(self, driver): #self.driver = webdriver.Chrome() self.driver = driver self.datafile = GetProjectFilePath( ) + u"\Page_object\Data\DistributionlineVoluMonthCalcResult.yaml" with open(self.datafile) as datafile: self.data = yaml.load(datafile) self.datamsg = self.data['DistributionlineVoluMonthCalcResult'] # 树结构中理论线损的ID self.DistributionlineLossTree_id = self.datamsg[ "DistributionlineLossTree_id"] # 树结构中配电网计算结果查询的xpath self.TheoreticalLineLossCalResult_Xpath = self.datamsg[ "TheoreticalLineLossCalResult_Xpath"] # 树结构中月报表的xpath self.DistributionLineMonthlyReport_Xpath = self.datamsg[ "DistributionLineMonthlyReport_Xpath"] # 配电线路线损表 self.LinelossmeterDistributionline_Xpath = self.datamsg[ "LinelossmeterDistributionline_Xpath"] # 切换到frame self.DistributionLineCalcResult_frame = self.datamsg[ "DistributionLineCalcResult_frame"] # 导出按钮 self.Export_id = self.datamsg["Export_id"] def DistributionlineVoluMonthCalcResult_Fun(self): # 点击理论线损树 time.sleep(1) self.driver.find_element_by_id( self.DistributionlineLossTree_id).click() # 点击配电网计算结果查询 time.sleep(1) self.driver.find_element_by_xpath( self.TheoreticalLineLossCalResult_Xpath).click() time.sleep(1) # 点击月报表 self.driver.find_element_by_xpath( self.DistributionLineMonthlyReport_Xpath).click() time.sleep(1) # 点击配电线路线损表 self.driver.find_element_by_xpath( self.LinelossmeterDistributionline_Xpath).click() time.sleep(1) # 切换frame到配电线路线损表frame self.driver.switch_to.frame(self.DistributionLineCalcResult_frame) time.sleep(1) # 点击左下方的导出按钮 self.driver.find_element_by_id(self.Export_id).click() time.sleep(10) #读取导出文件execl内容,生成列表返回 self.ExportExecl = ExcelData( u"C:\\Users\\" + GetUsername() + u"\\Downloads\\配电线路损耗报表(月).xls", u"配电线路损耗报表(月)") return self.ExportExecl.readExcel()
def NewtonMethodLosspartVoltHourCalcResult_Fun(self, *args): #点击理论线损 self.driver.find_element_by_id(self.LineLoss_ID).click() time.sleep(1) #点击输电网计算结果查询 self.driver.find_element_by_xpath( self.WholelossCalcResultQuery_Xpath).click() time.sleep(1) #点击整点报表 self.driver.find_element_by_xpath(self.HourCalcResult_Xpath).click() time.sleep(1) #点击分片分压线损表 self.driver.find_element_by_xpath( self.LossPartVoltResult_Xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.LossPartVoltResultIframe_ID) #选择开始时间 self.driver.find_element_by_xpath(self.StartTimeWindow_xpath).click() time.sleep(0.2) self.driver.find_element_by_xpath(self.StartTimeDate_xpath).click() time.sleep(0.2) for i in range(0, 23): self.driver.find_element_by_id(self.StartTimeAdjust_ID).click() i = i + 1 time.sleep(0.1) time.sleep(0.2) self.driver.find_element_by_xpath(self.StartTimeButton_xpath).click() #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\全网分片分压线损报表(小时).xls' self.sheetname = u'全网分片分压线损报表(小时)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
class TranotherlossmonCalcResult: def __init__(self, driver): #驱动 self.driver = driver #获取页面元素 self.ProjectFilePath = GetProjectFilePath() self.Page_object_file = open( self.ProjectFilePath + "\\Page_object\\Data\\TranotherlossmonCalcResult.yaml") self.Page_Data = yaml.load(self.Page_object_file) self.Data = self.Page_Data['TranotherlossmonCalcResult'] #理论线损id self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID'] #输电网计算结果查询 self.TranotherlossManualcal_Xpath = self.Data[ 'TranotherlossManualcal_Xpath'] #月报表 self.TranotherlossmonReport_Xpath = self.Data[ 'TranotherlossmonReport_Xpath'] #其它损耗表 self.TranotherlossmonCalcResult_Xpath = self.Data[ 'TranotherlossmonCalcResult_Xpath'] #查询报表frame self.TranotherlossmonCalcResult_frame = self.Data[ 'TranotherlossmonCalcResult_frame'] #点击导出 self.Daochu_id = self.Data['Daochu_id'] def TranotherlossmonCalcResult_Fun(self): #进入理论线损模块 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #进入输电网计算结果查询 self.driver.find_element_by_xpath( self.TranotherlossManualcal_Xpath).click() time.sleep(2) #进入月报表 self.driver.find_element_by_xpath( self.TranotherlossmonReport_Xpath).click() time.sleep(2) #进入其他损耗表 self.driver.find_element_by_xpath( self.TranotherlossmonCalcResult_Xpath).click() time.sleep(5) #进入查询frame框 self.driver.switch_to_frame(self.TranotherlossmonCalcResult_frame) time.sleep(3) #点击导出 self.driver.find_element_by_id(self.Daochu_id).click() time.sleep(10) self.data_file = u'C:\\Users\\Admin\Downloads\输电网其他损耗报表(月).xls' self.sheetname = u'输电网其他损耗报表(月)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() return self.Excel_Data
def DistTransformerFlowDayCalcResult_Fun(self): '''潮流精确算法配电变压器损耗结果验证''' #点击理论线损 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电网计算结果查询 self.driver.find_element_by_xpath( self.TheoreticalLineLosscalresult_Xpath).click() time.sleep(2) #点击日报表 self.driver.find_element_by_xpath( self.DistributionLineDayReport_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath( self.DistributionlinedaycalcResult_Xpath).click() time.sleep(2) #切换到配电线路线损表frame中 self.driver.switch_to_frame(self.DistributionlinedaycalcResult_frame) self.driver.implicitly_wait(15) #点击配电变压器损耗值 self.driver.find_element_by_xpath( self.DistTransformerLoss_Xpath).click() time.sleep(2) self.driver.switch_to.parent_frame() ##跳出配电线路线损表frame self.driver.implicitly_wait(10) #切换到配电变压器损耗表(24点)frame中 self.driver.switch_to_frame( self.DistTransformerLossdaycalcResult_frame) self.driver.implicitly_wait(15) #点击左下角的导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(10) self.data_file = u"C:\\Users\\Admin\Downloads\配电变压器损耗报表(24点).xls" self.sheetname = u"配电变压器损耗报表(24点)" self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_data = self.Excel.readExcel() return self.Excel_data
class DistributionlinePieSStDay: def __init__(self,driver): '''配电线路线损率分段统计结果核对''' self.driver=driver self.ProjectFilePath=GetProjectFilePath() self.Page_object_data_file=open(self.ProjectFilePath+"\Page_object\Data\DistributionlinePieSStDay.yaml") self.Page_data=yaml.load(self.Page_object_data_file) self.Page_object_data_file.close() self.Data=self.Page_data['DistributionlinePieSStDay'] #点击线损分析 self.LineLossAnalysis_ID=self.Data['LineLossAnalysis_ID'] #点击配电网计算结果分析 self.TheoreticalLineLosscalresultAnalysis_Xpath=self.Data['TheoreticalLineLosscalresultAnalysis_Xpath'] #点击日分析 self.DistributionLineDayAnalysis_Xpath=self.Data['DistributionLineDayAnalysis_Xpath'] #点击配电线路线损率分段统计 self.DistributionlineLossRateSegStatistics_Xpath=self.Data['DistributionlineLossRateSegStatistics_Xpath'] #切换到配电线路线损率分段统计的frame中 self.DistributionlineLossRateSegStatistics_frame=self.Data['DistributionlineLossRateSegStatistics_frame'] #点击导出 self.Export_ID=self.Data['Export_ID'] def DistributionlinePieSStDay_Fun(self): '''配电线路线损率分段统计结果核对''' #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(2) #点击配电网计算结果分析 self.driver.find_element_by_xpath(self.TheoreticalLineLosscalresultAnalysis_Xpath).click() time.sleep(2) #点击日分析 self.driver.find_element_by_xpath(self.DistributionLineDayAnalysis_Xpath).click() time.sleep(2) #点击配电线路线损率分段统计 self.driver.find_element_by_xpath(self.DistributionlineLossRateSegStatistics_Xpath).click() time.sleep(2) #切换到配电线路线损率分段统计的frame中 self.driver.switch_to.frame(self.DistributionlineLossRateSegStatistics_frame) time.sleep(2) self.driver.implicitly_wait(15) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file=u"C:\\Users\\Admin\Downloads\配电线路线损率分段统计表样一(日).xlsx" self.sheetname="Sheet1" self.Excel=ExcelData(self.data_file,self.sheetname) self.Excel_Data=self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
def DistTransformerEleQuaDayCalResult_Fun(self): '''配电日电量法变压器损耗表链接页面结果验证''' #点击理论线损计算 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电线路计算结果查询 self.driver.find_element_by_xpath( self.TheoreticalLineLossManualcalResult_Xpath).click() time.sleep(2) #点击月报表 self.driver.find_element_by_xpath( self.TheoreticalLineloss620kVMonth_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath(self.WiringReport_Xpath).click() time.sleep(2) ###切换到结果frame self.driver.switch_to_frame(self.TheoreticalLinelossResult_frame) time.sleep(2) self.driver.implicitly_wait(30) ##点击变压器损耗链接 self.driver.find_element_by_xpath(self.Transformerlosslj_Xpath).click() time.sleep(3) self.driver.switch_to.parent_frame() ## 跳出当前iframe self.driver.implicitly_wait(10) ##切换到变压器损耗明细结果frame self.driver.switch_to_frame(self.TransformerlossCalcResult_frame) self.driver.implicitly_wait(30) #导出按钮id self.driver.find_element_by_id(self.Daochu_ID).click() time.sleep(10) self.data_path = u"C:\\Users\\" + GetUsername( ) + u"\\Downloads\\配电变压器损耗表报表(日).xls" self.sheetname = u'配电变压器损耗表报表(日)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() return self.ExcelDataa
def DistributionlineVoluDayCalcTransLoss_Fun(self): # 点击理论线损树 time.sleep(1) self.driver.find_element_by_id( self.DistributionlineLossTree_id).click() # 点击配电网计算结果查询 time.sleep(1) self.driver.find_element_by_xpath( self.TheoreticalLineLossCalResult_Xpath).click() time.sleep(1) # 点击月报表 self.driver.find_element_by_xpath( self.DistributionLineDaylyReport_Xpath).click() time.sleep(1) # 点击配电线路线损表 self.driver.find_element_by_xpath( self.LinelossmeterDistributionline_Xpath).click() time.sleep(1) # 切换frame到配电线路线损表frame self.driver.switch_to.frame(self.DistributionLineCalcResult_frame) self.driver.implicitly_wait(30) #点击变压器损耗的连接 self.driver.find_element_by_xpath(self.TransLossLink_Path).click() time.sleep(1) #切换到变压器损耗的frame中 self.driver.switch_to.parent_frame() time.sleep(1) self.driver.switch_to.frame(self.TransLossFrame_id) time.sleep(1) # 点击左下方的导出按钮 self.driver.find_element_by_id(self.Export_id).click() time.sleep(10) #读取导出文件execl内容,生成列表返回 self.ExportExecl = ExcelData( u"C:\\Users\\" + GetUsername() + u"\\Downloads\\配电变压器损耗表报表(日).xls", u"配电变压器损耗表报表(日)") return self.ExportExecl.readExcel()
def DistAclinesegeEleQuaMonCalResult_Fun(self): '''导线损耗表链接页面结果验证''' #点击理论线损计算 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电线路计算结果查询 self.driver.find_element_by_xpath( self.TheoreticalLineLossManualcalResult_Xpath).click() time.sleep(2) #点击月报表 self.driver.find_element_by_xpath( self.TheoreticalLineloss620kVMonth_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath(self.WiringReport_Xpath).click() time.sleep(2) ###切换到结果frame self.driver.switch_to_frame(self.TheoreticalLinelossResult_frame) time.sleep(2) self.driver.implicitly_wait(30) ##点击导线损耗链接 self.driver.find_element_by_xpath(self.WireLosslj_Xpath).click() time.sleep(3) self.driver.switch_to.parent_frame() ## 跳出当前iframe self.driver.implicitly_wait(10) ##切换到导线结果frame self.driver.switch_to_frame(self.WireCalculateResult_frame) self.driver.implicitly_wait(30) #导出按钮id self.driver.find_element_by_id(self.Daochu_ID).click() time.sleep(10) self.data_path = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\配电线路导线损耗报表(月).xls' self.sheetname = u'配电线路导线损耗报表(月)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() return self.ExcelDataa
class NewtonMethodWholelossDayCalcResult: def __init__(self, driver): #驱动 self.driver = driver #获取页面元素 self.ProjectFilePath = GetProjectFilePath() self.Page_object_file = open( self.ProjectFilePath + "\\Page_object\\Data\\NewtonMethodWholelossDayCalcResult.yaml") self.Page_Data = yaml.load(self.Page_object_file) self.Data = self.Page_Data['NewtonMethodWholelossDayCalcResult'] #理论线损ID self.LineLoss_ID = self.Data['LineLoss_ID'] #输电网计算结果查询xpath self.WholelossCalcResultQuery_Xpath = self.Data[ 'WholelossCalcResultQuery_Xpath'] #日报表xpath self.DayCalcResult_Xpath = self.Data['DayCalcResult_Xpath'] #输电网线损表xpath self.WholelossCalcResult_Xpath = self.Data['WholelossCalcResult_Xpath'] #报表iframe的ID self.WholelossCalcResultIframe_ID = self.Data[ 'WholelossCalcResultIframe_ID'] #屏蔽一下代码原因:日期选择框的Iframe的ID和name都是随机的,无法进行定位,使用代表日进行查询和导出 # #激活开始时间窗口 # self.StartTimeWindow = self.Data['StartTimeWindow'] # #开始时间窗口xpath # self.StartTimeWindow_ID = self.Data['StartTimeWindow_ID'] # #开始时间日期xpath # self.StartTimeDate_xpath = self.Data['StartTimeDate_xpath'] # #开始时间确定按钮xpath # self.StartTimeButton_xpath = self.Data['StartTimeButton_xpath'] # # #结束时间窗口xpath # self.EndTimeWindow_xpath = self.Data['EndTimeWindow_xpath'] # #结束时间日期xpath # self.EndTimeDate_xpath = self.Data['EndTimeDate_xpath'] # #结束时间确定按钮xpath # self.EndTimeButton_xpath = self.Data['EndTimeButton_xpath'] #查询按钮ID self.Query_ID = self.Data['Query_ID'] #导出按钮ID self.Export_ID = self.Data['Export_ID'] def NewtonMethodWholelossDayCalcResult_Fun(self, *args): #点击理论线损 self.driver.find_element_by_id(self.LineLoss_ID).click() time.sleep(1) #点击输电网计算结果查询 self.driver.find_element_by_xpath( self.WholelossCalcResultQuery_Xpath).click() time.sleep(1) #点击日报表 self.driver.find_element_by_xpath(self.DayCalcResult_Xpath).click() time.sleep(1) #点击输电网线损表 self.driver.find_element_by_xpath( self.WholelossCalcResult_Xpath).click() time.sleep(5) #切换到报表的frame self.driver.switch_to_frame(self.WholelossCalcResultIframe_ID) time.sleep(1) # #选择开始时间 # self.driver.find_element_by_id(self.StartTimeWindow).click() # time.sleep(0.2) # self.driver.find_element_by_id(self.StartTimeWindow_ID).click() # self.driver.find_element_by_xpath(self.StartTimeDate_xpath).click() # time.sleep(0.2) # self.driver.find_element_by_xpath(self.StartTimeButton_xpath).click() # time.sleep(0.2) # # #选择结束时间 # self.driver.find_element_by_xpath(self.EndTimeWindow_xpath).click() # time.sleep(0.2) # self.driver.find_element_by_xpath(self.EndTimeDate_xpath).click() # time.sleep(0.2) # self.driver.find_element_by_xpath(self.EndTimeButton_xpath).click() # time.sleep(0.2) #点击查询 self.driver.find_element_by_id(self.Query_ID).click() time.sleep(5) #点击导出 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(5) self.data_file = u'C:\\Users\\' + GetUsername( ) + u'\\Downloads\\全网总损耗报表(日).xls' self.sheetname = u'全网总损耗报表(日)' self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data
class DistTransformerSquDaycalcResult: def __init__(self, driver): '''配线日均方根电流法变压器损耗表链接页面结果验证''' #self.driver=webdriver.Chrome() self.driver = driver self.ProjectFilePath = GetProjectFilePath() self.Page_object_data_file = open( self.ProjectFilePath + "\Page_object\Data\DistTransformerEleQuaDayCalResult.yaml") self.Page_Data = yaml.load(self.Page_object_data_file) self.Page_object_data_file.close() self.Data = self.Page_Data['DistTransformerEleQuaDayCalResult'] #点击理论线损计算 self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID'] #点击配电线路计算结果查询 self.TheoreticalLineLossManualcalResult_Xpath = self.Data[ 'TheoreticalLineLossManualcalResult_Xpath'] ##点击日报表 self.TheoreticalLineloss620kVMonth_Xpath = self.Data[ 'TheoreticalLineloss620kVDay_Xpath'] #点击配电线路线损表 self.WiringReport_Xpath = self.Data['WiringReport_Xpath'] ##切换到结果frame self.TheoreticalLinelossResult_frame = self.Data[ 'TheoreticalLinelossResult_frame'] ##点击变压器损耗链接 self.Transformerlosslj_Xpath = self.Data['Transformerlosslj_Xpath'] ##切换到导线结果frame self.TransformerlossCalcResult_frame = self.Data[ 'TransformerlossCalcResult_frame'] #导出按钮id self.Daochu_ID = self.Data['Daochu_ID'] def DistTransformerSquDaycalcResult_Fun(self): '''配电日均方根电流法变压器损耗表链接页面结果验证''' #点击理论线损计算 self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click() time.sleep(2) #点击配电线路计算结果查询 self.driver.find_element_by_xpath( self.TheoreticalLineLossManualcalResult_Xpath).click() time.sleep(2) #点击月报表 self.driver.find_element_by_xpath( self.TheoreticalLineloss620kVMonth_Xpath).click() time.sleep(2) #点击配电线路线损表 self.driver.find_element_by_xpath(self.WiringReport_Xpath).click() time.sleep(2) ###切换到结果frame self.driver.switch_to_frame(self.TheoreticalLinelossResult_frame) time.sleep(2) self.driver.implicitly_wait(30) ##点击变压器损耗链接 self.driver.find_element_by_xpath(self.Transformerlosslj_Xpath).click() time.sleep(3) self.driver.switch_to.parent_frame() ## 跳出当前iframe self.driver.implicitly_wait(10) ##切换到变压器损耗明细结果frame self.driver.switch_to_frame(self.TransformerlossCalcResult_frame) self.driver.implicitly_wait(30) #导出按钮id self.driver.find_element_by_id(self.Daochu_ID).click() time.sleep(10) self.data_path = u'C:\\Users\\Administrator\\Downloads\\配电变压器损耗表报表(日).xls' self.sheetname = u'配电变压器损耗表报表(日)' self.Excel = ExcelData(self.data_path, self.sheetname) self.ExcelDataa = self.Excel.readExcel() return self.ExcelDataa
def DistributionlineEconomicTranDay_Fun(self): '''配电线路综合分析-经济变追溯结果核对''' #点击线损分析 self.driver.find_element_by_id(self.LineLossAnalysis_ID).click() time.sleep(2) #点击配电网计算结果分析 self.driver.find_element_by_xpath( self.TheoreticalLineLosscalresultAnalysis_Xpath).click() time.sleep(2) #点击日分析 self.driver.find_element_by_xpath( self.DistributionLineDayAnalysis_Xpath).click() time.sleep(2) #点击配电线路综合分析 self.driver.find_element_by_xpath( self.DistributionlinedaycalcAnalysis_Xpath).click() time.sleep(2) #切换到配电线路综合分析的frame中 self.driver.switch_to.frame(self.DistributionlinedaycalcAnalysis_frame) time.sleep(2) self.driver.implicitly_wait(15) #点击查询条件中日期的下拉框 self.driver.find_element_by_css_selector(self.DateDropBox_CSS).click() time.sleep(2) self.driver.find_element_by_css_selector(self.DateDropBox_CSS1).click() time.sleep(2) #切换到日期选择框中的frame cf = self.driver.find_element_by_css_selector(self.Date_frame) self.driver.switch_to.frame(cf) time.sleep(6) #点击日期下拉框年的下拉框 self.driver.find_element_by_id(self.DateYearDropBox_ID).click() time.sleep(2) #选择日期下拉框年中的2015 self.driver.find_element_by_xpath(self.YearSelect2015_Xpath).click() time.sleep(2) #点击日期下拉框代表日的下拉框 self.driver.find_element_by_id(self.DateRepresentativeDay_ID).click() time.sleep(2) #选择日期下拉框代表日中的2015-08-01 self.driver.find_element_by_xpath( self.DateRepresentativeDay20150801_Xpath).click() time.sleep(2) #点击日期下拉框中的确定按钮 self.driver.find_element_by_id(self.DateDropBoxSure_ID).click() time.sleep(2) self.driver.switch_to.parent_frame() ##跳出日期下拉框的frame self.driver.implicitly_wait(10) #点击页面中的查询按钮 self.driver.find_element_by_class_name(self.Query_Class).click() time.sleep(7) #点击变压器台数追溯 self.driver.find_element_by_xpath( self.DisttransformerNum_Xpath).click() time.sleep(3) #跳出配电线路综合分析的frame self.driver.switch_to.default_content() self.driver.implicitly_wait(15) #切换到配变运行综合分析(日)frame中 self.driver.switch_to.frame(self.DisttransformerNum_frame) self.driver.implicitly_wait(7) #点击经济变台数 self.driver.find_element_by_xpath(self.EcnomicTranNum_Xpath).click() time.sleep(3) self.driver.switch_to.parent_frame() ##跳出配变运行综合分析(日)frame time.sleep(5) #切换到配变损耗组成分析-经济变frame中 self.driver.switch_to.frame(self.EcnomicTranNum_frame) time.sleep(5) #点击左下角的导出按钮 self.driver.find_element_by_id(self.Export_ID).click() time.sleep(4) self.data_file = u"C:\\Users\\Admin\Downloads\配变损耗组成分析(日)-经济变.xls" self.sheetname = u"配变损耗组成分析(日)-经济变" self.Excel = ExcelData(self.data_file, self.sheetname) self.Excel_Data = self.Excel.readExcel() #print self.Excel_Data return self.Excel_Data