def DeviceManage_PageBack(driver): try: with allure.step('点击返回按钮'): Page.find_elem_id(driver, "com.chtwm.mall:id/img_back").click() except: Page.wait_elem(driver, "com.chtwm.mall:id/img_back", 5).click()
def IntoSiMuProduct_Back(driver): try: Page.wait_elem(driver,"com.chtwm.mall:id/miv_back", 15).click() except: driver.back()
def Autonym_PageBack(driver): try: with allure.step('点击"返回上一页面",返回到个人信息页面'): Page.wait_elem(driver, "com.chtwm.mall:id/iv_back", 10).click() except: driver.back()
def ZiGuan_UploadInvestProve(driver): try: with allure.step('点击普转专页面的上传投资经历证明'): time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/rl_tzjl", 10).click() with allure.step('尝试删除之前上传过的照片记录'): time.sleep(2) try: for i in range(4): #尝试删除4次之前上传的图片 Page.wait_elem(driver,"com.chtwm.mall:id/iv_del", 5).click() print ("删除之前上传过的照片成功") allure.attach("删除之前上传过的照片成功") except: print ("删除之前上传过的照片失败") allure.attach("删除之前上传过的照片失败") pass with allure.step('点击+,上传图片'): try: time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/iv_add_img", 5).click() except: Page.wait_elem(driver,"com.chtwm.mall:id/rl_upload_img", 10).click() ''' with allure.step('点击相机,上传拍摄的照片'): time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/camera_tv", 5).click() with allure.step('点击相册,上传相册中的照片'): time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/photo_tv", 5).click() with allure.step('点击相册,上传相册中的照片'): time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/photo_tv", 5).click() ''' with allure.step('选择一张照片'): time.sleep(2) photos = driver.find_elements_by_id("com.chtwm.mall:id/v_selected")[0] #取第一张照片 photos.click() with allure.step('点击右上方,完成按钮'): time.sleep(3) Page.wait_elem(driver,"com.chtwm.mall:id/done", 5).click() with allure.step('点击下方提交按钮'): time.sleep(3) Page.wait_elem(driver,"com.chtwm.mall:id/bt_suction_bottom", 5).click() time.sleep(10) #等待十秒上传资料到服务器 pytest_TestResult = True except Exception as e: #print("%s报错:"%title, e) allure.attach("%s报错:%s%s"%(title,str(e),str(type(e)))) pytest_TestResult = False finally: return pytest_TestResult
def AttachedFile_Back(driver): try: Page.wait_elem(driver, "com.chtwm.mall:id/iv_back_white", 15).click() except: driver.back()