# -*- coding: utf-8 -*- # @Author: wangkun # @Time: 2022/9/1 from appium import webdriver from selenium.webdriver.common.by import By class Click: @classmethod def click_video(cls): desired_caps = {'app': r"C:\Program Files (x86)\Tencent\WeChat\WeChat.exe"} driver = webdriver.Remote( command_executor='http://127.0.0.1:4723', desired_capabilities=desired_caps) driver.implicitly_wait(10) driver.find_element(By.NAME, '爬虫群').click() msg_list = driver.find_elements(By.NAME, '消息') msg = msg_list[-1] title = msg.get_attribute('name') print(title) msg.click() if __name__ == '__main__': Click.click_video()