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 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 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 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
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
Exemplo n.º 6
0
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()
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
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
class DistributionlineComAStDay:
    def __init__(self, driver):
        '''潮流精确算法-配电线路综合分析日报表结果核对'''
        self.driver = driver
        self.ProjectFilePath = GetProjectFilePath()
        self.Page_object_data_file = open(
            self.ProjectFilePath +
            "\Page_object\Data\DistributionlineComAStDay.yaml")
        self.Page_data = yaml.load(self.Page_object_data_file)
        self.Page_object_data_file.close()
        self.Data = self.Page_data['DistributionlineComAStDay']

        #点击线损分析
        self.LineLossAnalysis_ID = self.Data['LineLossAnalysis_ID']
        #点击配电网计算结果分析
        self.TheoreticalLineLosscalresultAnalysis_Xpath = self.Data[
            'TheoreticalLineLosscalresultAnalysis_Xpath']
        #点击日分析
        self.DistributionLineDayAnalysis_Xpath = self.Data[
            'DistributionLineDayAnalysis_Xpath']
        #点击配电线路综合分析
        self.DistributionlinedaycalcAnalysis_Xpath = self.Data[
            'DistributionlinedaycalcAnalysis_Xpath']
        #切换到配电线路综合分析的frame中
        self.DistributionlinedaycalcAnalysis_frame = self.Data[
            'DistributionlinedaycalcAnalysis_frame']
        #点击查询条件中日期的下拉框
        self.DateDropBox_CSS = self.Data['DateDropBox_CSS']
        self.DateDropBox_CSS1 = self.Data['DateDropBox_CSS1']
        #切换到日期选择框中的frame
        self.Date_frame = self.Data['Date_frame']
        #点击日期下拉框年的下拉框
        self.DateYearDropBox_ID = self.Data['DateYearDropBox_ID']
        #选择日期下拉框年中的2015
        self.YearSelect2015_Xpath = self.Data['YearSelect2015_Xpath']
        #点击日期下拉框代表日的下拉框
        self.DateRepresentativeDay_ID = self.Data['DateRepresentativeDay_ID']
        #选择日期下拉框代表日中的2015-08-01
        self.DateRepresentativeDay20150801_Xpath = self.Data[
            'DateRepresentativeDay20150801_Xpath']
        #点击日期下拉框中的确定按钮
        self.DateDropBoxSure_ID = self.Data['DateDropBoxSure_ID']
        #点击页面中的查询按钮
        self.Query_Class = self.Data['Query_Class']
        #点击左下角的导出
        self.Export_ID = self.Data['Export_ID']

    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
class DistributionlineEleQuamoncalcResult:
    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\DistributionlineEleQuamoncalcResult.yaml")
        self.Page_Data = yaml.load(self.Page_object_data_file)
        self.Page_object_data_file.close()
        self.Data = self.Page_Data['DistributionlineEleQuamoncalcResult']

        #理论线损id
        self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID']
        #点击配电线路计算结果查询xpath
        self.TheoreticalLineLossManualcal_Xpath = self.Data[
            'TheoreticalLineLossManualcal_Xpath']
        #点击配线月报表
        self.DistributionLineMonthlyReport_Xpath = self.Data[
            'DistributionLineMonthlyReport_Xpath']
        #点击配电线路线损表
        self.Linelossmeterofdistributionline_Xpath = self.Data[
            'Linelossmeterofdistributionline_Xpath']
        #切换到结果frame
        self.DistributionLineCalcResult_frame = self.Data[
            'DistributionLineCalcResult_frame']
        #点击导出
        self.Daochu_id = self.Data['Daochu_id']
        '''#获取相关的信息,title和内容信息以前获取,参数变化从1082到1108,range(1082,1109),通过滚动滚动条获取相关信息
        self.BeginNum = self.Data['BeginNum']
        self.EndNum = self.Data['EndNum']
        #title的ID,分为前后两部分,中间有数字参数
        self.TargetResult_id_Before = self.Data['TargetResult_id_Before']
        self.TargetResult_id_After = self.Data['TargetResult_id_After']
        #页面元素的class,结尾有一组数字,定位到哪一个元素
        self.TargetResult_Class_Before = self.Data['TargetResult_Class_Before']
        #定义一个字典,该字典获取到最后的结果值,格式为Title:Result
        self.CalResult = []
        self.Result={}'''

    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):
