def changerole(driver, roomid, devicename, packagename): suceess_flag = True num = 1 elementinfo, deviceid = pubfuc.getiteminfo(driver.desired_capabilities, packagename) while suceess_flag: try: behavior.choosetype(driver, elementinfo) # iRoom 多人群聊 behavior.findroomid(driver, elementinfo, roomid) behavior.joinroom(driver, elementinfo) while num < 1000: behavior.changerole(driver, elementinfo) num + 1 behavior.leaveroom(driver, elementinfo) except Exception as e: print('error') # logger.error(f'第{num}次运行出错,设备是:{devicename}') sleep(3) driver.close_app() driver.launch_app()
def creatroom(driver, devicename, packagename): suceess_flag = True num = 1 elementinfo, deviceid = pubfuc.getiteminfo(driver.desired_capabilities, packagename) while suceess_flag: try: behavior.choosetype(driver, elementinfo) while num < 1000: behavior.creatroom(driver, elementinfo) behavior.leaveroom(driver, elementinfo) num + 1 except Exception as e: print('error') # logger.error(f'第{num}次运行出错,设备是:{devicename}') sleep(3) driver.close_app() driver.launch_app() #def startPK