def nianjia_zhengchang_success(self): #点击请假 qingjia_button = self.base_page.find_byID_('com.flashexpress.backyard:id/_leave') qingjia_button.click() #切换到webview下 view_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(view_now) cot = self.base_page.get_context() print(cot) print('点击请假类型前:') #点击请假类型 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[1]/div/input').click() cots = self.base_page.get_context() print(cots) print('点击请假类型后:') #点击年假(带薪)按钮 self.base_page.find_byClassAndTag('date-list', 'li', 0, 0).click() time.sleep(3) self.base_page.to_now_context(view_now) #点击开始时间按钮 #self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[2]/div/input').click() self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 1, 0).click() print('还没有点击时间26') #点击26号,如果后续日期更换,只更换对于的坐标就可以了 [618,1473][768,1608] ''' 位置信息 ''' a = read_yaml_file('nianjia_zhengchang_success','startTime') self.base_page.by_TouchAction_dingwei(a[0],a[1]) time.sleep(3) #点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800,1300) print('点击了确定按钮') time.sleep(3) #点击结束时间按钮 self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 2, 0).click() time.sleep(2) # 点击28号,如果后续日期更换,只更换对于的坐标就可以了 # 坐标位置 = [921,1473][1068,1608] ''' 位置信息 ''' b = read_yaml_file('nianjia_zhengchang_success','endTime') self.base_page.by_TouchAction_dingwei(b[0], b[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(1) #输入请假原因 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[6]/textarea').send_keys('请假的原因') time.sleep(2) #浏览器页面需要向上滑动一下 self.base_page.swipeUp() time.sleep(2) #点击提交按钮 # 提交按钮 = [90, 1695][990, 1830] self.base_page.by_TouchAction_dingwei(500,1750) # 提交的确认弹框 # 确定按钮 = [540,1245][1017,1365] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(3)
def shenqing_peixunjia_bohui(self): self.base_page.to_now_context('NATIVE_APP') time.sleep(3) # 点击请假 qingjia_button = self.base_page.find_byID_( 'com.flashexpress.backyard:id/_leave') qingjia_button.click() time.sleep(1) # 切换到webview下 view_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(view_now) cot = self.base_page.get_context() time.sleep(3) print(cot) print('点击请假类型前:') # 点击请假类型 try: elem = self.base_page.find_byxpath( '//*[@id="app"]/div/div[1]/div[1]/div/input') except: for i in range(3): elem.click() time.sleep(1) else: elem.click() cots = self.base_page.get_context() print(cots) print('点击请假类型后:') time.sleep(1) # 点击公司培训假(带薪)按钮,修改请假类型,只需要更改后边的li的下标 self.base_page.find_byClassAndTag('date-list', 'li', 0, 11).click() time.sleep(3) self.base_page.to_now_context(view_now) time.sleep(3) # 点击开始时间按钮 # self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[2]/div/input').click() # self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 1, 0).click() # self.base_page.css_select("document.querySelector('.mt-item-input')").click() self.base_page.css_select('.mt-item-input')[1].click() time.sleep(1) self.base_page.to_now_context(view_now) time.sleep(3) print(self.base_page.get_context()) print('还没有点击时间25') # 点击24号,如果后续日期更换,只更换对于的坐标就可以了 ''' 位置信息 [318,1473][465,1608]''' a = read_yaml_file('shenqing_peixunjia_bohui', 'startTime') self.base_page.by_touchAction_uiautomator2(a[0], a[1]) time.sleep(1) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_touchAction_uiautomator2(800, 1300) print('点击了确定按钮') time.sleep(3) # 点击结束时间按钮 self.base_page.css_select('.mt-item-input')[2].click() time.sleep(2) # 点击25号,如果后续日期更换,只更换对于的坐标就可以了 # 坐标位置 = ''' 位置信息 [468,1473][615,1608]''' b = read_yaml_file('shenqing_peixunjia_bohui', 'endTime') self.base_page.by_touchAction_uiautomator2(b[0], b[1]) # self.base_page.css_select('document.querySelectorAll(".box-message")[21]').click() time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_touchAction_uiautomator2(800, 1300) # self.base_page.css_select("document.querySelector('.picker-toolbar span.mint-datetime-action.mint-datetime-confirm')").click() time.sleep(2) # 输入请假原因 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[6]/textarea' ).send_keys('年假两天-请假的原因') time.sleep(2) # 浏览器页面需要向上滑动一下 self.base_page.swipeUp() time.sleep(2) # 点击提交按钮 # 提交按钮 = [90, 1695][990, 1830] self.base_page.by_touchAction_uiautomator2(500, 1750) # self.base_page.css_select('document.querySelector(".mint-button-text")').click() time.sleep(2) # 提交的确认弹框 # 确定按钮 = [540,1245][1017,1365] self.base_page.by_touchAction_uiautomator2(800, 1300) time.sleep(3) #请假成功后,退出账号22399,登入账号 22395 self.base_page.to_now_context('NATIVE_APP') time.sleep(3) self.base_page.find_byandroid_text('我的').click() time.sleep(1) self.base_page.find_byandroid_text('退出').click() time.sleep(1) self.base_page.find_byandroid_text('确定').click() # 登入账号 22395 usename = self.base_page.find_byID_( 'com.flashexpress.backyard:id/userName') usename.send_keys(22395) time.sleep(1) pwd = self.base_page.find_byID_( 'com.flashexpress.backyard:id/userPass') pwd.send_keys(123456) time.sleep(1) #点击确定按钮 time.sleep(1) self.base_page.find_byID_('com.flashexpress.backyard:id/login').click() #点击审批按钮 self.base_page.to_now_context('NATIVE_APP') time.sleep(3) ''' 底部导航栏是原生按钮 如果当前页面在可见审批导航栏页面,需要点击审批按钮,进入审批页面 点击我的申请按钮 点击待审批按钮,进入请假申请页面 页面向上滑动一次 点击撤销按钮 点击确认撤销提示的 确定按钮 点击页面的返回按钮,页面返回至审批页面 ''' # 点击审批按钮 try: ele = self.base_page.find_bytext('审批') except NoSuchElementException: for i in range(3): ele.click() time.sleep(1) else: ele.click() time.sleep(2) context_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(context_now) time.sleep(3) #点击我的审批按钮 wodeshenpi = self.base_page.find_byxpath('//*[@id="app"]/div/a[1]') print(wodeshenpi) wodeshenpi.click() #点击待审批按钮 '''[0,348][1080,822]''' self.base_page.to_now_context(context_now) time.sleep(5) self.base_page.by_touchAction_uiautomator2(500, 500) # self.base_page.css_ele_select("div.mint-cell-value.is-link").click() time.sleep(1) self.base_page.to_now_context(context_now) time.sleep(5) #页面滑动一次 self.base_page.swipeUp() #点击驳回按钮 //*[@id="pageTwo"]/div/div[1]/div[6]/span[1] [60,1602][510,1740] # self.base_page.find_byClassAndTag('mt-page-footer', 'span', 0, 0).click() self.base_page.by_touchAction_uiautomator2(400, 1700) time.sleep(3) self.base_page.to_now_context('WEBVIEW_com.flashexpress.backyard') time.sleep(5) #定位驳回原因输入框 //*[@id="pageTwo"]/div/div[1]/div[8]/div/div[2]/textarea [144,945][936,1248] self.base_page.to_now_context('NATIVE_APP') time.sleep(3) eles = self.base_page.find_byH5class("android.widget.EditText") eles.send_keys("培训假申请驳回的原因") time.sleep(1) #点击确定按钮 self.base_page.by_touchAction_uiautomator2(700, 1380) time.sleep(2)
def nianjia_chaochu_time_tishi(self): # 点击请假 qingjia_button = self.base_page.find_byID_('com.flashexpress.backyard:id/_leave') qingjia_button.click() time.sleep(1) # 切换到webview下 view_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(view_now) cot = self.base_page.get_context() print(cot) print('点击请假类型前:') # 点击请假类型 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[1]/div/input').click() cots = self.base_page.get_context() print(cots) print('点击请假类型后:') # 点击年假(带薪)按钮 try: ele = self.base_page.find_byClassAndTag('date-list', 'li', 0, 0) except: for i in range(3): ele.click() time.sleep(1) else: ele.click() time.sleep(3) self.base_page.to_now_context(view_now) # 点击开始时间按钮 self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 1, 0).click() time.sleep(2) print('还没有点击时间18') ''' 位置信息 ''' # 点击9.30号,如果后续日期更换,只更换对于的坐标就可以了 [18,1614][165,1749] c = read_yaml_file('nianjia_chaochu_time_tishi','startTime') self.base_page.by_TouchAction_dingwei(c[0],c[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) print('点击了确定按钮') time.sleep(3) # 点击结束时间按钮 self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 2, 0).click() time.sleep(2) # 点击10.12号,如果后续日期更换,只更换对于的坐标就可以了 # 坐标位置 = [168,1614][315,1749] ''' 位置信息 ''' d = read_yaml_file('nianjia_chaochu_time_tishi', 'endTime') self.base_page.by_TouchAction_dingwei(d[0], d[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(1) # 输入请假原因 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[6]/textarea').send_keys('请假的原因') time.sleep(2) # 浏览器页面需要向上滑动一下 self.base_page.swipeUp() time.sleep(2) # 点击提交按钮 # 提交按钮 = [90, 1695][990, 1830] self.base_page.by_TouchAction_dingwei(500, 1750) #请您确认请假时间确认弹框提示 # 确认 = [540,1245][1017,1365] self.base_page.by_TouchAction_dingwei(800,1300) time.sleep(3) #获取点击提交按钮后的提示 text = self.base_page.find_byxpath('/html/body/div[2]/div/div[2]/div[1]').text print('texttexttexttexttexttexttexttext') print(text) print('texttexttexttexttexttexttexttext') time.sleep(2) return text
def chanjianjia2day_zhengchang_success(self): # 点击请假 try: qingjia_button = self.base_page.find_byID_( 'com.flashexpress.backyard:id/_leave') except: for i in range(3): qingjia_button.click() time.sleep(1) else: qingjia_button.click() # 切换到webview下 view_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(view_now) cot = self.base_page.get_context() print(cot) print('点击请假类型前:') # 点击请假类型 try: ele = self.base_page.find_byxpath( '//*[@id="app"]/div/div[1]/div[1]/div/input') except NoSuchElementException: for i in range(3): ele.click() time.sleep(1) else: ele.click() cots = self.base_page.get_context() print(cots) print('点击请假类型后:') # 点击产检假(带薪)按钮,修改请假类型,只需要更改后边的li的下标 self.base_page.find_byClassAndTag('date-list', 'li', 0, 12).click() time.sleep(3) self.base_page.to_now_context(view_now) # 点击开始时间按钮 # self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[2]/div/input').click() self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 1, 0).click() print('还没有点击时间21') # 点击21号,如果后续日期更换,只更换对于的坐标就可以了 ''' 位置信息 ''' x = read_yaml_file('chanjianjia2day_zhengchang_success', 'startTime') self.base_page.by_TouchAction_dingwei(x[0], x[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) print('点击了确定按钮') time.sleep(3) # 点击结束时间按钮 self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 2, 0).click() time.sleep(2) # 点击22号,如果后续日期更换,只更换对于的坐标就可以了 # 坐标位置 = [18,1473][165,1608] ''' 位置信息 ''' y = read_yaml_file('chanjianjia2day_zhengchang_success', 'endTime') self.base_page.by_TouchAction_dingwei(y[0], y[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(1) # 输入请假原因 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[6]/textarea' ).send_keys('产检假两天-请假的原因') time.sleep(2) # 浏览器页面需要向上滑动一下 self.base_page.swipeUp() time.sleep(2) # 点击提交按钮 # 提交按钮 = [90, 1695][990, 1830] self.base_page.by_TouchAction_dingwei(500, 1750) time.sleep(2) # 提交的确认弹框 # 确定按钮 = [540,1245][1017,1365] self.base_page.by_TouchAction_dingwei(800, 1300) self.base_page.to_now_context('NATIVE_APP') time.sleep(3) qingjia_button_text = self.base_page.find_byandroid_text('请假').text print('打卡页面的 请假按钮文字') print(qingjia_button_text) print('打卡页面的 请假按钮文字') return qingjia_button_text
def chanjianjia9day_fail(self): time.sleep(2) # 点击请假 qingjia_button = self.base_page.find_byID_( 'com.flashexpress.backyard:id/_leave') qingjia_button.click() time.sleep(1) # 切换到webview下 view_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(view_now) cot = self.base_page.get_context() print(cot) print('点击请假类型前:') # 点击请假类型 self.base_page.find_byxpath( '//*[@id="app"]/div/div[1]/div[1]/div/input').click() time.sleep(1) cots = self.base_page.get_context() print(cots) print('点击请假类型后:') # 点击带薪事假(带薪)按钮,修改请假类型,只需要更改后边的li的下标 self.base_page.find_byClassAndTag('date-list', 'li', 0, 12).click() time.sleep(3) self.base_page.to_now_context(view_now) # 点击开始时间按钮 # self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[2]/div/input').click() self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 1, 0).click() time.sleep(1) print('还没有点击时间27') # 点击19号,如果后续日期更换,只更换对于的坐标就可以了 [771,1473][918,1608] ''' 位置信息 ''' a = read_yaml_file('chanjianjia9day_fail', 'startTime') self.base_page.by_TouchAction_dingwei(a[0], a[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) print('点击了确定按钮') time.sleep(3) # 点击结束时间按钮 self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 2, 0).click() time.sleep(2) # 点击10.3 号,如果后续日期更换,只更换对于的坐标就可以了 # 坐标位置 = [618,1614][768,1749] ''' 位置信息 ''' b = read_yaml_file('chanjianjia9day_fail', 'endTime') self.base_page.by_TouchAction_dingwei(b[0], b[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(1) # 输入请假原因 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[6]/textarea' ).send_keys('产检假8.5天-请假的原因') time.sleep(2) # 浏览器页面需要向上滑动一下 self.base_page.swipeUp() time.sleep(2) # 点击提交按钮 # 提交按钮 = [90, 1695][990, 1830] self.base_page.by_TouchAction_dingwei(500, 1750) time.sleep(2) # 提交的确认弹框 # 确定按钮 = [540,1245][1017,1365] self.base_page.by_TouchAction_dingwei(800, 1300) # self.base_page.to_now_context('NATIVE_APP') time.sleep(3) # 获取点击提交按钮后的提示 请假余额已用完 a_text = self.base_page.find_byxpath( '/html/body/div[2]/div/div[2]/div[1]').text print('texttexttexttexttexttexttexttext') print(a_text) print('texttexttexttexttexttexttexttext') # 点击请假余额已用完确认提示 self.base_page.find_byxpath( '/html/body/div[2]/div/div[3]/button[2]').click() time.sleep(2) # 将context设置成原生app # self.base_page.to_now_context('NATIVE_APP') # time.sleep(5) # 点击返回按钮 # self.base_page.find_byID_('com.flashexpress.backyard:id/iv_back').click() self.base_page.by_touchAction_uiautomator2(100, 100) time.sleep(2) return a_text
def chanjia2day_zhengchang_success(self): self.base_page.to_now_context('NATIVE_APP') time.sleep(3) # 点击请假 try: qingjia_button = self.base_page.find_byID_( 'com.flashexpress.backyard:id/_leave') except NoSuchElementException: for i in range(3): qingjia_button.click() time.sleep(1) else: qingjia_button.click() time.sleep(1) # 切换到webview下 view_now = 'WEBVIEW_com.flashexpress.backyard' self.base_page.to_now_context(view_now) time.sleep(3) cot = self.base_page.get_context() print(cot) print('点击请假类型前:') # 点击请假类型 self.base_page.find_byxpath( '//*[@id="app"]/div/div[1]/div[1]/div/input').click() time.sleep(1) cots = self.base_page.get_context() print(cots) print('点击请假类型后:') # 点击带薪事假(带薪)按钮,修改请假类型,只需要更改后边的li的下标 self.base_page.find_byClassAndTag('date-list', 'li', 0, 3).click() time.sleep(3) self.base_page.to_now_context(view_now) time.sleep(3) # 点击开始时间按钮 # self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[2]/div/input').click() self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 1, 0).click() time.sleep(1) print('还没有点击时间21') # 点击27号,如果后续日期更换,只更换对于的坐标就可以了[771,1473][918,1608] (800,1500) ''' 位置信息 ''' a = read_yaml_file('chanjia2day_zhengchang_success', 'startTime') self.base_page.by_TouchAction_dingwei(a[0], a[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) print('点击了确定按钮') time.sleep(3) # 点击结束时间按钮 self.base_page.find_byClassAndTag('mt-item-field-inner', 'input', 2, 0).click() time.sleep(2) # 点击30号,如果后续日期更换,只更换对于的坐标就可以了 [168,1614][315,1749] (200,1700) # 坐标位置 = [18,1473][165,1608] ''' 位置信息 ''' b = read_yaml_file('chanjia2day_zhengchang_success', 'endTime') self.base_page.by_TouchAction_dingwei(b[0], b[1]) time.sleep(3) # 点击确按钮 # 确定按钮位置 = [540,1260][1080,1380] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(3) # 输入请假原因 self.base_page.find_byxpath('//*[@id="app"]/div/div[1]/div[6]/textarea' ).send_keys('产假两天-请假的原因') time.sleep(2) # 浏览器页面需要向上滑动一下 self.base_page.swipeUp() time.sleep(2) # 点击提交按钮 # 提交按钮 = [90, 1695][990, 1830] self.base_page.by_TouchAction_dingwei(500, 1750) time.sleep(2) # 提交的确认弹框 # 确定按钮 = [540,1245][1017,1365] self.base_page.by_TouchAction_dingwei(800, 1300) time.sleep(2)
def shenqing_ot(self): page = self.base_page.return_page() print(page) self.base_page.to_now_context('NATIVE_APP') time.sleep(3) # 点击审批按钮 self.base_page.find_bytext('审批').click() time.sleep(1) #触摸考勤的框框 固定的位置,不用抽取 self.base_page.by_touchAction_uiautomator2(200, 800) time.sleep(2) print('触摸点击申请OT按钮 +' * 8) # page = self.base_page.return_page() # print(page) print('触摸点击申请OT按钮 +' * 8) #触摸点击申请OT按钮 self.base_page.by_touchAction_uiautomator2(745, 654) time.sleep(4) print('申请OT +' * 8) page = self.base_page.return_page() print(page) print('申请OT +' * 8) #点击OT日期 self.base_page.by_touchAction_uiautomator2(500, 300) time.sleep(1) #OT日期 a = read_yaml_file('shenqing_ot', 'OTtime') self.base_page.by_touchAction_uiautomator2(a[0], a[1]) time.sleep(1) #申请OT self.base_page.by_touchAction_uiautomator2(800, 450) time.sleep(1) #申请OT确定按钮 self.base_page.by_touchAction_uiautomator2(800, 1300) time.sleep(1) #开始时间 self.base_page.by_touchAction_uiautomator2(800, 600) time.sleep(1) #开始时间日期 b = read_yaml_file('shenqing_ot', 'startTime') self.base_page.by_touchAction_uiautomator2(b[0], b[1]) time.sleep(2) #选择时间 c = read_yaml_file('shenqing_ot', 'select_time') #选择申请OT得开始时间,0-24,在yaml文件中修改 for i in range(c[0]): self.base_page.touchAction_point_to_point(267, 1650, 267, 1542) time.sleep(1) #点击确定按钮 self.base_page.by_touchAction_uiautomator2(800, 1100) #点击时长 time.sleep(1) self.base_page.by_touchAction_uiautomator2(800, 800) time.sleep(1) #点击确定 self.base_page.by_touchAction_uiautomator2(800, 1300) time.sleep(2) # ele = self.base_page.find_byH5class('android.widget.EditText') ele = self.base_page.find_byH5_className('android.widget.EditText', 4) ele.send_keys('申请OT原因') time.sleep(1) self.base_page.swipeUp() time.sleep(1) self.base_page.swipeUp() time.sleep(1) #点击提交按钮 self.base_page.by_touchAction_uiautomator2(500, 1600) time.sleep(5)