Esempio n. 1
0
 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()
Esempio n. 2
0
    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)
Esempio n. 3
0
 def FindHomeWork(self, homeWork):
     tabLinkXpath = u"//span[text()='{}']".format(homeWork)
     for no in range(9999):
         if Toolkit.IsElementPresentxpath(tabLinkXpath):
             break
         WebOp.shared_wd.find_element_by_css_selector(
             'a[ng-click="selectPage(page + 1)"]').click()
Esempio n. 4
0
 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)
Esempio n. 5
0
 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()
Esempio n. 6
0
 def TuPianYuChuLi(self):
     if not Toolkit.IsElementPresentcss(
             'tr[auth="paper_anchor||is_super"]>td>a.btn-success'
     ):  # 判断第1步 图片预处理 是不是展开的
         WebOp.shared_wd.find_element_by_css_selector(
             'div[auth="paper_anchor||paper_indexing||is_super"]').click()
     WebOp.shared_wd.find_element_by_css_selector(
         'tr[auth="paper_anchor||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:
         pass  # 过后补充这种情况
Esempio n. 7
0
 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()  # 点击返回
Esempio n. 8
0
    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()  # 点击返回