def selectOrganize(self,organize): oganize_selector = ['id',self.getIdSuffix('select','organize')] HtmlButton(HtmlElement(selector1=oganize_selector).element.find_elements_by_tag_name('span')[2]).clickBtn() oganize1_selector = ['xpath','/html/body/div[2]/ul/li'] HtmlButton(selector1=oganize1_selector).clickBtn() oganize2_selector = ['xpath','/html/body/div[2]/ul[2]'] HtmlSelect(selector1=oganize2_selector).selectLiByText(organize.get('organize3')) if HtmlMenu(selector1=oganize2_selector).element.is_displayed(): HtmlButton(HtmlElement(selector1=oganize_selector).element.find_elements_by_tag_name('span')[2]).clickBtn()
def clickclose(self): # selector = ['xpath','/html/body/div[1]/div/div[2]/section/section/section/main/div/div/div[3]/div/div[1]/button'] selector = [ 'css_selector', '#system_user_modal_showAddAccount > div:nth-child(1) > div:nth-child(1) > button:nth-child(2)' ] HtmlButton(selector1=selector).clickBtn()
def clickOK(self): btn_selector = ['xpath', '/html/body/div[1]/div/div[2]/section/section/section/main/div/div/div[1]/div/div[1]/div[1]/span[4]/button'] HtmlButton(selector1=btn_selector).clickBtn()
def setDialog_addDept(self, testData): deptName_selector = ['id', self.getIdSuffix('input', 'deptName')] deptLeader_selector = [ 'xpath', '/html/body/div[1]/div/div[2]/section/section/section/main/div/div/div[2]/div/div[2]/div/form/div[2]/div/div/div[2]/input' ] deptTel_selector = ['id', self.getIdSuffix('input', 'tel')] deptAddress_selector = ['id', self.getIdSuffix('input', 'address')] deptDesc_selector = ['id', self.getIdSuffix('input', 'desc')] for key in testData: if key == 'deptName': ret = HtmlText(selector1=deptName_selector).setText( testData.get(key)) elif key == 'deptLeader': HtmlButton(selector1=deptLeader_selector).clickBtn() ret = HtmlSelect( selector1=['xpath', '/html/body/div[3]/div[1]/div[1]/ul' ]).selectLiByText(testData.get(key)) elif key == 'tel': ret = HtmlText(selector1=deptTel_selector).setText( testData.get(key)) elif key == 'address': ret = HtmlText(selector1=deptAddress_selector).setText( testData.get(key)) elif key == 'desc': ret = HtmlText(selector1=deptDesc_selector).setText( testData.get(key)) else: ret = False logger.error('invalid parameter %s' % (key)) if ret: logger.info('set %s:%s success' % (key, testData.get(key))) else: logger.error('set %s:%s fail' % (key, testData.get(key)))
def clickAbleBtn(self): addRoleBtn_selector = ['id', self.getIdSuffix('button', 'ableDept')] HtmlButton(selector1=addRoleBtn_selector).clickBtn()
def clickSaveBtn(self): addRoleBtn_selector = ['id', self.getIdSuffix('button', 'deptSave')] HtmlButton(selector1=addRoleBtn_selector).clickBtn()
def clickAddRoleBtn(self): addRoleBtn_selector = ['id', self.getIdSuffix('input', 'addRoleGroup')] HtmlButton(selector1=addRoleBtn_selector).clickBtn()
def clickConfirmBtn(self): HtmlButton( selector1=['xpath', '/html/body/div[2]/div/div[3]/button[2]' ]).clickBtn()
def editRow(self, key_value): self.search(key_value[1]) HtmlButton( selector1=['name', self.getIdSuffix('buttons', '0_editDept')]).clickBtn()
def search(self, keyword): logger.info('search %s' % (keyword)) selector_text = ['id', self.getIdSuffix('input', 'text')] selector_btn = ['id', self.getIdSuffix('button', 'search')] HtmlText(selector1=selector_text).setText(keyword) HtmlButton(selector1=selector_btn).clickBtn()
def clickSaveBtn(self): btn_selector = ['id', self.getIdSuffix('button', 'saveEditAuthority')] HtmlButton(selector1=btn_selector).clickBtn() sleep(1)
def closePopWin(self): try: btn_selector = ['xpath','/html/body/div[1]/div/div[2]/section/section/section/main/div/div/div[2]/div/div[1]/button'] HtmlButton(selector1=btn_selector).clickBtn() except: pass
def clickSaveBtn(self): selector = ['id', self.getIdSuffix('button', 'accountSave')] HtmlButton(selector1=selector).clickBtn()
def clickDisAbleBtn(self): selector = ['id', self.getIdSuffix('button', 'disableAccount')] HtmlButton(selector1=selector).clickBtn()
def clickAddBtn(self): selector = ['id', self.getIdSuffix('button', 'addAccount')] HtmlButton(selector1=selector).clickBtn()
def clickclose(self): selector = [ 'css_selector', '#system_role_modal_showAddRole > div:nth-child(1) > div:nth-child(1) > button:nth-child(2)' ] HtmlButton(selector1=selector).clickBtn()