有人问我,appium怎么去删除qq聊天的,

当时想到的是滑动,

可是具体的大概有个思路,于是乎,就想自己来实现下,

打开模拟器,开发者选项,找到显示坐标的

然后去打开qq获取要删除的消息的坐标后,

思路是y不变。x变化。

用到api   TouchAction

整个代码是:

 
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,实现滑动删除消息。

关注公众号,不定期更新。

github 地址:https://github.com/liwanlei . qq群:python|测试|技术交流群 194704520 
python测试开发交流群 683894834 
python接口测试群:651392041
腾讯视频:http://v.qq.com/vplus/6797e52f56a39105a0b6c87bb849e22c/videos

最新文章

  1. [iOS-UI]给输入框添加清除按钮的代码
  2. 2014 Super Training #7 E Calculate the Function --矩阵+线段树
  3. 【SPOJ】1825. Free tour II(点分治)
  4. Linux 下多核CPU知识【转】
  5. ubuntu 永久设置dns信息
  6. Linux源代码情景分析读书笔记 物理页面的分配
  7. 了解Git
  8. (五)u-boot2013.01.01 for TQ210:《移植前的准备及u-boot初编译》
  9. AJP协议总结与分析
  10. 从P1到P7——我在淘宝这7年(转)
  11. 【转】svn cleanup failed–previous operation has not finished; run cleanup if it was interrupted
  12. java的热部署和热加载
  13. python_IO编程
  14. UVA - 10723 类似LCS
  15. linux磁盘满了的处理
  16. 20190321-HTML基本结构
  17. iris数据集(鸢尾花)
  18. 数据格式XML、JSON详解
  19. Linux安装-kickstart无人值守安装
  20. 从浏览器中输入URL到页面加载的发生了什么-转载

热门文章

  1. scrapy爬虫框架之Xpath选择器
  2. 12-5 张雨RTCM3数据解码解不出的原因
  3. Alpha 冲刺报告
  4. 【Alpha】Daily Scrum Meeting
  5. spring中MessageSource的配置使用方法3--ResourceBundleMessageSource【转】
  6. iptables.md
  7. iOS 开源库系列 Aspects核心源码分析---面向切面编程之疯狂的 Aspects
  8. 翻新并行程序设计的认知整理版(state of the art parallel)
  9. CentOs7.2编译安装Nginx服务器
  10. BZOJ3160:万径人踪灭(FFT,Manacher)