def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 第一次审批******************************** driver.find_element_by_xpath('//div[text()="审批中心"]').click() # 跳转iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) # 点击同意按钮 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[text()="同意"]').click() # # 点击审批中心关闭按钮 # driver.find_element_by_xpath('//div[@class="close--MQT19"]//i').click() # 第二次审批********************************** driver.refresh() driver.find_element_by_xpath('//div[text()="审批中心"]').click() # 跳转iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) # 点击同意按钮 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[text()="同意"]').click() # 第三次审批********************************** driver.refresh() driver.find_element_by_xpath('//div[text()="审批中心"]').click() # 跳转iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) # 点击同意按钮 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[text()="同意"]').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="个人所得税申报"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRXC040010') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击组织右侧的按钮 driver.find_element_by_xpath( '//*[@id="c10"]/div/span/span/span/i[2]').click() # 选择组织 driver.find_element_by_xpath('//span[text()="仓储中心-北京"]').click() # 点击确定 driver.find_element_by_xpath( '//div[@class="op-button"]/button[2]').click() # 点击纳税期间按钮 driver.find_element_by_xpath( '//input[@placeholder="纳税期间"]/following-sibling::span[1]/i').click( ) sleep(1) # 选择纳税期间 driver.find_element_by_xpath('//a[text()="十二月"]').click() # 点击生成申请表 driver.find_element_by_xpath('//span[text()="生成申请表"]').click() # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # #进入社交协同 # driver.find_element_by_xpath('//*[text()="数字化建模"]').click() # sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="组织管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="组织单元"]').click() sleep(1) # 跳转模型管理iframe iframe = driver.find_element_by_id('GZTORG001') # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击展开按钮 driver.find_element_by_xpath('//div[@class="expand-icon"]').click() sleep(1) # 进入编辑 driver.find_element_by_xpath('//a[text()="bj_cczx"]').click() sleep(3) # 点击编辑按钮 driver.find_element_by_xpath('//span[text()="编辑"]').click() driver.find_element_by_xpath( '//label[text()="纳税人识别号"]/parent::div/following-sibling::div//input' ).clear() driver.find_element_by_xpath( '//label[text()="纳税人识别号"]/parent::div/following-sibling::div//input' ).send_keys(123456789) # 点击保存 driver.find_element_by_xpath('//span[text()="保存"]').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) #左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) #进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(1) #进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="考勤通用设置"]').click() sleep(2) # 跳转考勤通用规则iframe iframe = driver.find_element_by_id('HRJQ020140') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击编辑按钮 driver.find_element_by_xpath( '//*[@id="app"]/div/div[1]/div[2]/div/button').click() sleep(2) # 点击保存按钮 driver.find_element_by_xpath( '//*[@id="app"]/div/div[3]/button[2]').click() sleep(0.5) text = driver.find_element_by_xpath( '/html/body/div[2]/p[text()="操作成功"]').text self.assertEqual("操作成功", text) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() driver.find_element_by_xpath( '//*[@id="_dropdown_popcontainer"]/div/i').click() driver.find_element_by_xpath( '//*[@id="home_header"]//div[text()="UI测试专属"]').click() driver.find_element_by_xpath( '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]' ).click() sleep(2) #左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) #进入社交协同 driver.find_element_by_xpath('//*[text()="社交协同"]').click() sleep(2) #进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="社交沟通"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="云直播"]').click() cookie = driver.get_cookies() print(cookie) print(driver.get_cookie('acw_tc')) sleep(2) # 跳转我的申请iframe iframe = driver.find_element_by_id('XTYUNZHIBO001') # print(response.json()) # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) driver print(driver.title) print(driver.current_url)
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="税率表"]').click() sleep(2) # 跳转税率表iframe iframe = driver.find_element_by_id('HRXC010040') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) self.assertIn("居民个人工资、薪金所得预扣预缴税率表", driver.page_source) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() driver.find_element_by_xpath('//div[text()="审批中心"]').click() sleep(2) # 跳转模型管理iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) driver.find_element_by_xpath('//div[@class="header"]//div').click() sleep(0.5) driver.find_element_by_xpath('//a[text()="增加应用"]').click() sleep(1) driver.find_element_by_xpath( '//div[text()="财务管理"]/following-sibling::span').click() driver.find_element_by_xpath( '//div[text()="人力云服务"]/following-sibling::span').click() driver.find_element_by_xpath( '//div[text()="协同云服务"]/following-sibling::span').click() driver.find_element_by_xpath( '//div[text()="费用管理"]/following-sibling::span').click() driver.find_element_by_xpath( '//div[text()="采购供应"]/following-sibling::span').click() driver.find_element_by_xpath( '//div[text()="营销管理"]/following-sibling::span').click() driver.find_element_by_xpath( '//div[@class="operation"]/button[2]').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="打卡地点"]').click() sleep(2) # 跳转劳动打卡地点iframe iframe = driver.find_element_by_id('HRJQ020030') # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增按钮 driver.find_element_by_xpath( '//*[@id="attend-place"]//button/span[text()="新增"]').click() sleep(3) # 生成一个随机的区 district = context.get_district() driver.find_element_by_xpath( '//input[@id="suggestId" and @placeholder="请输入地址"]').send_keys( district) sleep(1.5) driver.find_element_by_xpath( '//div[@class="amap-sug-result"]/div[1]').click() # 点击组织右侧按钮 driver.find_element_by_xpath('//div/span/span/span/i[2]').click() sleep(3) # 选中组织 driver.find_element_by_xpath( '//*[@id="ref-tree-container"]//span[text()="仓储中心-北京"]').click() # 点击确认 driver.find_element_by_xpath( '//div[@class="el-dialog__wrapper custom-ref-dialog"]//button[@class="el-button el-button--primary"]' ).click() # # 输入考勤地点 # driver.find_element_by_xpath('//div[@class="form-area"]//div[@class="el-row"]/div[3]//input').send_keys( # "北京市海淀区西北旺镇用友产业园中区8D用友产业园(北京)") sleep(1) # 输入考勤地点距离 length = random.randint(51, 4999) driver.find_element_by_xpath( '//div[@class="form-area"]//div[@class="el-row"]/div[4]//input' ).send_keys(length) # 点击保存 driver.find_element_by_xpath( '//div[@class="form-area"]//button[@class="el-button el-button--primary"]' ).click() sleep(2) # 断言 self.assertIn(str(length), driver.page_source) # 编辑打卡地点 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr//div[text()="编辑"]'.format( length)).click() sleep(3) # 点击保存 driver.find_element_by_xpath( '//div[@class="form-area"]//button[@class="el-button el-button--primary"]' ).click() sleep(3) # # 断言 # text = driver.find_element_by_xpath('//div[text()="1234"]').text # self.assertEqual(text,"1234") # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr//div[@class="operation"][2]'. format(length)).click() sleep(1) # 点击确认 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(1) # 点击启用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr//div[@class="operation"][2]'. format(length)).click() sleep(1) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr//div[@class="operation"][2]'. format(length)).click() sleep(1) # 点击确认 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(1) # 点击删除按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr//div[text()="删除"]'.format( length)).click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() # 断言是否删除成功 sleep(2) self.assertNotIn("{}".format(length), driver.page_source) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 第一次审批******************************** driver.find_element_by_xpath('//div[text()="审批中心"]').click() # 跳转iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) # 点击同意按钮 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[text()="同意"]').click() # # 点击审批中心关闭按钮 # driver.find_element_by_xpath('//div[@class="close--MQT19"]//i').click() # 第二次审批********************************** driver.refresh() driver.find_element_by_xpath('//div[text()="审批中心"]').click() # 跳转iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) # 点击同意按钮 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[text()="同意"]').click() # 第三次审批********************************** driver.refresh() driver.find_element_by_xpath('//div[text()="审批中心"]').click() # 跳转iframe iframe = driver.find_element_by_id('XTSPZX0001') SwitchTo(driver).frame(iframe) sleep(2) # 点击进入单据详情 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[@class="remarkMsg mb-flex remarkRetract"]' ).click() sleep(5) # 点击接受offer driver.find_element_by_xpath('//*[@id="acceptOffer"]').click() sleep(5) # 点击提交按钮 driver.find_element_by_xpath('//*[@id="commitOffer"]').click() sleep(5) # 点击进入单据详情 driver.find_element_by_xpath( '//div[@class="listContainer"]/div[1]//div[@class="remarkMsg mb-flex remarkRetract"]' ).click() sleep(3) # 输入合同期限 driver.find_element_by_xpath('//*[@id="termmonth"]').send_keys("12") # # 输入试用期期限*********************************************** # driver.find_element_by_xpath('//*[@id="promonth"]').send_keys(1) # 点击确认入职 driver.find_element_by_xpath('//*[@id="rz_handler"]').click() # 点击确定按钮 driver.find_element_by_xpath( '//button[@class="btn btn-primary" and text()="确认"]').click() sleep(3) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) #左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) #进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) #进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="员工管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="调动办理"]').click() sleep(2) # 跳转调动办理iframe iframe = driver.find_element_by_id('HRGXFW050') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击试用期转正 driver.find_element_by_xpath( '//*[@id="staffchange-info-content"]//button[text()="汇报关系变动"]' ).click() sleep(2) # 点击变动原因右侧按钮 driver.find_element_by_xpath( '//*[@id="edit_20180605144300O0riJTyD6s"]/div/span[1]').click() sleep(1) # 选择变动原因 driver.find_element_by_xpath( '//span[text()="变动原因"]/ancestor::div[@class="innerContainer"]//td[text()="3002002"]' ).click() # 选择生效日期 driver.find_element_by_xpath( '//*[@id="edit_20180605144233owHkX1lVku"]/div/span[1]').click() # 选择当前天 # driver.find_element_by_xpath('//div[@class="u-date-panel is-visible"]//div[@class="u-date-cell current"]').click() driver.find_element_by_xpath( '//*[@id="edit_20180605144233owHkX1lVku"]/div/div/div[1]/div/button[2]' ).click() driver.find_element_by_xpath( '//*[@id="edit_20180605144233owHkX1lVku"]/div/div/div[1]/div/div/div[3]/div[18]' ).click() # 个人信息选择变更人 driver.find_element_by_xpath( '//*[@id="201806051443543jFBPtjxiT"]').send_keys(Name.random_name) # driver.find_element_by_xpath('//*[@id="20180730174750cYVuonidOU"]').send_keys("戴英") print(Name.random_name) setattr(Name, "random_name", None) driver.find_element_by_xpath( '//*[@id="201806051443543jFBPtjxiT"]').click() sleep(5) driver.find_element_by_xpath( '//*[@id="201806051443543jFBPtjxiT"]').send_keys(Keys.ENTER) # 点击提交按钮 sleep(3) driver.find_element_by_xpath( '//button[@class="btn btn-primary"]/span[@data-bind="text: editFlag.button"]' ).click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="规则设置"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRXC010010') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # # 点击公共薪资项目管控模式右侧的按钮 # driver.find_element_by_xpath( # '//span[text()="公共薪资项目管控模式:"]/ancestor::div[@class="ref-col el-col el-col-24"]//i[@class = "el-select__caret el-input__icon el-icon-arrow-up"]').click() # sleep(2) # # 选择条目 # driver.find_element_by_xpath( # '//div[@class="el-autocomplete-suggestion"]/following-sibling::div//li[1]').click() # 点击薪资方案管控模式右侧的按钮 driver.find_element_by_xpath( '//span[text()="薪资方案管控模式:"]/ancestor::div[@class="ref-col el-col el-col-24"]//i[@class = "el-select__caret el-input__icon el-icon-arrow-up"]' ).click() sleep(1) # 点击选择条目 driver.find_element_by_xpath( '//div[@class="el-autocomplete-suggestion"]/following-sibling::div//li[2]' ).click() # # # 点击放弃按钮 # driver.find_element_by_xpath('//span[text()="放弃"]').click() # sleep(2) # # # 弹出框 点击放弃保存 # driver.find_element_by_xpath( # '//div[@role="dialog"]//button[@class="el-button el-button--default el-button--small el-button--primary "]').click() # sleep(1) # 点击保存按钮 driver.find_element_by_xpath( '//*[@id="app"]/div/div[2]/button[2]').click() sleep(0.75) self.assertEqual( "操作成功", driver.find_element_by_xpath('//p[text()="操作成功"]').text) # 切换全局组织参数页签 driver.find_element_by_xpath('//div[text()="全局/组织参数"]').click() # # 点击选择下级按钮 # driver.find_element_by_xpath('//div[text()="控制下级"]//span[@class="el-switch__core"]').click() # ele = driver.find_element_by_xpath('//div[text()="控制下级"]//input[@type="text"]') # self.assertIsNotNone(ele) # 点击放弃按钮 driver.find_element_by_xpath( '//*[@id="app"]/div/div[2]/button[1]').click() sleep(1) # 弹出框 点击取消 driver.find_element_by_xpath( '//div[@role="dialog"]//div[@class="el-message-box__btns"]//button[1]' ).click() sleep(0.5) # 点击保存 driver.find_element_by_xpath( '//*[@id="app"]/div/div[2]/button[2]').click() sleep(1) self.assertEqual( "操作成功", driver.find_element_by_xpath('//p[text()="操作成功"]').text) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="员工管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="转正办理"]').click() sleep(2) # 跳转转正办理iframe iframe = driver.find_element_by_id('HRGXFW040') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击试用期转正 driver.find_element_by_xpath( '//*[@id="common-btn"]/button[text()="试用期转正"]').click() sleep(2) # 点击转正员工输入框 driver.find_element_by_xpath( '//*[@id="20180730174750cYVuonidOU"]').send_keys(Name.random_name) # driver.find_element_by_xpath('//*[@id="20180730174750cYVuonidOU"]').send_keys("戴英") print(Name.random_name) setattr(Name, "random_name", None) driver.find_element_by_xpath( '//*[@id="20180730174750cYVuonidOU"]').click() sleep(5) driver.find_element_by_xpath( '//*[@id="20180730174750cYVuonidOU"]').send_keys(Keys.ENTER) # 点击提交按钮 sleep(3) driver.find_element_by_xpath('//*[@id="save2"]/span').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="薪资期间"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRXC010020') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增薪资区间 driver.find_element_by_xpath('//i[@title="新增"]').click() sleep(2) # 输入期间名称 num = random.randint(100, 999) name = "期间{}".format(num) driver.find_element_by_xpath( '//label[text()="期间名称"]/following-sibling::div//input').send_keys( name) # 点击起始2期间右侧的按钮 driver.find_element_by_xpath( '//label[text()="起始期间"]/following-sibling::div//span[@class = "el-input__prefix"]' ).click() sleep(1) # 点击选择条目 driver.find_element_by_xpath('//a[text()="一月"]').click() # 输入描述信息 driver.find_element_by_xpath('//textarea').send_keys("描述信息") # 点击保存 driver.find_element_by_xpath( '//div[@class = "salary-duration-card-button"]//button[2]').click( ) sleep(0.1) # self.assertEqual("保存成功",driver.find_element_by_xpath('//p[text()="保存成功"]').text) self.assertIn(name, driver.page_source) # print(driver.page_source) sleep(2) # 点击编辑按钮 driver.find_element_by_xpath('//span[text()="修改"]').click() # 点击保存按钮 driver.find_element_by_xpath( '//div[@class = "salary-duration-card-button"]//button[2]').click( ) sleep(0.5) self.assertEqual( "保存成功", driver.find_element_by_xpath('//p[text()="保存成功"]').text) # 生成薪资期间明细 driver.find_element_by_xpath('//span[text()="生成"]').click() sleep(0.5) self.assertEqual( "生成成功", driver.find_element_by_xpath('//p[text()="生成成功"]').text) # 点击删除按钮 driver.find_element_by_xpath('//i[@title="删除"]').click() sleep(1) # 点击确定按钮 driver.find_element_by_xpath( '//div[@role="dialog"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(0.75) # 断言删除成功 # self.assertEqual("删除成功!", driver.find_element_by_xpath('//p[text()="删除成功!"]').text) self.assertNotIn(name, driver.page_source) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="劳动合同"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="劳动合同续签"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRGXFW110') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增按钮 driver.find_element_by_xpath( '//*[@id="flowApprove"]//button[@class="btn btn-primary"]').click( ) sleep(2) # 输入员工信息 driver.find_element_by_xpath('//*[@id="searchVal"]').send_keys( context.Name.random_name) # driver.find_element_by_xpath('//*[@id="20180621192702NpniVowGaI"]').send_keys("戴英") # driver.find_element_by_xpath('//*[@id="searchVal"]').click() sleep(2) driver.find_element_by_xpath('//*[@id="searchVal"]').send_keys( Keys.ENTER) driver.find_element_by_xpath( '//*[@id="staffAllBody"]/div[2]/table/tbody/tr/td[1]/div/div/label' ).click() # 点击确定 sleep(1) driver.find_element_by_xpath( '//div[@class="modal-footer"]//button[@class="btn btn-primary"]' ).click() # 输入签订日期 driver.find_element_by_xpath( '//*[@id="edit_20180621192735yOPB73tQ1J"]/div/span[1]').click() driver.find_element_by_xpath( '//*[@id="edit_20180621192735yOPB73tQ1J"]/div/div/div[1]/div/div/div/div[1]' ).click() sleep(0.5) driver.find_element_by_xpath( '//*[@id="edit_20180621192735yOPB73tQ1J"]/div/div/div[1]/div/div/div[2]/div[12]' ).click() sleep(0.5) driver.find_element_by_xpath( '//*[@id="edit_20180621192735yOPB73tQ1J"]/div/div/div[1]/div/div/div[2]/div[12]' ).click() sleep(0.5) driver.find_element_by_xpath( '//*[@id="edit_20180621192735yOPB73tQ1J"]//div[@class="u-date-panel is-visible"]//div[@class="u-date-cell current"]' ).click() # 输入合同开始日期 driver.find_element_by_xpath( '//*[@id="edit_20180621192744bUtHIJSxgW"]/div/span[1]').click() driver.find_element_by_xpath( '//*[@id="edit_20180621192744bUtHIJSxgW"]/div/div/div[1]/div/div/div[1]/div[1]' ).click() sleep(0.5) driver.find_element_by_xpath( '//*[@id="edit_20180621192744bUtHIJSxgW"]/div/div/div[1]/div/div/div[2]/div[12]' ).click() sleep(0.5) driver.find_element_by_xpath( '//*[@id="edit_20180621192744bUtHIJSxgW"]/div/div/div[1]/div/div/div[2]/div[12]' ).click() sleep(0.5) driver.find_element_by_xpath( '//*[@id="edit_20180621192744bUtHIJSxgW"]//div[@class="u-date-panel is-visible"]//div[@class="u-date-cell current"]' ).click() # 输入合同期限 driver.find_element_by_xpath( '//*[@id="20180621192746amEPBBYzuc"]').send_keys(24) # 输入合同 driver.find_element_by_xpath( '//*[@id="edit_20180621192753n2mwSiT6Fv"]/div/span[1]').click() # 选择条目 driver.find_element_by_xpath( '//*[@id="refContainer20180621192753n2mwSiT6Fv"]/div/div/div[2]/ul[3]/div/div[1]/div[2]/div[2]/div[1]/table/tbody/tr[1]' ).click() # 输入工作地点 driver.find_element_by_xpath( '//*[@id="edit_201806211927544Ff3WSQIEr"]/div/span[1]').click() # 选择条目 driver.find_element_by_xpath( '//*[@id="refContainer201806211927544Ff3WSQIEr"]/div/div/div[2]/ul[3]/div/div[1]/div[2]/div[2]/div[1]/table/tbody/tr[1]' ).click() # 点击输入备注信息 desc = context.get_paragraph() driver.find_element_by_xpath( '//*[@id="20180621192757joRkiYUBhD"]').send_keys(desc) # 点击保存按钮 driver.find_element_by_xpath( '//*[@id="templatePanel"]//button/span[text()="保存"]').click() sleep(3) text = driver.find_element_by_xpath( '//*[@id="templatePanel"]//button/span[text()="编辑"]').text self.assertEqual("编辑", text) # 点击提交按钮 driver.find_element_by_xpath( '//*[@id="templatePanel"]//button/span[text()="提交"]').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="定调资申请"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRXC020010') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增按钮 driver.find_element_by_xpath('//div[@class= "el-row"]//button').click() sleep(2) num = random.randint(100, 999) name = "申请单{}".format(num) # 输入申请单名称 driver.find_element_by_xpath( '//label[text()="申请单名称"]/following-sibling::div//input').send_keys( name) # 点击所属组织右侧的按钮 driver.find_element_by_xpath( '//label[text()="所属组织"]/following-sibling::div//span[@class="el-input__suffix"]' ).click() sleep(1) # 点击选择条目 driver.find_element_by_xpath( '//span[text()="仓储中心-北京"]/parent::span').click() # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]/button[2]').click() sleep(0.5) # 点击新增人员 driver.find_element_by_xpath('//span[text()="新增人员"]').click() sleep(2) # 选择人员 driver.find_element_by_xpath( '//*[@id="ref-tree-grid-container"]//div[3]/table/tbody/tr[1]/td[1]//label' ).click() # 点击确定 driver.find_element_by_xpath( '//div[@class="op-button"]//button[2]').click() sleep(1) # 点击全选按钮 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div[2]/div/div[5]/div[1]/table/thead/tr[1]/th[1]/div/label/span/span' ).click() sleep(1) # 点击批量修改 driver.find_element_by_xpath( '//button[@class="el-button el-button--info"]//span[text()="批量修改"]' ).click() # 点击时间 driver.find_element_by_xpath( '//span[text()="按生效日期"]/preceding-sibling::span/span').click() # 点击生效日期右侧的按钮 driver.find_element_by_xpath( '//label[text()="生效日期"]/following-sibling::div//i[@class="el-input__icon iconfont wui-Calendar_bold"]' ).click() # 选择当天 driver.find_element_by_xpath( '//td[@class="available today"]/div/span').click() # 点击薪资项目右侧按钮 driver.find_element_by_xpath( '//label[text()="薪资项目"]/following-sibling::div//span[@class="el-input__suffix"]' ).click() sleep(1) # 选择项目 driver.find_element_by_xpath( '//*[@id="ref-tree-grid-container"]//div[3]/table//tr[1]').click() # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]//button[2]').click() # # 输入变动原因 # driver.find_element_by_xpath('//textarea').send_keys("变动原因123456") # 输入变动金额 driver.find_element_by_xpath( '//label[text()="申请金额"]/following-sibling::div//input').send_keys( 80000) # 点击确定 driver.find_element_by_xpath( '//div[@class="dialog-footer"]//button[@class="el-button el-button--primary"]' ).click() # 点击保存 driver.find_element_by_xpath( '//div[@style="float: right;"]//button[2]').click() sleep(1) # 点击提交 driver.find_element_by_xpath( '//div[@class="salary-apply-card-top-header-right"]//button[3]' ).click() sleep(1) self.assertEqual( "提交成功!", driver.find_element_by_xpath('//p[text()="提交成功!"]').text) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="员工管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="录用办理"]').click() sleep(2) # 跳转录用办理iframe iframe = driver.find_element_by_id('HRGXFW010') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击实习生入职 driver.find_element_by_xpath( '//div[@class="staff-info-control-btn fr"]/button[text()="实习生入职"]' ).click() sleep(2) # 随机生成注册人员姓名 random_name = context.get_reg_name() # 赋值到context setattr(Name, "random_name", random_name) driver.find_element_by_xpath( '//*[@id="20180509105133DpcOx60LOa"]').send_keys(random_name) # 选择证件类型,点击右侧按钮 driver.find_element_by_xpath( '//*[@id="edit_20181009204747YWFw2liMwv"]/div/span[1]').click() # 选择身份证类型 driver.find_element_by_xpath( '//table[@class="msgtype-table table-hover table table-no-bordered"]//td[text()="居民身份证"]' ).click() # 输入身份证号码 ID_CARD = context.get_cre_id() driver.find_element_by_xpath( '//*[@id="20180509105133gZbhMtqK9n"]').send_keys(ID_CARD) sleep(0.5) # 点击个人邮箱 # 生成一个随机邮箱 email_num = context.get_email() # 输入邮箱号码 driver.find_element_by_xpath( '//*[@id="20180509105133q64hRYzrKY"]').send_keys(email_num) # 生成随机号码 phone = context.get_mobile() # 点击手机号码 driver.find_element_by_xpath( '//*[@id="20180509105133OWWbB8ongy"]').send_keys(phone) # 点击最高学历右侧的按钮 driver.find_element_by_xpath( '//*[@id="edit_20180719193255BtyQkkHEeD"]//span').click() # 选择学历信息 driver.find_element_by_xpath( '//div[@class="scroll-wrapper fixed-table-body scrollbar-dynamic"]//td[text()="博士后"]' ).click() # 输入工作日期 driver.find_element_by_xpath( '//*[@id="edit_20180509105133EhPNtIJgEk"]/div/span[1]').click() driver.find_element_by_xpath( '//*[@id="edit_20180509105133EhPNtIJgEk"]//div[@class="u-date-panel is-visible"]//div[@class="u-date-cell current"]' ).click() # 预计入职日期 driver.find_element_by_xpath( '//*[@id="edit_20180509105133ILCsggy7fK"]/div/span[1]').click() driver.find_element_by_xpath( '//div[@class="u-date-panel is-visible"]//div[@class="u-date-cell current"]' ).click() # 点击人员类别按钮 driver.find_element_by_xpath( '//*[@id="edit_20180509105133KUUJzi1zqv"]/div/span[1]').click() # 选择人员类别 driver.find_element_by_xpath( '//*[@id="refContainer20180509105133KUUJzi1zqv"]//td[text()="1123"]' ).click() # 输入主管 driver.find_element_by_xpath( '//*[@id="20180509105133EXIp9xoDFE"]').send_keys('黄俊涛') driver.find_element_by_xpath( '//*[@id="20180509105133EXIp9xoDFE"]').click() sleep(3) driver.find_element_by_xpath( '//*[@id="20180509105133EXIp9xoDFE"]').send_keys(Keys.ENTER) # 点击所属公司 driver.find_element_by_xpath( '//*[@id="20180509105133aEJwm8bmGE"]').send_keys("仓储中心") driver.find_element_by_xpath( '//*[@id="20180509105133aEJwm8bmGE"]').click() sleep(2) driver.find_element_by_xpath( '//*[@id="20180509105133aEJwm8bmGE"]').send_keys(Keys.ENTER) # 点击所属部门 driver.find_element_by_xpath( '//*[@id="20180509105133pTCmKwGwPQ"]').send_keys("仓储中心") driver.find_element_by_xpath( '//*[@id="20180509105133pTCmKwGwPQ"]').click() sleep(2) driver.find_element_by_xpath( '//*[@id="20180509105133pTCmKwGwPQ"]').send_keys(Keys.ENTER) # 输入日薪 driver.find_element_by_xpath( '//*[@id="20180509105133gSQtBR2Ckf"]').send_keys("10000") # 点击提交按钮 driver.find_element_by_xpath( '//button[@class="btn btn-primary"]//span[@class="btn-primary" and text()="提交"]' ).click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(1) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="假勤方案"]').click() sleep(2) # 跳转假勤方案iframe iframe = driver.find_element_by_id('HRJQ020090') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) source = driver.page_source str1 = 'new假勤方案' # 点击新建假勤方案 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div[1]/div/div[1]/ul/li[1]').click() sleep(2) # 点击组织按钮 driver.find_element_by_xpath( '//*[@id="c37"]/div/span/span/span/i[2]').click() # 点击组织展开按钮 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//div[@role="group"]/div[1]/div/span[1]' ).click() # 点击组织 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//div[@role="group"]/div[1]/div/span[2]' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//button[@class="el-button el-button--primary"]' ).click() sleep(1) # 输入姓名 num = random.randint(1000, 9999) name = "new假勤方案{}".format(num) driver.find_element_by_xpath( '//label[text()="名称:"]/parent::div//input').send_keys(name) # 点击组织按钮 driver.find_element_by_xpath( '//label[text()="适用范围"]/parent::div//span[text()="选组织"]').click() sleep(3) # 选择北京仓储中心 driver.find_element_by_xpath( '//span[text()="仓储中心-北京"]/ancestor::div[@class="el-tree-node__content"]/label/span' ).click() sleep(1) # 点击确定按钮 driver.find_element_by_xpath( '//div[@role="dialog"]//button[@class="el-button el-button--primary"]' ).click() # 点击保存按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() sleep(2) if source.find(str1) >= 0: driver.find_element_by_xpath( '//div[5]/div/div[3]/button[2]/span').click() # # 点击覆盖按钮 # driver.find_element_by_xpath('//span[text()="提示"]/ancestor::div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]').click() # 断言 driver.find_element_by_xpath( '//span[text()="{}"]'.format(name)).click() # 点击编辑 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div[2]/div/div[1]/button').click() # # 点击组织按钮 # driver.find_element_by_xpath('//label[text()="适用范围"]/parent::div//span[text()="选组织"]').click() # sleep(3) # 选择北京仓储中心 # sleep(1) # driver.find_element_by_xpath('//span[text()="仓储中心-北京"]/ancestor::div[@class="el-tree-node__content"]/label/span').click() # # 点击确定按钮 # driver.find_element_by_xpath('//div[@role="dialog"]//button[@class="el-button el-button--primary"]').click() # 点击保存按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() # # 点击覆盖按钮 # driver.find_element_by_xpath('//span[text()="提示"]/ancestor::div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]').click() # 点击删除 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div[1]/div/div[1]/ul/li[2]').click() # 弹出框点击确认 driver.find_element_by_xpath( '//div[@aria-label="提示"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(0.5) text_dele = driver.find_element_by_xpath('/html/body/div[5]/p').text self.assertEqual("删除成功!", text_dele) # 点击新建假勤方案 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div[1]/div/div[1]/ul/li[1]').click() sleep(2) # 点击组织按钮 driver.find_element_by_xpath( '//*[@id="c37"]/div/span/span/span/i[2]').click() # 点击组织展开按钮 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//div[@role="group"]/div[1]/div/span[1]' ).click() # 点击组织 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//div[@role="group"]/div[1]/div/span[2]' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//button[@class="el-button el-button--primary"]' ).click() sleep(1) # 输入姓名 num = random.randint(1000, 9999) name = "new假勤方案{}".format(num) driver.find_element_by_xpath( '//label[text()="名称:"]/parent::div//input').send_keys(name) # 点击组织按钮 driver.find_element_by_xpath( '//label[text()="适用范围"]/parent::div//span[text()="选组织"]').click() sleep(3) # 选择北京仓储中心 driver.find_element_by_xpath( '//span[text()="仓储中心-北京"]/ancestor::div[@class="el-tree-node__content"]/label/span' ).click() sleep(1) # 点击确定按钮 driver.find_element_by_xpath( '//div[@role="dialog"]//button[@class="el-button el-button--primary"]' ).click() # 点击保存按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="员工管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="员工信息"]').click() sleep(2) # 跳转员工信息iframe iframe = driver.find_element_by_id('HRPA020') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增按钮 driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]//button//span[text()="新增"]' ).click() sleep(2) # 输入姓名 random_name = context.get_reg_name() driver.find_element_by_xpath( '//span[text()="姓名:"]/parent::span/following-sibling::input' ).send_keys(random_name) setattr(Name, "random_name", random_name) # 选择证件信息 driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[2]/form/fieldset/div[2]/div[1]/span[1]' ).click() driver.find_element_by_xpath( '//*[@id="refContainercert_type"]//td[text()="0000000001"]').click( ) # 输入证件信息 idcard = context.get_cre_id() driver.find_element_by_xpath('//*[@id="validFix"]/input[1]').send_keys( idcard) # 输入手机号信息 phone = context.get_mobile() driver.find_element_by_xpath( '//span[text()="手机:"]/parent::span/following-sibling::input' ).send_keys(phone) # 输入参加工作日期 driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[2]/form/fieldset/div[4]/div/label/i' ).click() driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[2]/form/fieldset/div[4]/div//div[@class="u-date-cell current"]' ).click() # 输入邮箱 emil = context.get_email() driver.find_element_by_xpath( '//span[text()="邮箱:"]/parent::span/following-sibling::input' ).send_keys(emil) # 输入所属组织 driver.find_element_by_xpath( '//span[text()="所属组织:"]/parent::span/following-sibling::div[@class="input-group form-ref"]//input' ).send_keys("仓储中心-北京") driver.find_element_by_xpath( '//span[text()="所属组织:"]/parent::span/following-sibling::div[@class="input-group form-ref"]//input' ).click() sleep(3) driver.find_element_by_xpath( '//span[text()="所属组织:"]/parent::span/following-sibling::div[@class="input-group form-ref"]//input' ).send_keys(Keys.ENTER) # 输入任职开始时间 driver.find_element_by_xpath( '//span[text()="任职开始日期:"]/parent::span/following-sibling::div//i' ).click() driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]//div[@class="u-date-panel is-visible"]//div[@class="u-date-cell current"]' ).click() # 输入所属部门 driver.find_element_by_xpath( '//span[text()="所属部门:"]/parent::span/following-sibling::div[@class="input-group form-ref"]//input' ).send_keys("仓储中心-北京") driver.find_element_by_xpath( '//span[text()="所属部门:"]/parent::span/following-sibling::div[@class="input-group form-ref"]//input' ).click() sleep(3) driver.find_element_by_xpath( '//span[text()="所属部门:"]/parent::span/following-sibling::div[@class="input-group form-ref"]//input' ).send_keys(Keys.ENTER) # 点击人员类别左侧按钮 driver.find_element_by_xpath( '//span[text()="人员类别:"]/parent::span/following-sibling::div//span' ).click() driver.find_element_by_xpath( '//span[text()="人员类别参照"]/ancestor::div[@id="refContainerpsncl_id"]//div[@class="refer_results2"]/ul[3]//div[@class="scroll-wrapper fixed-table-body scrollbar-dynamic"]//tbody/tr[1]' ).click() # 点击职务右侧按钮 driver.find_element_by_xpath( '//span[text()="职务:"]/parent::span/following-sibling::div//span' ).click() driver.find_element_by_xpath( '//span[text()="职务"]/ancestor::div[@id="refContainerjob_id"]//div[@class="refer_results2"]/ul[3]//div[@class="scroll-wrapper fixed-table-body scrollbar-dynamic"]//tbody/tr[1]' ).click() # 点击职位 driver.find_element_by_xpath( '//span[text()="职位:"]/parent::span/following-sibling::div//span' ).click() driver.find_element_by_xpath( '//span[text()="职位"]/ancestor::div[@id="refContainerpost_id"]//div[@class="refer_results2"]/ul[3]//div[@class="scroll-wrapper fixed-table-body scrollbar-dynamic"]//tbody/tr[1]' ).click() # 点击入职类型右侧按钮 driver.find_element_by_xpath( '//span[text()="入职类型:"]/parent::span/following-sibling::div//span' ).click() driver.find_element_by_xpath( '//*[@id="refContainertrnstype"]//td[text()="1001"]').click() # 输入主管姓名 driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[2]/form/fieldset/div[7]/div[2]/input' ).send_keys("黄俊涛") driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[2]/form/fieldset/div[7]/div[2]/input' ).click() sleep(3) driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[2]/form/fieldset/div[7]/div[2]/input' ).send_keys(Keys.ENTER) # 点击保存按钮 driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]//button//span[text()="保存"]' ).click() sleep(3) driver.find_element_by_xpath( '//input[@type="text" and @placeholder="搜索所属公司/部门/姓名"]').send_keys( context.Name.random_name) driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]/div[1]/div[1]/hr-search/span/label' ).click() text = driver.find_element_by_xpath( '//*[@id="staff-info-all-content"]//tbody//td[text()="{}"]'.format( context.Name.random_name)).text self.assertEqual(context.Name.random_name, text) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(1) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(1) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="公共薪资项目"]').click() sleep(2) # 跳转公共薪资项目iframe iframe = driver.find_element_by_id('HRXC010030') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增项目分类 driver.find_element_by_xpath('//i[@title="新增项目分类"]').click() sleep(0.5) # 输入项目名称 num = random.randint(100, 999) names = "项目分类{}".format(num) setattr(Name, "names", names) driver.find_element_by_xpath('//div[@class="addInput el-input"]//input').send_keys(names) driver.find_element_by_xpath('//i[@title="新增项目分类"]').click() sleep(1) self.assertEqual("操作成功!", driver.find_element_by_xpath('//p[text()="操作成功!"]').text) # 点击新增按钮 driver.find_element_by_xpath( '//div[@class="fn-div"]//button[@class="el-button to-r el-button--primary"]').click() sleep(1) # 输入项目名称 num = random.randint(100, 999) project = "项目{}".format(num) setattr(Name, "project", project) driver.find_element_by_xpath('//label[text()="项目名称"]/following-sibling::div//input').send_keys(project) # 点击数据来选按钮 driver.find_element_by_xpath( '//label[text()="数据来源"]/following-sibling::div//span[@class = "el-input__suffix"]').click() # 选择条目 driver.find_element_by_xpath('//span[text()="定调资档案"]/parent::li').click() # 申报个税属性按钮 driver.find_element_by_xpath('//span[@class="el-cascader__label"]').click() sleep(1) driver.find_element_by_xpath('//span[text()="纳税收入"]').click() # 输入项目说明 driver.find_element_by_xpath('//textarea').send_keys("项目信息12345") # 点击保存按钮 driver.find_element_by_xpath('//div[@class="bottom-fn"]//button[2]').click() sleep(1.5) # 断言是否保存成功 self.assertEqual("操作成功!", driver.find_element_by_xpath('//p[text()="操作成功!"]').text) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath('//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # #进入社交协同 # driver.find_element_by_xpath('//*[text()="数字化建模"]').click() # sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="流程管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="模型管理"]').click() sleep(1) # 跳转模型管理iframe iframe = driver.find_element_by_id('XTLCZX0006') # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击左侧树按钮 driver.find_element_by_xpath('//*[@id="app"]//span[text()="人力资源"]').click() sleep(1) # 点击左侧树按钮 driver.find_element_by_xpath('//*[@id="app"]//span[text()="薪资核算"]').click() sleep(1) wins0 = driver.window_handles # 选中请假 driver.find_element_by_xpath('//*[@id="app"]//span[text()="定调薪"]').click() # 点击新增按钮 driver.find_element_by_xpath('//div[@class="btns-wrapper"]//button[1]').click() sleep(2) # 输入流程名称 driver.find_element_by_xpath('//label[text()="名称"]/following-sibling::div//input').send_keys('定调薪流程') # 备注信息 driver.find_element_by_xpath('//textarea').send_keys("备注信息0002") # 点击确定按钮 driver.find_element_by_xpath( '//span[text()="新增流程模型"]/ancestor::div[@class="el-dialog__wrapper"]//button[2]').click() sleep(1) # 断言 self.assertEqual("创建成功", driver.find_element_by_xpath('//p[text()="创建成功"]').text) # 点击设计按钮 driver.find_element_by_xpath( '//*[@id="app"]//table[@class="el-table__body"]/tbody/tr/td[4]/div/span[2]').click() # 跳转新页面 wins = driver.window_handles driver.switch_to_window(wins[-1]) sleep(2) # 双击主管审批 # driver.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[2]/button[2]').click() # driver.find_element_by_xpath('//span[@title="主管审批"]').doubleClick() driver.find_element_by_xpath('//div[@id="designer"]//div/span[1]/span').doubleClick() sleep(2) # 输入节点名称 driver.find_element_by_xpath('//input[@placeholder="请输入流程环节名称"]').send_keys("提交") # 移动滚动条 action = ActionChains(driver) ele = driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[4]/div') action.drag_and_drop_by_offset(ele, 1, 110) action.perform() sleep(1) # 点击审批流的发起人 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[2]/div[2]/div[2]/label[1]/span[2]').click() # 点击保存 driver.find_element_by_xpath('//button[@class="yy-btn yy-btn-primary"]').click() # 点击保存并发布 driver.find_element_by_xpath('//button[@class="right-run yy-btn yy-btn-primary"]').click() driver.close() # 跳转回原来的页面 win1 = driver.window_handles driver.switch_to_window(win1[0]) # 关闭当前页面 sleep(2) driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath('//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) #左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) #进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(1) #进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="出差规则"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRJQ020080') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击新建规则 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]').click() sleep(2) # 点击所属组织右侧按钮 driver.find_element_by_xpath( '//*[@id="c55"]/div/span/span/span/i[2]').click() sleep(3) # 选择北京仓储中心 driver.find_element_by_xpath( '//div[@role="dialog"]//span[text()="仓储中心-北京"]').click() # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]//button[@class="el-button el-button--primary"]' ).click() # 输入规则名称 num = random.randint(1000, 9999) str_gz = "规则{}".format(num) driver.find_element_by_xpath( '//label[text()="规则名称"]/ancestor::div[@class="el-form-item is-required"]//input' ).send_keys(str_gz) # 备注信息 driver.find_element_by_xpath( '//*[@id="basicInfo"]//textarea').send_keys("新增加班规则") # 点击保存 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() sleep(2) self.assertIn(str_gz, driver.page_source) # 编辑考勤规则 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="编辑"]' ).click() sleep(2) # 点击保存按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() sleep(2) driver.switch_to.default_content() sleep(1) ele = driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/p') action = ActionChains(driver) action.move_to_element(ele) action.perform() driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div[2]/div/button[1]/i' ).click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRJQ020080') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[2]'.format( str_gz)).click() sleep(1) # 点击确认 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(1) # 点击启用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[2]'.format( str_gz)).click() sleep(1) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[2]'.format( str_gz)).click() sleep(1) # 点击确认 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(1) # 点击删除按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[3]'.format( str_gz)).click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() # 断言是否删除成功 sleep(2) self.assertNotIn(str_gz, driver.page_source) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # #进入社交协同 # driver.find_element_by_xpath('//*[text()="数字化建模"]').click() # sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="流程管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="模型管理"]').click() sleep(2) # 跳转模型管理iframe iframe = driver.find_element_by_id('XTLCZX0006') # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击左侧树按钮 driver.find_element_by_xpath( '//*[@id="app"]//span[text()="人力资源"]').click() sleep(6) # 点击左侧树按钮 driver.find_element_by_xpath( '//*[@id="app"]//span[text()="员工管理"]').click() sleep(3) wins0 = driver.window_handles # 选中请假 driver.find_element_by_xpath( '//*[@id="app"]//span[text()="实习生入职"]').click() # 点击设计按钮 driver.find_element_by_xpath( '//*[@id="app"]//table[@class="el-table__body"]/tbody/tr/td[4]/div/span[2]' ).click() # 跳转新页面 wins = driver.window_handles driver.switch_to_window(wins[-1]) sleep(3) sleep(2) driver.find_element_by_xpath( '//span[@class="icon-designer-banner active"]').click() driver.find_element_by_xpath( '//span[@class="button icon-designer-minus"]').click() sleep(0.5) driver.find_element_by_xpath( '//span[@class="button icon-designer-minus"]').click() sleep(0.5) driver.find_element_by_xpath( '//span[@class="button icon-designer-minus"]').click() sleep(0.5) driver.find_element_by_xpath( '//span[@class="button icon-designer-minus"]').click() sleep(0.5) driver.find_element_by_xpath( '//span[@class="button icon-designer-minus"]').click() sleep(0.5) # 双击主管审批 # driver.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[2]/button[2]').click() driver.find_element_by_xpath('//span[@title="入职审批"]').doubleClick() sleep(3) action = ActionChains(driver) ele = driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[4]/div' ) action.drag_and_drop_by_offset(ele, 1, 110) action.perform() sleep(1) # 点击审批流的发起人 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[2]/div[2]/div[2]/label[1]/span[2]' ).click() # 点击保存 driver.find_element_by_xpath( '//button[@class="yy-btn yy-btn-primary"]').click() # 双击BP_header # driver.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[2]/button[2]').click() driver.find_element_by_xpath('//span[@title="入职审批-BP"]').doubleClick() sleep(3) action = ActionChains(driver) ele = driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[4]/div' ) action.drag_and_drop_by_offset(ele, 1, 110) action.perform() sleep(1) # 点击审批流的发起人 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[2]/div[2]/div[2]/label[1]/span[2]' ).click() # 点击保存 driver.find_element_by_xpath( '//button[@class="yy-btn yy-btn-primary"]').click() # 双击BP_header # driver.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[2]/button[2]').click() driver.find_element_by_xpath('//span[@title="发送offer"]').doubleClick() sleep(3) action = ActionChains(driver) ele = driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[4]/div' ) action.drag_and_drop_by_offset(ele, 1, 110) action.perform() sleep(1) # 点击审批流的发起人 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[2]/div[2]/div[2]/label[1]/span[2]' ).click() # 点击保存 driver.find_element_by_xpath( '//button[@class="yy-btn yy-btn-primary"]').click() # 双击BP_header # driver.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[2]/button[2]').click() driver.find_element_by_xpath('//span[@title="入职办理"]').doubleClick() sleep(3) action = ActionChains(driver) ele = driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[4]/div' ) action.drag_and_drop_by_offset(ele, 1, 110) action.perform() sleep(1) # 点击审批流的发起人 driver.find_element_by_xpath( '//*[@id="app"]/div/div/div/div[4]/div/div/div[2]/div[2]/div[1]/div/div[2]/div[2]/div[2]/label[1]/span[2]' ).click() # 点击保存 driver.find_element_by_xpath( '//button[@class="yy-btn yy-btn-primary"]').click() # 点击保存并发布 driver.find_element_by_xpath( '//button[@class="right-run yy-btn yy-btn-primary"]').click() driver.close() sleep(1) win = driver.window_handles driver.switch_to.window(win[0]) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="出差类型"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRJQ030040') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新曾 driver.find_element_by_xpath('//button/span[text()="新增"]').click() sleep(1) # 输入名称 num = random.randint(1000, 9999) name = "出差类型{}".format(num) driver.find_element_by_xpath( '//label[text()="名称"]/parent::div//input').send_keys(name) # 输入备注信息 driver.find_element_by_xpath('//textarea').send_keys("备注信息01234") # 点击保存 driver.find_element_by_xpath( '//div[@role="dialog"]//button[2]').click() sleep(1) self.assertEqual( "操作成功", driver.find_element_by_xpath('//p[text()="操作成功"]').text) self.assertIn(name, driver.page_source) # 点击编辑按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[1]'.format( name)).click() # 点击保存 driver.find_element_by_xpath( '//div[@role="dialog"]//button[2]').click() sleep(1) self.assertEqual( "操作成功", driver.find_element_by_xpath('//p[text()="操作成功"]').text) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[2]'.format( name)).click() sleep(1) # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box__btns"]/button[2]').click() # 点击启用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[2]'.format( name)).click() # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[2]'.format( name)).click() sleep(1) # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box__btns"]/button[2]').click() # 点击删除按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[4]/div/div[3]'.format( name)).click() sleep(2) # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box__btns"]/button[2]').click() self.assertNotIn(name, driver.page_source) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="发薪方案"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRXC030010') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增方案按钮 driver.find_element_by_xpath( '//div[@class="fn-sort"]//button[4]').click() sleep(2) # 输入方案名称 num = random.randint(100, 999) name = "方案名称{}".format(num) driver.find_element_by_xpath('//label[text()="方案名称"]/following-sibling::div//input').send_keys(name) # 点击期间方案右侧的按钮 driver.find_element_by_xpath( '//label[text()="期间方案"]/following-sibling::div//span[@class="el-input__suffix"]').click() sleep(1) # 点击选择条目 driver.find_element_by_xpath( '//div[@class="ref-content-wrap ref-content-grid-wrap"]//tbody//tr[1]').click() # 点击确定按钮 driver.find_element_by_xpath('//div[@class="op-button"]/button[2]').click() sleep(1) # 点击起始期间右侧按钮 driver.find_element_by_xpath( '//label[text()="起始期间"]/following-sibling::div//span[@class="el-input__suffix"]').click() # 选择期间条目 driver.find_element_by_xpath('//div[@class="el-col el-col-16"]//tbody//tr[1]').click() # 点击确定 driver.find_element_by_xpath( '//div[@class="op-button"]/button[2]').click() sleep(1) # 输入方案说明 driver.find_element_by_xpath('//textarea').send_keys("方案说明信息09929") # 点击保存按钮 driver.find_element_by_xpath( '//div[@class="pp-container container-edit"]//div[@class="in-bottom"]//button[2]').click() sleep(0.75) self.assertEqual("操作成功!", driver.find_element_by_xpath('//p[text()="操作成功!"]').text) # 点击修改方案 driver.find_element_by_xpath('//div[@class="pp-header"]//button[3]').click() sleep(2) # 点击保存按钮 driver.find_element_by_xpath( '//div[@class="pp-container container-edit"]//div[@class="in-bottom"]//button[2]').click() sleep(0.75) self.assertEqual("操作成功!", driver.find_element_by_xpath('//p[text()="操作成功!"]').text) # 点击删除方案 driver.find_element_by_xpath('//div[@class="pp-header"]//button[2]').click() sleep(2) # 点击确定 driver.find_element_by_xpath('//div[@class="el-message-box"]//button[2]').click() sleep(1) self.assertEqual("操作成功!", driver.find_element_by_xpath('//p[text()="操作成功!').text) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath('//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="加班规则"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRJQ020070') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击新建规则 driver.find_element_by_xpath('//button[@class="el-button el-button--primary"]').click() sleep(2) # 点击所属组织右侧按钮 driver.find_element_by_xpath('//*[@id="c69"]/div/span/span/span/i[2]').click() sleep(3) # 选择北京仓储中心 driver.find_element_by_xpath('//div[@role="dialog"]//span[text()="仓储中心-北京"]').click() # 点击确定按钮 driver.find_element_by_xpath('//div[@class="op-button"]//button[@class="el-button el-button--primary"]').click() # 输入规则名称 driver.find_element_by_xpath('//input[@placeholder="规则名称"]').send_keys("规则1234") # 选择加班类型 driver.find_element_by_xpath('//span[text()="工作日加班"]/preceding-sibling::span').click() # 点击保存 driver.find_element_by_xpath( '//div[@class="header-wrap"]//button[@class="el-button el-button--primary"]/span[text()="保存"]').click() sleep(2) self.assertIn("规则1234", driver.page_source) # 编辑考勤规则 driver.find_element_by_xpath( '//div[text()="规则1234"]/ancestor::tr/td[7]/div/div[1]').click() sleep(2) # 点击保存按钮 driver.find_element_by_xpath( '//div[@class="header-wrap"]//button[@class="el-button el-button--primary"]/span[text()="保存"]').click() sleep(2) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="规则1234"]/ancestor::tr/td[7]/div/div[2]').click() sleep(2) # 点击确认 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]').click() sleep(2) # 点击启用按钮 driver.find_element_by_xpath( '//div[text()="规则1234"]/ancestor::tr/td[7]/div/div[2]').click() sleep(2) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="规则1234"]/ancestor::tr/td[7]/div/div[2]').click() sleep(2) # 点击确认 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]').click() sleep(1) sleep(2) # 点击删除按钮 driver.find_element_by_xpath( '//div[text()="规则1234"]/ancestor::tr/td[7]/div/div[3]').click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]').click() # 断言是否删除成功 sleep(2) self.assertNotIn("规则1234", driver.page_source) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath('//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) #左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) #进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(1) #进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="考勤周期"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRJQ020100') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击新建考勤周期 driver.find_element_by_xpath( '//ul[@class="attend_type_list___header"]/li[1]').click() sleep(2) # 输入考勤名称 num = random.randint(1000, 9999) name = "考勤{}".format(num) driver.find_element_by_xpath( '//label[text()="考勤周期名称"]/parent::div//input').send_keys(name) # 选择组织按钮 driver.find_element_by_xpath( '//label[text()="所属组织"]/parent::div//i[2]').click() sleep(3) # 选择北京仓储中心 driver.find_element_by_xpath( '//div[@class="el-tree-node__content"]//span[text()="仓储中心-北京"]' ).click() sleep(1) # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]//button[@class="el-button el-button--primary"]' ).click() sleep(2) # 点击保存按钮 driver.find_element_by_xpath( '//div[@aria-label="新增考勤周期方案"]//button[@class="el-button el-button--primary"]' ).click() # 断言 self.assertIn(name, driver.page_source) # 点击新增 driver.find_element_by_xpath( '//*[@id="attend-period"]//button/span[text()="新增"]').click() sleep(2) # 点击保存按钮 driver.find_element_by_xpath( '//div[@aria-label="生成考勤周期"]//span[text()="保存"]').click() # 点击编辑 driver.find_element_by_xpath( '//*[@id="attend-period"]/div/div[1]/div/div[1]/ul/li[3]').click() sleep(1) # 点击保存 driver.find_element_by_xpath( '//div[@aria-label="编辑考勤周期方案"]//button/span[text()="保存"]').click() sleep(0.5) # 断言 text = driver.find_element_by_xpath( '/html/body//p[text()="操作成功"]').text self.assertEqual("操作成功", text) # 点击删除 driver.find_element_by_xpath( '//*[@id="attend-period"]/div/div[1]/div/div[1]/ul/li[2]').click() # 弹出框点击确认 driver.find_element_by_xpath( '//div[@aria-label="提示"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(0.5) text_dele = driver.find_element_by_xpath( '/html/body//p[text()="操作成功"]').text self.assertEqual("操作成功", text_dele) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath( # '//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="薪资核算"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="薪资发放单"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRXC030030') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增按钮 driver.find_element_by_xpath('//span[text()="新建发放单"]').click() sleep(2) # 点击所属组织右侧的按钮 driver.find_element_by_xpath( '//label[text()="所属组织"]/following-sibling::div//span[@class="el-input__suffix"]' ).click() sleep(1.5) # 点击选择条目 driver.find_element_by_xpath( '//span[text()="仓储中心-北京"]/parent::span').click() # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]/button[2]').click() sleep(0.5) # 点击薪资方案右侧的按钮 driver.find_element_by_xpath( '//label[text()="薪资方案"]/following-sibling::div//span[@class="el-input__suffix"]' ).click() sleep(1.5) # 选择薪资方案条目 driver.find_element_by_xpath( '//div[@class="el-table__body-wrapper is-scrolling-none"]//tr[1]' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]/button[2]').click() sleep(0.5) # 点击发薪期间按钮 driver.find_element_by_xpath( '//label[text()="发薪期间"]/following-sibling::div//span[@class="el-input__suffix"]' ).click() sleep(1.5) # 点击条目 driver.find_element_by_xpath( '//div[@class="el-col el-col-16"]//tbody//tr/td/div[contains(text(),"12-01")]' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//div[@class="op-button"]/button[2]').click() sleep(0.5) num = random.randint(100, 999) name = "申请单{}".format(num) # 输入发放单名称 driver.find_element_by_xpath( '//label[text()="发放单名称"]/following-sibling::div//input').send_keys( name) # 输入发放说明信息 driver.find_element_by_xpath('//textarea').send_keys("发放说明信息48393498") # 点击下一步 driver.find_element_by_xpath('//span[text()="下一步"]').click() sleep(1) # 点击下一步 driver.find_element_by_xpath('//span[text()="下一步"]').click() sleep(3) # 点击全选按钮 driver.find_element_by_xpath( '//h3[contains(text(),"待选发薪人员")]/parent::div//span[text()="人员编码"]/ancestor::th/preceding-sibling::th//span[@class="el-checkbox__inner"]' ).click() sleep(1) # 点击选到右边的按钮 driver.find_element_by_xpath( '//*[@id="app"]/div/div[2]/div/div[2]/div[2]/div/div[2]/div/div[1]/i' ).click() # 点击保存 driver.find_element_by_xpath( '//div[@class="el-row"]/div/button[2]').click() sleep(3) # 点击计算按钮 driver.find_element_by_xpath( '//div[@class="nav-bottom"]//span[text()="计算"]').click() sleep(1) # 点击确定计算 driver.find_element_by_xpath( '//span[@class="dialog-footer"]//span[text()="计算"]').click() sleep(3) # 点击审核 driver.find_element_by_xpath( '//div[@class="nav-bottom"]//span[text()="审核"]').click() sleep(1) # 点击审核 driver.find_element_by_xpath( '//span[@class="dialog-footer"]//span[text()="审核"]').click() sleep(3) # 点击提交按钮 driver.find_element_by_xpath('//span[text()="提交"]').click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box__btns"]/button[2]').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) #左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) #进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(1) #进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="假勤管理"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(1) # 进入二级节点 driver.find_element_by_xpath('//li[@title="休假规则"]').click() sleep(2) # 跳转休假规则iframe iframe = driver.find_element_by_id('HRJQ020060') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击新建规则 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]').click() sleep(2) # 点击组织按钮 driver.find_element_by_xpath( '//*[@id="c57"]/div/span/span/span/i[2]').click() # 点击组织展开按钮 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//div[@role="group"]/div[1]/div/span[1]' ).click() # 点击组织 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//div[@role="group"]/div[1]/div/span[2]' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//span[text()="所属组织"]/ancestor::div[@role="dialog"]//button[@class="el-button el-button--primary"]' ).click() sleep(1) # 输入姓名 num = random.randint(1000, 9999) name = "假勤方案{}".format(num) driver.find_element_by_xpath( '//label[text()="规则名称"]/parent::div//input').send_keys(name) # 输入备注信息 driver.find_element_by_xpath( '//*[@id="basicInfo"]//textarea').send_keys("备注信息123456") sleep(1) # 点击保存按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() sleep(0.5) # 断言 text = driver.find_element_by_xpath('//p[text()="操作成功!"]').text self.assertEqual("操作成功!", text) # 点击编辑 driver.find_element_by_xpath( '//*[@id="basicInfo"]//button/span[text()="编辑"]').click() # 点击保存按钮 driver.find_element_by_xpath( '//div[@id="basicInfo"]//button[@class="el-button el-button--primary"]/span[text()="保存"]' ).click() # 断言 text = driver.find_element_by_xpath('//p[text()="操作成功!"]').text self.assertEqual("操作成功!", text) driver.switch_to.default_content() ele = driver.find_element_by_xpath('//p[text()="休假规则"]') actions = ActionChains(driver) actions.move_to_element(ele) actions.perform() driver.find_element_by_xpath('//span[text()="刷新"]').click() sleep(1) # 跳转休假规则iframe iframe = driver.find_element_by_id('HRJQ020060') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[6]/div/div[2]'.format( name)).click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(0.5) text = driver.find_element_by_xpath('//p[text()="操作成功"]').text self.assertEqual("操作成功", text) sleep(1) # 点击启用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[6]/div/div[2]'.format( name)).click() sleep(0.5) text = driver.find_element_by_xpath('//p[text()="操作成功"]').text self.assertEqual("操作成功", text) sleep(1) # 点击停用按钮 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[6]/div/div[2]'.format( name)).click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(0.5) text = driver.find_element_by_xpath('//p[text()="操作成功"]').text self.assertEqual("操作成功", text) sleep(1) # 点击删除 driver.find_element_by_xpath( '//div[text()="{}"]/ancestor::tr/td[6]/div/div[3]'.format( name)).click() # 点击确定 driver.find_element_by_xpath( '//div[@class="el-message-box"]//button[@class="el-button el-button--default el-button--small el-button--primary "]' ).click() sleep(0.5) text = driver.find_element_by_xpath('//p[text()="操作成功"]').text self.assertEqual("操作成功", text) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="劳动合同"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="劳动合同签订"]').click() sleep(2) # 跳转劳动合同签订iframe iframe = driver.find_element_by_id('HRGXFW090') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击新增按钮 driver.find_element_by_xpath( '//*[@id="flowApprove"]//button[@class="btn btn-primary"]').click( ) sleep(2) # 点击新员工tab页签 driver.find_element_by_xpath('//*[@id="staffNewSpan"]').click() # 输入查询数据 driver.find_element_by_xpath('//*[@id="searchValNew"]').send_keys( context.Name.random_name) # 点击查询 driver.find_element_by_xpath('//*[@id="searchBtn1"]/span/i[2]').click() # 点击第一条数据 driver.find_element_by_xpath( '//*[@id="addSignsDialog"]//div[@id="staffNewBody"]//tbody//td[1]//label' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//*[@id="addSignsDialog"]//span[text()="确定"]').click() sleep(1) # 点击右侧的按钮 driver.find_element_by_xpath( '//div[@title="合同开始日期"]/ancestor::fieldset//span[@class="u-form-control-feedback fa fa-calendar"]' ).click() # 点击时间框 driver.find_element_by_xpath( '//*[@id="edit_20180621092332a9Wovv11gh"]//div[@class="u-date-cell current"]' ).click() # 点击输入合同期限 driver.find_element_by_xpath( '//*[@id="20180621092344dfpzcwrr5o"]').send_keys("6") # 选择合同信息 driver.find_element_by_xpath( '//*[@id="edit_20180621092410s9ne5T2NrC"]/div/span[1]').click() # 选择合同 driver.find_element_by_xpath( '//*[@id="refContainer20180621092410s9ne5T2NrC"]//td[text()="0001"]' ).click() # 输入工作地点 driver.find_element_by_xpath( '//*[@id="edit_20180621092415N32bSEPxgw"]/div/span[1]').click() # 选择工作地点 driver.find_element_by_xpath( '//*[@id="refContainer20180621092415N32bSEPxgw"]//td[text()="123"]' ).click() # 点击试用期期限 driver.find_element_by_xpath( '//*[@id="20180621092425fw1gM2Tz5j"]').send_keys(1) # 输入备注内容 # 输入随机内容 paragraph = context.get_paragraph() driver.find_element_by_xpath( '//*[@id="20180621092453tCQEAbvHU1"]').send_keys(paragraph) # 点击保存按钮 driver.find_element_by_xpath( '//*[@id="templatePanel"]/div[4]/button//span[text()="保存"]').click( ) sleep(3) # 点击提交按钮 driver.find_element_by_xpath( '//*[@id="templatePanel"]//button//span[text()="提交"]').click() sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()
def runTest(self): driver = self.getDriver() driver.implicitly_wait(30) param = self.param tool = utils driver.refresh() # driver.find_element_by_xpath('//*[@id="_dropdown_popcontainer"]/div/i').click() # driver.find_element_by_xpath('//*[@id="home_header"]//div[text()="UI测试专属"]').click() # driver.find_element_by_xpath('//button[@class="u-button btn__style___37bsb u8c_primary__style___RFibc btn__style___20DQM "]').click() # sleep(2) # 左上方公共节点 driver.find_element_by_class_name('lebra-navbar-left-icon').click() sleep(2) # 进入社交协同 driver.find_element_by_xpath('//*[text()="人力资源"]').click() sleep(2) # 进入一级节点 menu2 = driver.find_element_by_css_selector('span[title="员工服务"]') actions = ActionChains(driver) actions.move_to_element(menu2) actions.click(menu2) actions.perform() sleep(2) # 进入二级节点 driver.find_element_by_xpath('//li[@title="我的申请"]').click() sleep(2) # 跳转我的申请iframe iframe = driver.find_element_by_id('HRP010020') # # driver.switch_to.frame(iframe) print(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 点击请假申请tab页 driver.find_element_by_xpath( '//ul[@class="el-menu--horizontal el-menu"]/li[3]').click() # 点击新增按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="新增"]' ).click() sleep(2) # 点击休假类型右侧按钮 driver.find_element_by_xpath( '//*[@id="edit_20180817141749XV4Fwki935"]/div/span[1]').click() sleep(1) # 点击第一条数据 driver.find_element_by_xpath('//td[text()="事假"]').click() # 输入请假事由 num = random.randint(1000, 9999) result = "联合国议事[{}]号文件".format(num) driver.find_element_by_xpath( '//*[@id="20180706103429AartUFuqhI"]').send_keys(result) sleep(1) # # 点击上传附件 # driver.find_element_by_xpath('//*[@id="chosenFile"]').click() # sleep(1) # context.upload_file(r"D:\张红-999001234.png", "员工服务-我的申请上传附件操作") # 点击添加请假明 # driver.find_element_by_xpath('//*[@id="leaveapply"]/div[3]/div[1]/div/button').click() # 点击开始时间右侧的按钮 driver.find_element_by_xpath('//*[@id="begintime0"]/label/i').click() # 选择当天 driver.find_element_by_xpath( '//*[@id="begintime0"]/div/div[2]/button[1]').click() # 点击结束时间的有测按钮 driver.find_element_by_xpath('//*[@id="endtime0"]/label/i').click() sleep(0.5) # # 选择下一天 # driver.find_element_by_xpath('//*[@id="endtime0"]/div/div[1]/div/div/div[1]/div[2]').click() # driver.find_element_by_xpath('//*[@id="endtime0"]/div/div[1]/div/div/div[2]/div[11]').click() # # driver.find_element_by_xpath('//div[@class="u-date-cell current"]/following-sibling::div[1]').click() # 选择当天 driver.find_element_by_xpath( '//input[@id="end-date0"]/parent::div//div[@class="u-date-cell current"]/following-sibling::div[1]' ).click() # 点击确定按钮 driver.find_element_by_xpath( '//input[@id="end-date0"]/parent::div//button[@class="u-button u-date-ok right primary"]' ).click() # 点击保存 sleep(0.5) driver.find_element_by_xpath( '//*[@id="leaveapply"]//button/span[text()="保存"]').click() sleep(2) # 点击提交按钮 driver.find_element_by_xpath( '//div[@class="control-btn"]/div/button[1]').click() sleep(2) # 点击撤销 按钮 driver.find_element_by_xpath( '//div[contains(text(),"{}")]/ancestor::tr//span[text()="撤销"]'. format(result)).click() # 点击确定按钮 sleep(1) driver.find_element_by_xpath( '//div[@class="el-message-box__btns"]/button[2]').click() sleep(3) text = driver.find_element_by_xpath( '//div[contains(text(),"{}")]/ancestor::tr/td[6]/div'.format( result)).text self.assertEqual(text, "已撤回") # # 点击编辑按钮 # driver.find_element_by_xpath('//*[@id="leaveapply"]//button/span[text()="编辑"]').click() # sleep(2) # # 点击保存 # driver.find_element_by_xpath('//*[@id="leaveapply"]//button/span[text()="保存"]').click() # sleep(3) driver.switch_to.default_content() ele = driver.find_element_by_xpath('//p[text()="我的申请"]') actions = ActionChains(driver) actions.move_to_element(ele) actions.perform() driver.find_element_by_xpath('//span[text()="刷新"]').click() sleep(1) # 跳转休假规则iframe iframe = driver.find_element_by_id('HRP010020') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(1) # # 点击请假申请tab页 # driver.find_element_by_xpath('//ul[@class="el-menu--horizontal el-menu"]/li[3]').click() # # 点击编辑 # text = driver.find_element_by_xpath( # '//*[@id="leaveapprove-wrap"]/div/div[2]/div[3]/table/tbody/tr[4]/td[5]/div').text # print(text) # 点击提交 # driver.find_element_by_xpath('//*[@id="leaveapply"]/div[3]/div[2]/div/button[1]').click() # ***************************************************************************************** # 点击出差申请tab页 driver.find_element_by_xpath('//li[contains(text(),"出差申请")]').click() # 点击新增按钮 driver.find_element_by_xpath( '//button[@class="el-button el-button--primary"]/span[text()="新增"]' ).click() sleep(2) # 点击休假类型右侧按钮 driver.find_element_by_xpath( '//*[@id="edit_20181024153808q3reXc5Dc3"]/div/span[1]').click() sleep(1) # 点击第一条数据 driver.find_element_by_xpath('//td[text()="本地出差"]').click() # 出差费用 driver.find_element_by_xpath( '//*[@id="20181024153808LOdNOVKJgB"]').send_keys("5000") # 交接人 driver.find_element_by_xpath( '//*[@id="20181024153808LvYYxBZgNO"]').send_keys("卢大达") # 输入出差说明 driver.find_element_by_xpath( '//*[@id="20181024153808lZ7NAO1Vdj"]').send_keys('出差说明信息888') # # 点击上传附件 # driver.find_element_by_xpath('//*[@id="chosenFile"]').click() # # # 调用上传附件 # context.upload_file(r"D:\我的头像\5.jpg", "出差申请单附件。") # 选择添加一行 driver.find_element_by_xpath('//button/span[text()="添加"]').click() sleep(1) # 点击开始时间右侧的按钮 driver.find_element_by_xpath('//*[@id="begintime0"]/label/i').click() # 选择当天 driver.find_element_by_xpath( '//*[@id="begintime0"]/div/div[2]/button[1]').click() # 点击结束时间的有测按钮 driver.find_element_by_xpath('//*[@id="endtime0"]/label/i').click() sleep(0.5) # 选择当天 driver.find_element_by_xpath( '//input[@id="end-date0"]/parent::div//div[@class="u-date-cell current"]/following-sibling::div[1]' ).click() sleep(0.5) # 点击确定按钮 driver.find_element_by_xpath( '//input[@id="end-date0"]/parent::div//button[@class="u-button u-date-ok right primary"]' ).click() # 输入出差地点 driver.find_element_by_xpath('//*[@id="destination0"]').send_keys( "阿尔卑斯") # 点击保存 sleep(0.5) driver.find_element_by_xpath('//button/span[text()="保存"]').click() sleep(3) # # 点击编辑按钮 # driver.find_element_by_xpath('//button/span[text()="编辑"]').click() # sleep(2) # # 点击保存 # driver.find_element_by_xpath('//button/span[text()="保存"]').click() # sleep(3) driver.switch_to.default_content() ele = driver.find_element_by_xpath('//p[text()="我的申请"]') actions = ActionChains(driver) actions.move_to_element(ele) actions.perform() driver.find_element_by_xpath('//span[text()="刷新"]').click() sleep(1) # 跳转休假规则iframe iframe = driver.find_element_by_id('HRP010020') # # driver.switch_to.frame(iframe) SwitchTo(driver).frame(iframe) sleep(2) # 关闭当前页面 driver.switch_to.default_content() sleep(1) driver.find_element_by_xpath( '//*[@id="home_header"]/div/div[3]/ul/li/div').click()