class NewtonMethodOtherLossHourResult:
    def __init__(self, driver):
        #驱动
        self.driver = driver
        #获取页面元素
        self.ProjectFilePath = GetProjectFilePath()
        self.Page_object_file = open(
            self.ProjectFilePath +
            "\\Page_object\\Data\\NewtonMethodOtherLossHourResult.yaml")
        self.Page_Data = yaml.load(self.Page_object_file)
        self.Data = self.Page_Data['NewtonMethodOtherLossHourResult']

        #理论线损ID
        self.LineLoss_ID = self.Data['LineLoss_ID']
        #输电网计算结果查询xpath
        self.WholelossCalcResultQuery_Xpath = self.Data[
            'WholelossCalcResultQuery_Xpath']
        #整点报表xpath
        self.HourCalcResult_Xpath = self.Data['HourCalcResult_Xpath']
        #其他损耗表-整点xpath
        self.OtherLossResult_Xpath = self.Data['OtherLossResult_Xpath']
        #报表iframe的ID
        self.OtherLossResultIframe_ID = self.Data['OtherLossResultIframe_ID']

        #开始时间窗口xpath
        self.StartTimeWindow_xpath = self.Data['StartTimeWindow_xpath']
        #开始时间日期xpath
        self.StartTimeDate_xpath = self.Data['StartTimeDate_xpath']
        #开始时间确定按钮xpath
        self.StartTimeButton_xpath = self.Data['StartTimeButton_xpath']
        self.StartTimeAdjust_ID = self.Data['StartTimeAdjust_ID']
        #查询按钮ID
        self.Query_ID = self.Data['Query_ID']
        #导出按钮ID
        self.Export_ID = self.Data['Export_ID']

    def NewtonMethodOtherLossHourResult_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.OtherLossResult_Xpath).click()
        time.sleep(5)

        #切换到报表的frame
        self.driver.switch_to_frame(self.OtherLossResultIframe_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
Exemplo n.º 12
0
class DistrictEleQuamoncalcResult:
    def __init__(self, driver):
        '''400V月电量法计算结果验证'''
        #self.driver=webdriver.Chrome()
        self.driver = driver
        self.ProjectFilePath = GetProjectFilePath()
        self.Page_object_data_file = open(
            self.ProjectFilePath +
            "\Page_object\Data\DistrictEleQuamoncalcResult.yaml")
        self.Page_Data = yaml.load(self.Page_object_data_file)
        self.Page_object_data_file.close()
        self.Data = self.Page_Data['DistrictEleQuamoncalcResult']

        #理论线损id
        self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID']
        #点击配电线路计算结果查询xpath
        self.TheoreticalLineLossManualcal_Xpath = self.Data[
            'TheoreticalLineLossManualcal_Xpath']
        #点击配线月报表
        self.DistributionLineMonthlyReport_Xpath = self.Data[
            'DistributionLineMonthlyReport_Xpath']
        #点击台区线损表
        self.LinelossmeterofDistrict_Xpath = self.Data[
            'LinelossmeterofDistrict_Xpath']
        #切换到结果frame
        self.DistrictCalcResult_frame = self.Data['DistrictCalcResult_frame']
        #点击导出
        self.export_id = self.Data['export_id']

    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
        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


if __name__ == "__main__":
    driver = webdriver.Chrome()
    Try = Login.Login(driver)
    Try.Login_Function('lyltest', '000000')
    Try1 = DistTransformerEleQuaDayCalResult(driver)
    aaa = Try1.DistTransformerEleQuaDayCalResult_Fun()
    data_path = u'D:\\svn\\eagle2\\05Test\\Auto\\Project\\EagleProjecttest\\Data\\eagle620kv\\配电变压器损耗表报表(日).xls'
    sheetname = u'配电变压器损耗表报表(日)'
    Excel = ExcelData(data_path, sheetname)
    bbb = Excel.readExcel()
    a = cmp(aaa, bbb)
    print a
    time.sleep(10)
    driver.quit()
class DistributionlinePieSSubDay:
    def __init__(self,driver):
        '''配电线路线损率分段变电站追溯统计结果核对'''
        self.driver=driver
        self.ProjectFilePath=GetProjectFilePath()
        self.Page_object_data_file=open(self.ProjectFilePath+"\Page_object\Data\DistributionlinePieSSubDay.yaml")
        self.Page_data=yaml.load(self.Page_object_data_file)
        self.Page_object_data_file.close()
        self.Data=self.Page_data['DistributionlinePieSSubDay']

        #点击线损分析
        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']
        #切换到配电线路线损率分段统计查询结果的frame中
        self.DistributionlineLossRateSegStatisticsResult_frame=self.Data['DistributionlineLossRateSegStatisticsResult_frame']
        #点击单位追溯
        self.CompanyRetrospect_css=self.Data['CompanyRetrospect_css']
        #切换到配电网线损率分段统计追溯报表(分单位日)frame中
        self.CompanyRetrospect_frame=self.Data['CompanyRetrospect_frame']
        #切换到配电网线损率分段统计追溯报表(分单位日)结果frame中
        self.CompanyRetrospectResult_frame=self.Data['CompanyRetrospectResult_frame']
        #点击变电站名称追溯
        self.SubstationRetrospect_link=self.Data['SubstationRetrospect_link']
        #切换到配电网线损率分段统计追溯报表(分变电站日)frame中
        self.SubstationRetrospectResult_frame=self.Data['SubstationRetrospectResult_frame']
        #点击导出
        self.Export_ID=self.Data['Export_ID']

    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
class TranotherlosshourCalcResult:
    def __init__(self, driver):
        #驱动
        self.driver = driver
        #获取页面元素
        self.ProjectFilePath = GetProjectFilePath()
        self.Page_object_file = open(
            self.ProjectFilePath +
            "\\Page_object\\Data\\TranotherlosshourCalcResult.yaml")
        self.Page_Data = yaml.load(self.Page_object_file)
        self.Data = self.Page_Data['TranotherlosshourCalcResult']
        #理论线损id
        self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID']
        #输电网计算结果查询
        self.TranotherlossManualcal_Xpath = self.Data[
            'TranotherlossManualcal_Xpath']
        #整点报表
        self.TranotherlosshourReport_Xpath = self.Data[
            'TranotherlosshourReport_Xpath']
        #其它损耗表
        self.TranotherlosshourCalcResult_Xpath = self.Data[
            'TranotherlosshourCalcResult_Xpath']
        #查询报表frame
        self.TranotherlosshourCalcResult_frame = self.Data[
            'TranotherlosshourCalcResult_frame']
        #打开日期控件
        self.Day_box_xpath = self.Data['Day_box_xpath']
        #选择20140801_xpath
        self.DayResult_xpath = self.Data['DayResult_xpath']
        #输入零点
        self.ZeroHour_ID = self.Data['ZeroHour_ID']
        #点击日期控件中确定
        self.DayQueding_id = self.Data['DayQueding_id']
        #点击查询
        self.Chaxun_id = self.Data['Chaxun_id']
        #点击导出
        self.Daochu_id = self.Data['Daochu_id']

    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 DistributionlineEconomicTranDay:
    def __init__(self, driver):
        '''配电线路综合分析-经济变追溯结果核对'''
        self.driver = driver
        self.ProjectPathFile = GetProjectFilePath()
        self.Page_object_data_file = open(
            self.ProjectPathFile +
            "\Page_object\Data\DistributionlineEconomicTranDay.yaml")
        self.Page_data = yaml.load(self.Page_object_data_file)
        self.Page_object_data_file.close()
        self.Data = self.Page_data['DistributionlineEconomicTranDay']

        #点击线损分析
        self.LineLossAnalysis_ID = self.Data['LineLossAnalysis_ID']
        #点击配电网计算结果分析
        self.TheoreticalLineLosscalresultAnalysis_Xpath = self.Data[
            'TheoreticalLineLosscalresultAnalysis_Xpath']
        #点击日分析
        self.DistributionLineDayAnalysis_Xpath = self.Data[
            'DistributionLineDayAnalysis_Xpath']
        #点击配电线路综合分析
        self.DistributionlinedaycalcAnalysis_Xpath = self.Data[
            'DistributionlinedaycalcAnalysis_Xpath']
        #切换到配电线路综合分析的frame中
        self.DistributionlinedaycalcAnalysis_frame = self.Data[
            'DistributionlinedaycalcAnalysis_frame']
        #点击查询条件中日期的下拉框
        self.DateDropBox_CSS = self.Data['DateDropBox_CSS']
        self.DateDropBox_CSS1 = self.Data['DateDropBox_CSS1']
        #切换到日期选择框中的frame
        self.Date_frame = self.Data['Date_frame']
        #点击日期下拉框年的下拉框
        self.DateYearDropBox_ID = self.Data['DateYearDropBox_ID']
        #选择日期下拉框年中的2015
        self.YearSelect2015_Xpath = self.Data['YearSelect2015_Xpath']
        #点击日期下拉框代表日的下拉框
        self.DateRepresentativeDay_ID = self.Data['DateRepresentativeDay_ID']
        #选择日期下拉框代表日中的2015-08-01
        self.DateRepresentativeDay20150801_Xpath = self.Data[
            'DateRepresentativeDay20150801_Xpath']
        #点击日期下拉框中的确定按钮
        self.DateDropBoxSure_ID = self.Data['DateDropBoxSure_ID']
        #点击页面中的查询按钮
        self.Query_Class = self.Data['Query_Class']
        #点击变压器台数追溯
        self.DisttransformerNum_Xpath = self.Data['DisttransformerNum_Xpath']
        #切换到配变运行综合分析(日)frame中
        self.DisttransformerNum_frame = self.Data['DisttransformerNum_frame']
        #点击经济变台数
        self.EcnomicTranNum_Xpath = self.Data['EcnomicTranNum_Xpath']
        #切换到配变损耗组成分析-经济变frame中
        self.EcnomicTranNum_frame = self.Data['EcnomicTranNum_frame']
        #点击左下角的导出按钮
        self.Export_ID = self.Data['Export_ID']

    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
Exemplo n.º 17
0
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
class DistAclinesegeEleQuaMonCalResult:
    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\DistAclinesegeEleQuaMonCalResult.yaml")
        self.Page_Data = yaml.load(self.Page_object_data_file)
        self.Page_object_data_file.close()
        self.Data = self.Page_Data['DistAclinesegeEleQuaMonCalResult']

        #点击理论线损计算
        self.TheoreticalLineLoss_ID = self.Data['TheoreticalLineLoss_ID']
        #点击配电线路计算结果查询
        self.TheoreticalLineLossManualcalResult_Xpath = self.Data[
            'TheoreticalLineLossManualcalResult_Xpath']
        ##点击月报表
        self.TheoreticalLineloss620kVMonth_Xpath = self.Data[
            'TheoreticalLineloss620kVMonth_Xpath']
        #点击配电线路线损表
        self.WiringReport_Xpath = self.Data['WiringReport_Xpath']
        ##切换到结果frame
        self.TheoreticalLinelossResult_frame = self.Data[
            'TheoreticalLinelossResult_frame']
        ##点击导线损耗链接
        self.WireLosslj_Xpath = self.Data['WireLosslj_Xpath']
        ##切换到导线结果frame
        self.WireCalculateResult_frame = self.Data['WireCalculateResult_frame']
        #导出按钮id
        self.Daochu_ID = self.Data['Daochu_ID']

    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 NewtonMethodWholeLossAnalysisMonResult:
    def __init__(self, driver):
        #驱动
        self.driver = driver
        #获取页面元素
        self.ProjectFilePath = GetProjectFilePath()
        self.Page_object_file = open(
            self.ProjectFilePath +
            "\\Page_object\\Data\\NewtonMethodWholeLossAnalysisMonResult.yaml")
        self.Page_Data = yaml.load(self.Page_object_file)
        self.Data = self.Page_Data['NewtonMethodWholeLossAnalysisMonResult']

        #线损分析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.WholeLossAnalysis_xpath = self.Data['WholeLossAnalysis_xpath']

        #报表iframe的ID
        self.WholelossAnalysisIframe_ID = self.Data[
            'WholelossAnalysisIframe_ID']
        #激活月份选择框
        self.Month_ID = self.Data['Month_ID']
        #选择2015
        self.Year_xpath = self.Data['Year_xpath']
        #选择八月
        self.Month_xpath = self.Data['Month_xpath']
        #确定按钮
        self.ConfirmButton_ID = self.Data['ConfirmButton_ID']

        #查询按钮ID
        self.Query_ID = self.Data['Query_ID']
        #导出按钮ID
        self.Export_ID = self.Data['Export_ID']

    def NewtonMethodWholeLossAnalysisMonResult_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)
        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_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