def LoginWebSiteAdmin(self): jsonNewWindow = 'window.open("{}")'.format(AdminLoginJsonUrl) WebOp.shared_wd.execute_script(jsonNewWindow) time.sleep(2) Toolkit.ChangeHandle('perpetua') WebOp.shared_wd.close() Toolkit.ChangeHandle(u'智能批改') adminNewWindow = 'window.open("{}")'.format(AdminLoginUrl) WebOp.shared_wd.execute_script(adminNewWindow) Toolkit.ChangeHandle(u'管理后台') WebOp.shared_wd.find_element_by_id('logo').click() time.sleep(2)
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'管理后台')