1 from appium import webdriver 2 3 caps = {} 4 caps["platformName"] = "Android" 5 caps["platformVersion"] = "7.0" 6 caps["devicesName"] = "4YUDU16504012037" 7 caps["appActivity"] = "<启动类名>" 8 caps["appPackage"] = "<package name>" 9 caps["ensureWebviewsHavePages"] = True 10 11 driver = webdriver.Remote("http://127.0.0.1:8200/wd/hub", caps) 12 13 el1 = driver.find_element_by_id("<id属性>") 14 调用click方法、send_keys()方法、键盘或触屏事件 15 el1.click() 16 driver.press_keycode(66) 17 driver.quit()