Appium 九宫格 手势解锁

分析九宫格定位

整个九宫格是一个 view

 

九宫格图片
 

 

self.driver.find_element_by_id("com.elc:id/gesturepwd_create_lockview") 

屏幕大小 x 720, y 1280

九宫格定位 x 80, y 488, width 640 height 1048

计算出大小 x 80 y 488

width = 640-80 width 等于 560 
height = 1048-488 height 等于 560
九宫格是正方形

计算出第一个坐标 为了好计算,就把坐标的值全部用整数来计算

p11 = int(x + width / 6), int(y + height / 6) (173, 581) 

计算所有的坐标值

定位方式存在一个字典中

a = {
    "解锁提示": "com.elc:id/gesturepwd_create_text", "九宫格": "com.elc:id/gesturepwd_create_lockview", "继续": "com.elc:id/right_btn", } lock_pattern = self.driver.find_element_by_id(a["九宫格"]) x = lock_pattern.location.get('x') y = lock_pattern.location.get('y') width = lock_pattern.size.get('width') height = lock_pattern.size.get('height') print(x, y, width, height) offset = width / 6 p11 = int(x + width / 6), int(y + height / 6) p12 = int(x + width / 2), int(y + height / 6) p13 = int(x + width - offset), int(y + height / 6) p21 = int(x + width / 6), int(y + height / 2) p22 = int(x + width / 2), int(y + height / 2) p23 = int(x + width - offset), int(y + height / 2) p31 = int(x + width / 6), int(y + height - offset) p32 = int(x + width / 2), int(y + height - offset) p33 = int(x + width - offset), int(y + height - offset

转载于:https://www.cnblogs.com/ai594ai/p/7563378.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值