def createAccount(self, testData): self.clickAddBtn() self.waitForDialog('添加账号') self.setDialog(testData) self.clickSaveBtn() try: self.clickclose() except: logger.debug('close dialog failed')
def waitForDialog(self,expect_title): for i in range(10): try: title = HtmlModule(selector1=['xpath',"/html/body/div[1]/div/div[2]/section/section/section/main/div/div/div[2]/div/div[1]/span"]).element.text logger.debug('dialog title is %s'%(title)) except: sleep(0.5) continue if title == expect_title: logger.info('open dailog of %s success' % (expect_title)) return True else: sleep(0.5) logger.error('open dailog of %s fail'%(expect_title)) return False
def waitForDialog_addRole(self, expect_title): for i in range(10): try: title = HtmlModule(selector1=[ 'xpath', "//div[@id='system_editDept_modal_showAddPersonModel']/div/div[1]/span" ]).element.text logger.debug('dialog title is %s' % (title)) except: sleep(0.5) continue if title == expect_title: logger.info('open dailog of %s success' % (expect_title)) return True else: sleep(0.5) logger.error('open dailog of %s fail' % (expect_title)) return False