def VolumeServer(self, exerciseName, leaveMassage): WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 newTest = WebOp.shared_wd.find_element_by_css_selector('button[selenium="create_exercise_btn"]') # 布置作业 newTest.send_keys(Keys.ENTER) # 元素被DIV覆盖,click改成ENTER WebOp.shared_wd.find_element_by_class_name('ui-select-match-text').click() # print WebOp.shared_wd.find_elements_by_class_name('ui-select-choices-row-inner')[2].text #打印一下选中的什么学科 WebOp.shared_wd.find_elements_by_class_name('ui-select-choices-row-inner')[2].click() # 选高中英语 WebOp.shared_wd.find_element_by_css_selector('button[selenium="submit"]').click() # 开始布置 exciseNameele = WebOp.shared_wd.find_element_by_id('name') exciseNameele.clear() exciseNameele.send_keys(exerciseName) # 练习名称 WebOp.shared_wd.find_element_by_css_selector('label[for="radio_type_0"]').click() # 答题卡样式 WebOp.shared_wd.find_element_by_css_selector('label[for="radio_size_0"]').click() # 答题卡板式 # 上传 WebOp.shared_wd.find_element_by_css_selector('span[ng-if="!$loading"]').click() # 添加文档 # os.system(ExternalPath + 'uploadfile.exe') # 调用AutoIt上传 cmd = ExternalPath + 'uploadfile.exe' + " " + filePath volumeServerFile = subprocess.Popen(cmd.encode('gb2312')) volumeServerFile.wait() leaveMassageele = WebOp.shared_wd.find_element_by_css_selector('textarea[ng-model="exercise.message"]') # 留言 leaveMassageele.clear() leaveMassageele.send_keys(leaveMassage) WebOp.shared_wd.find_element_by_css_selector('button[ng-click="confirm()"]').click() # 提交 WebOp.shared_wd.find_element_by_css_selector('button[ng-click="$close()"]').click() # 确认无误,提交 Toolkit.is_visible('//h4[@class="title pull-left-xs"]')
def TuPianYuXueSheng(self): if not Toolkit.IsElementPresentcss( 'tr[auth="paper_bind||is_super"]>td>a.btn-success' ): # 判断第2A步 图片与学生 是不是展开的 WebOp.shared_wd.find_element_by_css_selector( 'div[auth="paper_bind||paper_grouping||is_super"]').click() WebOp.shared_wd.find_element_by_css_selector( 'tr[auth="paper_bind||is_super"]>td>a.btn-success').click( ) # 学生关联--处理按钮 if Toolkit.IsElementPresentxpath(u"//div[text()='没有数据']"): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回 else: # 加入处理学生关联的情况,第一页交给用户处理,剩余的后台处理 WebOp.shared_wd.find_element_by_xpath( '//span[text()="交给用户处理"]').click() # Toolkit.is_not_visible('//span[text()="提交中"]') if not Toolkit.IsElementPresentcss('button.btn-default'): for one in range(99): WebOp.shared_wd.find_element_by_css_selector( 'div.students>div:nth-child(1)').click() WebOp.shared_wd.find_element_by_css_selector( 'button.btn-success>span.ng-scope').click() # Toolkit.is_not_visible('//span[text()="提交中"]') if Toolkit.IsElementPresentcss('button.btn-default'): break Toolkit.is_visible( '//div[@class="text-center"]/button[text()="返回"]') WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click()
def CancelServer(self, homeWork): WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 WebOpTeacher.FindHomeWork(WebOpTeacher(),homeWork) tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='制卷中...']".format(homeWork) # 这个要取消出卷的试卷名称 homeWorkele = WebOp.shared_wd.find_element_by_xpath(tabLinkXpath) homeWorkele.click() WebOp.shared_wd.find_element_by_css_selector('a>span.ng-scope').click() # 取消制卷 WebOp.shared_wd.find_element_by_css_selector('div>button.btn-danger').click() # 我知道了,取消任务
def BookMark(self, exerciseName): WebOpTeacher.EnterTab(WebOpTeacher(), u'试卷库') WebOp.shared_wd.find_element_by_xpath( '//div[text()="【SU】ScriptUser"]').click() xpath = u'//span[text()="{}"]'.format(exerciseName) WebOp.shared_wd.find_element_by_xpath(xpath).click() Toolkit.is_visible('//button/span') WebOp.shared_wd.find_element_by_css_selector( 'button.btn-success').click() # 点击使用本试卷 Toolkit.is_visible('//div/a[@class="active"]')
def Template(self, exerciseName): WebOpTeacher.EnterTab(WebOpTeacher(),u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 newTest = WebOp.shared_wd.find_element_by_css_selector('button[selenium="create_exercise_btn"]') # 布置作业 newTest.send_keys(Keys.ENTER) # 元素被DIV覆盖,click改成ENTER WebOp.shared_wd.find_element_by_class_name('ui-select-match-text').click() WebOp.shared_wd.find_elements_by_class_name('ui-select-choices-row-inner')[2].click() # 选高中英语 time.sleep(1) WebOp.shared_wd.find_element_by_css_selector('div[selenium-value="00000011"]').click() # 选择模板!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WebOp.shared_wd.find_element_by_css_selector('button[selenium="submit"]').click() # 开始布置 exerciseNameele = WebOp.shared_wd.find_element_by_id('name') exerciseNameele.clear() exerciseNameele.send_keys(exerciseName) WebOp.shared_wd.find_element_by_css_selector('.controls>.btn-tiny').click() # 添加文档 # os.system(ExternalPath + 'upload.exe') # 调AUTOIT cmd = ExternalPath + 'uploadfile.exe' + " " + filePath volumeServerFile = subprocess.Popen(cmd.encode('gb2312')) volumeServerFile.wait() num = Toolkit.GetAnswer(answerPath, 7) tingliele = WebOp.shared_wd.find_elements_by_css_selector('div>textarea')[0] # 听力题 tingliele.clear() tingliele.send_keys(num[0]) yuedulijiele = WebOp.shared_wd.find_elements_by_css_selector('div>textarea')[1] # 阅读理解 yuedulijiele.clear() yuedulijiele.send_keys(num[1]) wanxingtiankong = WebOp.shared_wd.find_elements_by_css_selector('div>textarea')[2] # 完型填空 wanxingtiankong.clear() wanxingtiankong.send_keys(num[2]) duanwentiankong = WebOp.shared_wd.find_elements_by_css_selector('div>textarea')[3] # 短文填空 duanwentiankong.clear() duanwentiankong.send_keys(num[3]) duanwengaicuo = WebOp.shared_wd.find_elements_by_css_selector('div>textarea')[4] # 短文改错 duanwengaicuo.clear() duanwengaicuo.send_keys(num[4]) WebOp.shared_wd.find_element_by_css_selector('button[ng-click="viewCorrection()"]').click() # 点击“确认,开始标记答案” zuowenbiaoti = WebOp.shared_wd.find_element_by_css_selector('.question-content>.form-group>.controls>input') # 作文标题 zuowenbiaoti.clear() zuowenbiaoti.send_keys(num[5]) zuowenneirong = WebOp.shared_wd.find_elements_by_css_selector('div>textarea')[5] # 作文内容 zuowenneirong.clear() zuowenneirong.send_keys(num[6]) WebOp.shared_wd.find_element_by_css_selector('button[selenium="submit"]').click() # 提交 Toolkit.is_visible('//button[@selenium="share_btn"]')
def DeleteExcise1(self, homeWork): WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 WebOpTeacher.FindHomeWork(WebOpTeacher(), homeWork) tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='查看成绩']".format(homeWork) # 要删除练习的试卷名称(找在作业批改中的) homeWorkele = WebOp.shared_wd.find_element_by_xpath(tabLinkXpath) homeWorkele.click() WebOp.shared_wd.find_element_by_link_text('作业布置').click() # 作业布置 WebOp.shared_wd.find_elements_by_css_selector('span.caret')[0].click() # 编辑练习下拉框 WebOp.shared_wd.find_element_by_css_selector('a>span.ng-scope').click() # 删除练习 # 对prompt对话框的操作 time.sleep(1) Toolkit.Prompt()
def DeleteAdminExcise(self, exciseName): WebOp.shared_wd.find_element_by_css_selector( u'span[title="考试列表"]').click() # 选择考试列表 Toolkit.is_visible('//span[text()="考试名称"]') WebOp.shared_wd.refresh() WebOp.shared_wd.find_elements_by_css_selector( 'table.channel-table td')[0].click() # 点击全部 xpath = u'//a[text()="{}"]//..//following-sibling::td//a//span[text()="删除"]'.format( exciseName) if Toolkit.IsElementPresentxpath(xpath): WebOp.shared_wd.find_elements_by_xpath( xpath)[0].click() # 选择考试“d_SU高中英语(模板出卷)”并删除第一个 Toolkit.Prompt()
def Self_help(self): WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 newTest = WebOp.shared_wd.find_element_by_css_selector('button[selenium="create_exercise_btn"]') # 布置作业 newTest.send_keys(Keys.ENTER) # 元素被DIV覆盖,click改成ENTER WebOp.shared_wd.find_element_by_class_name('ui-select-match-text').click() WebOp.shared_wd.find_elements_by_class_name('ui-select-choices-row-inner')[2].click() # 选高中英语 time.sleep(1) WebOp.shared_wd.find_element_by_xpath('//div[text()="自助出卷"]').click() # 选自助出卷 exciseNamele = WebOp.shared_wd.find_element_by_css_selector('div>input.ng-touched') # 试卷名称 exciseNamele.clear() exciseNamele.send_keys(u'd_SU高中英语(自助出卷)') WebOp.shared_wd.find_element_by_css_selector('button[selenium="submit"]').click() # 开始布置
def DealwithUnNo(self, homeWork): Toolkit.ChangeHandle(u'智能批改') WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 WebOpTeacher.FindHomeWork(WebOpTeacher(), homeWork) # 先找到这个作业 tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='作业批改中']".format( homeWork) homeWorkele = WebOp.shared_wd.find_elements_by_xpath(tabLinkXpath)[0] homeWorkele.click() WebOp.shared_wd.find_element_by_xpath('//a[text()="异常答题卡处理"]').click() WebOp.shared_wd.find_element_by_css_selector( 'div.students>div.student:nth-child(1)>div>button').click() time.sleep(1) WebOp.shared_wd.switch_to.alert.accept() Toolkit.ChangeHandle(u'管理后台')
def DaFenKuang(self): Toolkit.is_visible(u'//div[text()="第2B步 - 图片与成绩"]') if not Toolkit.IsElementPresentcss( 'tr[auth="paper_score||is_super"]>td.text-center>a' ): # 判断第2B步 图片与成绩 是不是展开的 WebOp.shared_wd.find_element_by_css_selector( 'div[auth="marking_choice||marking_blanks||blank_score||blank_tag||marking_correction||marking_writing||marking_scores||paper_score||is_super"]' ).click() if Toolkit.IsElementPresentcss( 'tr[auth="marking_scores||is_super"]'): # 判断打分框是否存在 WebOp.shared_wd.find_element_by_css_selector( 'tr[auth="marking_scores||is_super"]>td>a.btn-success').click( ) if Toolkit.IsElementPresentxpath(u'//div[text()="本题已处理完成!"]'): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回
def GetGradeScore(self,homeWork): self.EnterTab(u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 self.FindHomeWork(homeWork) # 先找到这个作业 tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='查看成绩']".format(homeWork) homeWorkele = WebOp.shared_wd.find_elements_by_xpath(tabLinkXpath)[0] homeWorkele.click() # 获取平均分 aveScorele = WebOp.shared_wd.find_element_by_css_selector('div.block-success>span:nth-child(2)') aveScore = aveScorele.text # 获取最高分 maxScorele = WebOp.shared_wd.find_element_by_css_selector('div.block-success>span:nth-child(6)') maxScore = maxScorele.text # 获取最低分 minScorele = WebOp.shared_wd.find_element_by_css_selector('div.block-success>span:nth-child(10)') minScore = minScorele.text return [aveScore,maxScore,minScore]
def CancelServer(self, homeWork): WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 WebOpTeacher.FindHomeWork(WebOpTeacher(), homeWork) tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='制卷中...']".format( homeWork) # 这个要取消出卷的试卷名称 homeWorkele = WebOp.shared_wd.find_elements_by_xpath(tabLinkXpath)[0] homeWorkele.click() WebOp.shared_wd.find_element_by_css_selector( 'a>span.ng-scope').click() # 取消制卷 numEle = WebOp.shared_wd.find_element_by_css_selector('div>label') num = numEle.text[-2:] inputEle = WebOp.shared_wd.find_element_by_css_selector( 'div.labels>input') inputEle.send_keys(num) WebOp.shared_wd.find_element_by_css_selector( 'div>button.btn-danger').click() # # 我已了解,继续
def GaiCuoTi(self): Toolkit.is_visible(u'//div[text()="第2B步 - 图片与成绩"]') if not Toolkit.IsElementPresentcss( 'tr[auth="paper_score||is_super"]>td.text-center>a' ): # 判断第2B步 图片与成绩 是不是展开的 WebOp.shared_wd.find_element_by_css_selector( 'div[auth="marking_choice||marking_blanks||blank_score||blank_tag||marking_correction||marking_writing||marking_scores||paper_score||is_super"]' ).click() if Toolkit.IsElementPresentcss( 'tr[auth="marking_correction||is_super"]'): # 判断改错题是否存在 WebOp.shared_wd.find_element_by_css_selector( 'tr[auth="marking_correction||is_super"]>td>a.btn-success' ).click() if Toolkit.IsElementPresentxpath(u'//div[text()="本题已处理完成!"]'): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回 else: for Cnum in range(99): # 题目数量 if not Toolkit.IsElementPresentxpath( u'//tr//td[position()=6 and text()!="0"]' ): # 判断下有没有未标注的 break biaozhuEles = WebOp.shared_wd.find_elements_by_xpath( u'//tr//td[position()=6 and text()!="0"]/following-sibling::td//a//span[text()="标注"]' ) for biaozhuele in biaozhuEles: biaozhuele.click() WebOp.shared_wd.find_elements_by_xpath( u'//div[text()="过滤: "]//button')[1].click( ) # 获取所有的 过滤出来的答案 for num in range(99): WebOp.shared_wd.find_element_by_css_selector( 'button[ng-click="selectAll()"]').click() # 全选 WebOp.shared_wd.find_element_by_css_selector( 'i.fa-check').click() # 点击对号(这里判断不出到底对错,就都选对了) if Toolkit.IsElementPresentxpath( u'//div[text()="本题已处理完成!"]'): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回 break break WebOp.shared_wd.find_element_by_css_selector( 'div.pull-right>button').click() # 点击返回 time.sleep(1)
def SubmitHomeWork(self, homeWork): self.EnterTab(u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 self.FindHomeWork(homeWork) # 先找到这个作业 tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='请提交作业']".format( homeWork) homeWorkele = WebOp.shared_wd.find_elements_by_xpath(tabLinkXpath)[0] homeWorkele.click() WebOp.shared_wd.find_element_by_css_selector( '.fa-cloud-upload').click() # 提交作业 WebOp.shared_wd.find_element_by_css_selector( '.item-download').click() # 点击“+可一次性添加多个班级作答试卷” cmd = ExternalPath + 'uploadPicture.exe' + " " + picturePath submitPicture = subprocess.Popen(cmd) submitPicture.wait() WebOp.shared_wd.find_element_by_css_selector( 'button[selenium="upload"]').click() # 添加完成,开始上传 if not Toolkit.IsElementPresentxpath('//div[text()="上传确认"]'): WebOp.shared_wd.find_element_by_css_selector( 'button[selenium="upload"]').click() # 添加完成,开始上传 Toolkit.is_visible('//span[@class="ng-scope"]') WebOp.shared_wd.find_element_by_xpath( '//span[@class="ng-scope"]').click() # 确认无误,开始上传 Toolkit.is_visible('//a[@selenium="finish"]') WebOp.shared_wd.find_element_by_xpath( '//a[@selenium="finish"]').click() # 我已传完 time.sleep(2)
def DeleteExcise(self, homeWork, homeworkStatus): # homework:作业名称 # homeworkStatus:作业状态(自助制卷中...|请提交作业|作业批改中|查看成绩) WebOpTeacher.EnterTab(WebOpTeacher(), u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='{}']".format( homeWork, homeworkStatus) # 要删除练习的试卷名称(找在作业批改中的) WebOpTeacher.FindHomeWork(WebOpTeacher(), homeWork) homeWorkele = WebOp.shared_wd.find_elements_by_xpath(tabLinkXpath)[0] homeWorkele.click() WebOp.shared_wd.find_element_by_link_text('作业布置').click() # 作业布置 WebOp.shared_wd.find_elements_by_css_selector( 'span.caret')[0].click() # 编辑练习下拉框 WebOp.shared_wd.find_element_by_css_selector( 'a>span.ng-scope').click() # 删除练习 numEle = WebOp.shared_wd.find_element_by_css_selector( 'div.modal-content div>label') num = numEle.text[-2:] inputEle = WebOp.shared_wd.find_element_by_css_selector( 'div.labels>input') inputEle.send_keys(num) WebOp.shared_wd.find_element_by_css_selector( 'div>button.btn-danger').click() # 我已了解,继续
def ChooseTest(self, exciseName): WebOp.shared_wd.find_element_by_css_selector( u'span[title="考试列表"]').click() # 选择考试列表 Toolkit.is_visible('//span[text()="考试名称"]') WebOp.shared_wd.refresh() WebOp.shared_wd.find_elements_by_css_selector( 'table.channel-table td')[0].click() # 点击全部 WebOp.shared_wd.find_elements_by_link_text( exciseName)[0].click() # 选择考试“d_SU高中英语(模板出卷)” WebOp.shared_wd.find_element_by_css_selector( 'div.btn-group>a.border').click() # 点击任务面板 while True: # 判断上传的作业在后台是否都跑完,跑完在继续后续步骤 papernumele = WebOp.shared_wd.find_element_by_css_selector( 'div.col-sm-4>div:nth-child(2)>div:nth-child(1)') paperanaumele = WebOp.shared_wd.find_element_by_css_selector( 'div.col-sm-4>div:nth-child(2)>div:nth-child(2)') num = int(paperanaumele.text[:-1]) totalnum = int(papernumele.text[:-1]) if totalnum != num: time.sleep(2.5) WebOp.shared_wd.refresh() else: break return totalnum
def TianKongTi(self): Toolkit.is_visible(u'//div[text()="第2B步 - 图片与成绩"]') if not Toolkit.IsElementPresentcss( 'tr[auth="paper_score||is_super"]>td.text-center>a' ): # 判断第2B步 图片与成绩 是不是展开的 WebOp.shared_wd.find_element_by_css_selector( 'div[auth="marking_choice||marking_blanks||blank_score||blank_tag||marking_correction||marking_writing||marking_scores||paper_score||is_super"]' ).click() if Toolkit.IsElementPresentcss( 'tr[auth="marking_blanks||blank_score||blank_tag||is_super"]' ): # 判断填空题是否存在 WebOp.shared_wd.find_element_by_css_selector( 'tr[auth="marking_blanks||blank_score||blank_tag||is_super"]>td>a.btn-success' ).click() if Toolkit.IsElementPresentxpath(u'//div[text()="本题已处理完成!"]'): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回 else: for Cnum in range(99): if not Toolkit.IsElementPresentxpath( '//tr//td[position()=4 and text()!="0"]'): break biaozhuEles = WebOp.shared_wd.find_elements_by_xpath( u'//a[text()="标注"]') for biaozhuele in biaozhuEles: biaozhuele.click() if Toolkit.IsElementPresentcss( 'div.text-center>button.btn-primary' ): # 判断进入***题这个按钮是否存在 WebOp.shared_wd.find_element_by_css_selector( 'div.text-center>button.btn-primary').click() if Toolkit.IsElementPresentxpath( u'//div[text()="本题已处理完成!"]'): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回 break for num in range(99): WebOp.shared_wd.find_element_by_css_selector( 'button[ng-click="selectAll()"]').click() # 全选 WebOp.shared_wd.find_element_by_css_selector( 'button[ng-click="submit()"]').click() # 提交 if Toolkit.IsElementPresentcss( 'div.text-center>button.btn-primary' ): # 判断进入**题这个按钮是否存在 WebOp.shared_wd.find_element_by_css_selector( 'div.text-center>button.btn-primary' ).click() # 点击进入**题 time.sleep(1) if Toolkit.IsElementPresentxpath( u'//div[text()="本题已处理完成!"]'): WebOp.shared_wd.find_element_by_css_selector( 'button.btn-default').click() # 点击返回 break break WebOp.shared_wd.find_elements_by_css_selector( '.text-left')[0].click() # 全选考试题 WebOp.shared_wd.find_element_by_css_selector( 'div.bg-grey>button').click() # 点击一建打分 time.sleep(1.5) # 不能显示等待因为元素之前是存在的 WebOp.shared_wd.find_element_by_xpath( '//div[@class="pull-right"]//button').click() # 点击返回
def DownloadFile(self, homeWork): # 初始下目录 currentTimeToD = time.strftime("%Y-%m-%d", time.localtime(time.time())) createpath = downFilePath + currentTimeToD + '\\' Toolkit.mkdir(createpath) WebOp.shared_wd.refresh() self.EnterTab(u'首页') Toolkit.is_visible('//i[@class="fa fa-pencil"]') # 确定已经切换到首页了 self.FindHomeWork(homeWork) tabLinkXpath = u"//span[text()='{}']//../preceding-sibling::span/a[text()='查看成绩']".format( homeWork) # 点击查看成绩 homeWorkele = WebOp.shared_wd.find_elements_by_xpath(tabLinkXpath)[0] homeWorkele.send_keys(Keys.ENTER) WebOp.shared_wd.find_elements_by_css_selector( 'div.ng-scope>div.clearfix>div.ng-scope')[2].click() # 成绩单 WebOp.shared_wd.find_elements_by_css_selector( 'div.pull-right>button')[0].click() # 点击下载年级成绩单 cmd = ExternalPath + "downloadfile.exe" + " " + createpath + u'年级成绩单.xls' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() # time.sleep(2) WebOp.shared_wd.find_elements_by_css_selector( 'div.pull-right>button')[1].click() # 点击下载各班成绩单 Toolkit.is_visible( '//span[text()=" 下载各班成绩单"]') # 确定在“下载各班成绩单”的按钮出现(即弹出了下载框)执行下面步骤 cmd = ExternalPath + "downloadfile.exe" + " " + createpath + u'各班成绩单(全年级成绩单).zip' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() #time.sleep(3) WebOp.shared_wd.find_element_by_css_selector( u'button[title="1401班"]').click() # 点击1401班 WebOp.shared_wd.find_element_by_css_selector( 'div.pull-right>button').click() # 点击下载班级成绩单 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'班级成绩单.xls' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() #time.sleep(2) WebOp.shared_wd.find_element_by_css_selector( u'button[title="全年级"]').click() # 点击全年级 WebOp.shared_wd.find_elements_by_css_selector( 'div.ng-scope>div.clearfix>div.ng-scope')[1].click() # 试题分析 WebOp.shared_wd.find_elements_by_css_selector( 'div.section-header>div.pull-right>button')[0].click() # 下载年级试题分析表 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'年级试题分析表.xls' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() #time.sleep(2) WebOp.shared_wd.find_elements_by_css_selector( 'div.section-header>div.pull-right>button')[1].click() # 下载各班作答明细 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'各班作答明细(全年级成绩明细).zip' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() #time.sleep(5) WebOp.shared_wd.find_element_by_css_selector( u'button[title="1401班"]').click() # 点击1401班 WebOp.shared_wd.find_element_by_css_selector( 'div.pull-right>button').click() # 下载班级作答明细 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'班级作答明细.xls' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() #time.sleep(2) WebOp.shared_wd.find_elements_by_css_selector( 'div.ng-scope>div.clearfix>div.ng-scope')[3].click() # 学生报告 WebOp.shared_wd.find_element_by_css_selector( 'div.pull-left>button>span.ng-scope').click() # 下载导出批阅报告 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'批阅报告.pdf' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() #time.sleep(2) WebOp.shared_wd.find_element_by_css_selector( 'div.slimScrollDiv div.student:nth-child(2)').click() # 点击一个学生回到顶部 hidden_submenu = WebOp.shared_wd.find_elements_by_css_selector( 'div.ng-scope>div.clearfix>div.ng-scope')[3] # 学生报告 ActionChains(WebOp.shared_wd).move_to_element(hidden_submenu).perform() #WebOp.shared_wd.find_elements_by_css_selector('div.ng-scope>div.clearfix>div.ng-scope')[3].click() # 学生报告 WebOp.shared_wd.find_element_by_xpath( u'//div[text()="导出报告"]').click() # 导出报告 #dcbgele.send_keys(Keys.ENTER) WebOp.shared_wd.find_element_by_css_selector( 'div.section-body>button').click() # 下载生成班级批阅报告 Toolkit.is_visible( '//span[text()=" 生成班级批阅报告"]') # 确定在“生成班级批阅报告”的按钮出现(即弹出了下载框)执行下面步骤 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'全部批阅报告.pdf' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() # time.sleep(5) WebOp.shared_wd.find_element_by_css_selector( 'div.pull-right-sm>button').click() # 下载导出统计报告 Toolkit.is_visible( '//span[text()=" 导出统计报告"]') # 确定在“导出统计报告”的按钮出现(即弹出了下载框)执行下面步骤 cmd = ExternalPath + 'downloadfile.exe' + " " + createpath + u'统计报告.pdf' pp = subprocess.Popen(cmd.encode('gb2312')) pp.wait() time.sleep(5)