def setUp(self): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) openresult = 0 office = officePage(self.driver) office.input_office_username('admin') office.input_office_password('admin') office.click_office_btn() time.sleep(2) office.change_to_oa_link() #切换到最右窗口 office.change_to_window(1)
def test_donecheck(self):#啊啊 for key,value in CmccPage.userList.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key)#改为列表读取 cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() cmcc.click(['id','gViewCloseBtnGViewInfo']) for i in range(5): try: self.driver.switch_to.frame('iframecontent-utsmain') cmcc.click(["xpath",'//*[@id="showRecord_2"]']) cmcc.click(['xpath',("/html/body/div[1]/div/div/div/div[2]/table/tbody/tr/td[2]/div/div/table/tbody/tr[" + str(i+1) + "]/td[3]/a")]) time.sleep(3) self.driver.implicitly_wait(30) cmcc.change_to_window(1) self.driver.implicitly_wait(30) try: cmcc.click(['id',"toFlowXspLink"]) #self.driver.find_element_by_id("processFormSubmitNext").click() openresult = (i + 1) cmcc.change_to_window(-1) # windows = self.driver.window_handles # self.driver.switch_to.window(windows[-1]) self.driver.close() cmcc.change_to_window(-1) # windows = self.driver.window_handles # self.driver.switch_to.window(windows[-1]) self.driver.close() except Exception as d: print(Exception,":",d) cmcc.get_screent_img() #print("第" + str(i + 1) + "条已办打开正常") except Exception as e: print(Exception,":",e) print("没有第" + str(i + 1) + "条已办") cmcc.get_screent_img() break self.assertEqual(openresult, (i + 1), msg=("测试失败,第" + str(i + 1) + "条已办打开不正常")) cmcc.change_to_window(0) cmcc.close()
def test_todocheck(self): for key, value in CmccPage.userList.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key) cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() cmcc.click(['id', 'gViewCloseBtnGViewInfo']) for i in range(4): try: self.driver.switch_to.frame('iframecontent-utsmain') self.driver.find_element_by_xpath( "//*[@id='todo']/tbody/tr[" + str(i + 1) + "]/td[3]/a").click() time.sleep(3) self.driver.implicitly_wait(30) cmcc.change_to_window(1) try: cmcc.click(['id', "processFormSubmitNext"]) #self.driver.find_element_by_id("processFormSubmitNext").click() openresult = (i + 1) #time.sleep(2) self.driver.close() except Exception as d: print(Exception, ":", d) #print("第" + str(i + 1) + "条待办打开正常") except Exception as e: print(Exception, ":", e) print("没有第" + str(i + 1) + "条待办") cmcc.get_screent_img() break self.assertEqual(openresult, (i + 1), msg=("测试失败,第" + str(i + 1) + "条待办打开不正常")) cmcc.change_to_window(0) cmcc.close()
def test_donecheck(self): #打开浏览器 driver = BrowserDriver(self) self.driver = driver.openbrowser(self) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username('jianjie') cmcc.input_cmcc_password('Pa$$w0rd') cmcc.click_cmcc_btn() cmcc.click(['id','gViewCloseBtnGViewInfo']) cmcc.change_to_iframe('iframecontent-utsmain') cmcc.click(['xpath',"//*[@id='todo']/tbody/tr[1]/td[3]/a"]) time.sleep(1) cmcc.change_to_window(1) time.sleep(4) cmcc.click(['id', "processFormSubmitNext"]) self.driver.close() time.sleep(5) cmcc.change_to_window(0) cmcc.change_to_iframe('iframecontent-utsmain') cmcc.click(['xpath', "//*[@id='todo']/tbody/tr[1]/td[3]/a"]) time.sleep(10)
def setUpClass(cls): driver = BrowserDriver(cls) cls.driver = driver.openbrowser(cls)
def test_gsfw(self): #读取配置文件 file_path = os.path.dirname(os.getcwd()) name_path = file_path + '\yaml\\browser.yaml' with open(name_path, 'r') as f: temp = yaml.load(f.read()) #读取xpath #提交按钮 commit_xpath = temp['jcyj']['commit'] #决策意见,同意单选框 agree_xpath = temp['jcyj']['agree'] #提交前人员确认框,确认按钮 confirm_xpath = temp['confirm'] #提交下一处理按钮 next_xpath = temp['next'] #普通意见,意见输入框 text_xpath = temp['ptyj']['textarea'] for key, value in CmccPage.userList_bmhq.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) self.driver.implicitly_wait(30) cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key) #改为列表读取 cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() self.driver.implicitly_wait(5) #关闭提示框 cmcc.click(['id', 'gViewCloseBtnGViewInfo']) time.sleep(2) #点击第一条待办 self.driver.switch_to.frame('iframecontent-utsmain') self.driver.find_element_by_xpath("//*[@id='todo']/tbody/tr[" + str(1) + "]/td[3]/a").click() time.sleep(2) windows = self.driver.window_handles self.driver.switch_to.window(windows[1]) self.driver.implicitly_wait(30) time.sleep(2) #weilihong魏丽红填写会签部门,然后提交会签分支 if key == ' weilihong': self.driver.find_element_by_xpath( '//*[@id="cmoaJtDispatchDocEditForm"]/div[1]/fieldset[1]/div/table/tbody[2]/tr[8]/td[2]/div/div/span' ).click() time.sleep(2) # 技术部 self.driver.find_element_by_xpath( '//*[@id="huiQianChuShi"]/li[10]').click() time.sleep(1) # 内审部,注意技术部点选后,内审部位置上移 self.driver.find_element_by_xpath( '//*[@id="huiQianChuShi"]/li[11]').click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="GEditInfoOkButton"]').click() time.sleep(1) # 提交下一处理 self.driver.find_element_by_xpath(next_xpath).click() time.sleep(2) # try点选同意单选框,点不到说明是普通意见,在意见框输入1 try: self.driver.find_element_by_xpath(agree_xpath).click() except Exception as e: self.driver.find_element_by_xpath(text_xpath).send_keys(1) time.sleep(1) #列表设置key首位字符为空格,这类用户填完意见后直接提交 if key[0] == ' ': self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) #按人物执行分支 if key == ' weilihong': #技术部选择wangxiaoyun王晓云 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-3DEAF64F-FCF1-4206-9EF7-12D4C3E22530_1_switch"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-3DEAF64F-FCF1-4206-9EF7-12D4C3E22530_2_span"]' ).click() time.sleep(1) #gaolingling高玲玲 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-3DEAF64F-FCF1-4206-9EF7-12D4C3E22530_3_switch"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-3DEAF64F-FCF1-4206-9EF7-12D4C3E22530_4_span"]' ).click() time.sleep(1) #选人界面确认按钮 self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) #提交前确认框确认按钮 self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == ' gaolingling': #送主办部门文书岗传递 # 循环获取alert弹窗,取到则退出循环 while cmcc.is_alert_present() == False: pass cmcc.click_alert() if key == 'wangxiaoyun': self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-0A7CA35C-B974-45C2-A02B-981CF098C0D1"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-741BE903-FEF2-4256-9AD7-7AFE106EFD6E_1_switch"]' ).click() time.sleep(1) #科技处-duqian杜倩 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-741BE903-FEF2-4256-9AD7-7AFE106EFD6E_2_span"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-741BE903-FEF2-4256-9AD7-7AFE106EFD6E_9_switch"]' ).click() time.sleep(1) #资源管理处-chenyurong陈豫蓉 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-741BE903-FEF2-4256-9AD7-7AFE106EFD6E_10_span"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == 'chenyurong': #送回相关部门会签 self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-0DEA2734-BBD7-4440-A416-F11E762F2CAF"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) while cmcc.is_alert_present() == False: pass cmcc.click_alert() if key == ' duqian': #默认选中于书丹,再点选郭健 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_multi_users_scope_sid-A7E0A0B8-19B5-44F9-8003-06DA2D88CDEC_3_span"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == 'yushudan': #结束办理 self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_grcsp_append_processor_false"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) while cmcc.is_alert_present() == False: pass cmcc.click_alert() if key == ' guojian': self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == 'duqian ': self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-BB86920E-B3D1-4EF6-BCF4-370D1D1D14B2"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == ' wangxiaoyun ': self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) # 循环获取alert弹窗,取到则退出循环 while cmcc.is_alert_present() == False: pass cmcc.click_alert() cmcc.change_to_window(0) cmcc.close()
def test_gsfw(self): #读取配置文件 file_path = os.path.dirname(os.getcwd()) name_path = file_path + '\yaml\\browser.yaml' with open(name_path, 'r') as f: temp = yaml.load(f.read()) #读取xpath #提交按钮 commit_xpath = temp['jcyj']['commit'] #决策意见,同意单选框 agree_xpath = temp['jcyj']['agree'] #提交前人员确认框,确认按钮 confirm_xpath = temp['confirm'] #提交下一处理按钮 next_xpath = temp['next'] #普通意见,意见输入框 text_xpath = temp['ptyj']['textarea'] for key, value in CmccPage.userList_drqb.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) self.driver.implicitly_wait(30) cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key) #改为列表读取 cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() self.driver.implicitly_wait(5) #关闭提示框 cmcc.click(['id', 'gViewCloseBtnGViewInfo']) time.sleep(2) #点击第一条待办 self.driver.switch_to.frame('iframecontent-utsmain') self.driver.find_element_by_xpath("//*[@id='todo']/tbody/tr[" + str(1) + "]/td[3]/a").click() time.sleep(2) windows = self.driver.window_handles self.driver.switch_to.window(windows[1]) self.driver.implicitly_wait(30) time.sleep(2) # 提交下一处理 self.driver.find_element_by_xpath(next_xpath).click() time.sleep(2) #无需填写意见用户列于下方,按人物执行分支 if key == 'tanchun': #送办公厅核稿 self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) # 提交前确认框确认按钮 self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) elif key == 'youmingju': #取消提交下一处理 self.driver.find_element_by_xpath( '//*[@id="grcspSubmitWindow"]/div/div/div[3]/button[2]' ).click() time.sleep(2) #填写文件编号 self.driver.find_element_by_xpath( '//*[@id="postManager"]').click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="GEditInfoOkButton"]').click() time.sleep(2) # 再次提交下一处理 self.driver.find_element_by_xpath(next_xpath).click() time.sleep(2) #送办公厅发送 self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-EBD5A282-BC4F-4DD8-A58A-A8643EDD4881"]/a' ).click() time.sleep(2) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) elif key == 'wanghuaguang': self.driver.find_element_by_xpath( '//*[@id="grcspSubmitWindow"]/div/div/div[3]/button[2]' ).click() time.sleep(2) #发送文件 self.driver.find_element_by_xpath('//*[@id="send"]').click() time.sleep(2) #纪检组监察室 self.driver.find_element_by_xpath( '//*[@id="dept"]/li[14]').click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="GEditInfoOkButton"]').click() time.sleep(2) # 循环获取alert弹窗,取到则退出循环; while cmcc.is_alert_present() == False: pass cmcc.click_alert() else: # try点选同意单选框,点不到说明是普通意见,在意见框输入1 try: self.driver.find_element_by_xpath(agree_xpath).click() except Exception as e: self.driver.find_element_by_xpath(text_xpath).send_keys(1) time.sleep(1) #按人物执行分支 if key == 'fangfang': #送公司领导签发 self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-6EB1D400-B1D5-4485-BB57-DF190B132BD6"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) #选人界面确认按钮 self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) #提交前确认框确认按钮 self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == 'shangbing': #送办公厅处理 self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) # 循环获取alert弹窗,取到则退出循环 while cmcc.is_alert_present() == False: pass cmcc.click_alert() cmcc.change_to_window(0) cmcc.close()
def test_gsfw(self): #读取配置文件 file_path = os.path.dirname(os.getcwd()) name_path = file_path + '\yaml\\browser.yaml' with open(name_path, 'r') as f: temp = yaml.load(f.read()) #读取xpath #提交按钮 commit_xpath = temp['jcyj']['commit'] #保存意见按钮 save_xpath = temp['jcyj']['save'] #决策意见,同意单选框 agree_xpath = temp['jcyj']['agree'] #不同意单选框 disagree_xpath = temp['jcyj']['disagree'] #其他单选框 other_xpath = temp['jcyj']['other'] #提交前人员确认框,确认按钮 confirm_xpath = temp['confirm'] #提交下一处理按钮 next_xpath = temp['next'] #普通意见,意见输入框 text_xpath = temp['ptyj']['textarea'] now = time.strftime("%Y-%m-%d_%H_%M_%S") for key, value in CmccPage.userList_cshq.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) self.driver.implicitly_wait(30) cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key) #改为列表读取 cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() self.driver.implicitly_wait(5) #关闭提示框 cmcc.click(['id', 'gViewCloseBtnGViewInfo']) time.sleep(2) #非起草人 if key != 'yaobo': #点击第一条待办 self.driver.switch_to.frame('iframecontent-utsmain') self.driver.find_element_by_xpath("//*[@id='todo']/tbody/tr[" + str(1) + "]/td[3]/a").click() time.sleep(2) self.driver.implicitly_wait(30) cmcc.change_to_window(1) #提交下一处理 self.driver.find_element_by_xpath(next_xpath).click() time.sleep(2) # try点选同意单选框,点不到说明是普通意见,在意见框输入1 try: self.driver.find_element_by_xpath(agree_xpath).click() except Exception as e: self.driver.find_element_by_xpath(text_xpath).send_keys(1) time.sleep(1) # 列表设置key首位字符为空格,这类用户填完意见后直接提交 if key[0] == ' ': self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) #按人物执行分支 #youmeng尤梦提交会签分支 if key == ' youmeng': self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-0D8D7D61-88EB-4773-BFA7-ED6325A1BF66_3_switch"]' ).click() time.sleep(1) #选择yangyong杨永 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-0D8D7D61-88EB-4773-BFA7-ED6325A1BF66_4_span"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-0D8D7D61-88EB-4773-BFA7-ED6325A1BF66_5_switch"]' ).click() time.sleep(1) #caixuhui蔡旭辉 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_cjs_deps_sid-0D8D7D61-88EB-4773-BFA7-ED6325A1BF66_6_span"]' ).click() time.sleep(1) #选人界面确认按钮 self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) #提交前确认框确认按钮 self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) #会签完毕,提交主办领导分支 if key == 'youmeng ': self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-27932EF0-46A4-44A3-8D7D-1DAC7CF4B092"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == ' yangyong': # 循环获取alert弹窗,取到则退出循环 while cmcc.is_alert_present() == False: pass cmcc.click_alert() # caixuhui蔡旭辉 送会签人员内部处理分支 if key == 'caixuhui': self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_sid-03B187F8-F516-4E15-AB51-8A891188E3F0"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) #默认选中wangwenchao王文超,再点选lijinze李金泽 self.driver.find_element_by_xpath( '//*[@id="grcsp_left_multi_users_scope_sid-9CB0E098-0227-49FD-9D9E-F57A7031F0B3_3_a"]' ).click() time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="grcsp_selectItemsSubmitButton"]').click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) #送回部门领导审核分支 if key == ' caixuhui ' or key == ' wangwenchao': self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) if key == 'lijinze': self.driver.find_element_by_xpath( '//*[@id="grcsp_tran_li_grcsp_append_processor_false"]/a' ).click() time.sleep(1) self.driver.find_element_by_xpath(commit_xpath).click() time.sleep(2) while cmcc.is_alert_present() == False: pass cmcc.click_alert() #起草 else: # 鼠标悬停。 ele = self.driver.find_element_by_xpath( '//*[@id="nav_sub"]/ul/li[1]/h1/i') ActionChains(self.driver).move_to_element(ele).perform() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="nav_sub"]/ul/li[1]/div/div/dl[1]/dd/a[3]').click( ) self.driver.implicitly_wait(30) cmcc.change_to_window(1) time.sleep(2) #填写表单 self.driver.find_element_by_xpath( '//*[@id="phone"]').send_keys('13901234567') time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="fileTitle"]').send_keys('文件标题' + now) time.sleep(1) self.driver.find_element_by_xpath( '//*[@id="zhuSong"]').send_keys('主送主送主送主送主送主送主送主送') time.sleep(1) #令chrome浏览器可以编辑正文 self.driver.execute_script( '''$("input[name='attachmentZW']").val("正文正文正文正文正文正文正文正文");''' ) time.sleep(1) #提交下一处理 self.driver.find_element_by_xpath(next_xpath).click() time.sleep(2) self.driver.find_element_by_xpath(confirm_xpath).click() time.sleep(2) # 循环获取alert弹窗,取到则退出循环 while cmcc.is_alert_present() == False: pass cmcc.click_alert() cmcc.change_to_window(0) cmcc.close()
def test_bmsw(self): for key, value in CmccPage.userList2.items(): n = 3 driver = BrowserDriver(self) self.driver = driver.openbrowser(self) self.driver.implicitly_wait(30) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key) #改为列表读取 cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() self.driver.implicitly_wait(5) #关闭提示框 cmcc.click(['id', 'gViewCloseBtnGViewInfo']) time.sleep(2) #点击第一条待办 self.driver.switch_to.frame('iframecontent-utsmain') self.driver.find_element_by_xpath("//*[@id='todo']/tbody/tr[" + str(1) + "]/td[3]/a").click() time.sleep(2) windows = self.driver.window_handles self.driver.switch_to.window(windows[1]) self.driver.implicitly_wait(30) time.sleep(2) if key == 'youmingju': #点击发送文件,选择政企分公司 self.driver.find_element_by_xpath('//*[@id="send"]').click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="professionalFirms"]/li[5]').click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="GEditInfoOkButton"]').click() time.sleep(2) #获取alert弹窗 while n: dig_alert = self.driver.switch_to.alert time.sleep(1) # 关闭之 dig_alert.accept() time.sleep(2) n -= 1 self.driver.close() elif key == 'wangyimeng': #点击填写文件编号 self.driver.find_element_by_xpath( '//*[@id="postManager"]').click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="GEditInfoOkButton"]').click() time.sleep(2) #点击提交下一处理-分发文件 self.driver.find_element_by_xpath( '//*[@id="processFormSubmitNext"]').click() time.sleep(2) self.driver.find_element_by_xpath( '// *[ @ id = "grcsp_tran_li_sid-956C3970-656F-4D0D-A539-D7B329FCEB50"] / a' ).click() time.sleep(2) self.driver.find_element_by_xpath( '//*[@id="grcspSubmitWindow"]/div/div/div[3]/button[1]' ).click() time.sleep(2) #选择所有处室负责人并确定 address = self.driver.find_element_by_xpath( '//*[@id="grcsp_left_multi_users_scope_sid-FC9B6E64-EB98-496C-B04E-4E6D09875CD7_9_span"]' ) ActionChains(self.driver).double_click(address).perform() time.sleep(2) self.driver.find_element_by_xpath( '// *[ @ id = "grcsp_selectItemsSubmitButton"]').click() time.sleep(2) self.driver.find_element_by_xpath( '// *[ @ id = "grcsp_submitInWindowButton"]').click() time.sleep(10) #获取alert弹窗 dig_alert = self.driver.switch_to.alert time.sleep(1) # 关闭之 dig_alert.accept() time.sleep(2) self.driver.switch_to.window(windows[0]) cmcc.close()