def group_setting_group1(self): base = Base(self.driver) # 点击群设置 base.click([By.ID, "com.cnmts.smart_message:id/btn_right"]) # 群减人 number = base.findElement( [By.ID, "com.cnmts.smart_message:id/tv_group_member_size"]).text a = re.findall(r"\d+\.?\d*", number) b = int(a[0]) if b < 4: c = b + 2 base.findElements([By.ID, "com.cnmts.smart_message:id/iv_avatar" ])[c].click() else: base.findElements([By.ID, "com.cnmts.smart_message:id/iv_avatar" ])[6].click() self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("任少龙")').click() base.click([By.ID, "com.cnmts.smart_message:id/btn_sure"]) sleep(2)
def group_setting_group2(self): base = Base(self.driver) # 点击群设置 base.click([By.ID, "com.cnmts.smart_message:id/btn_right"]) number = base.findElement( [By.ID, "com.cnmts.smart_message:id/tv_group_member_size"]).text a = re.findall(r"\d+\.?\d*", number) b = int(a[0]) # 群加人 if b < 3: d = b + 1 base.findElements([By.ID, "com.cnmts.smart_message:id/iv_avatar" ])[d].click() else: sleep(2) base.findElements([By.ID, "com.cnmts.smart_message:id/iv_avatar" ])[5].click() base.click([By.ID, "com.cnmts.smart_message:id/query"]) base.sendKeys([By.ID, "com.cnmts.smart_message:id/query"], "王德晨") base.click([By.ID, "com.cnmts.smart_message:id/radio_select"]) base.click([By.ID, "com.cnmts.smart_message:id/btn_ok"])