有人問我,appium怎麼去刪除qq聊天的,python
當時想到的是滑動,android
但是具體的大概有個思路,因而乎,就想本身來實現下,git
打開模擬器,開發者選項,找到顯示座標的github
而後去打開qq獲取要刪除的消息的座標後,web
思路是y不變。x變化。api
用到api TouchActionapp
整個代碼是:ide
from appium import webdriver import time from appium.webdriver.common.touch_action import TouchAction desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = '127.0.0.1:62001' desired_caps['preformVersion'] = '4.4.2' desired_caps['appPackage'] = 'com.tencent.mobileqq' desired_caps['appActivity'] = '.activity.SplashActivity' driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps) time.sleep(10) TouchAction(driver).press(x=250,y=235).wait(1000).move_to(x=5,y=235).release().perform() time.sleep(6) driver.find_element_by_xpath('//android.view.View[@content-desc=\"刪除\"]').click()
實現效果:測試
這就實現了 appium操做qq,實現滑動刪除消息。spa
關注公衆號,不按期更新。