python/appium实现华为应用商城app界面上下滑动打开关闭通知栏等功能
生活随笔
收集整理的这篇文章主要介绍了
python/appium实现华为应用商城app界面上下滑动打开关闭通知栏等功能
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
banner=driver.find_element_by_id('com.huawei.appmarket:id/banner_item_image')
ele_size=banner.size
#元素的高度和宽度
ele_height=ele_size['height']
ele_width=ele_size['width']
#获取元素左上角坐标
loc=banner.location
#计算起点的横/纵坐标
#start_x1=loc['x']+ele_width*0.2
#start_y1=loc['y']+ele_height*0.5
#计算终点的横/纵坐标
#end_x1=loc['x']+ele_width*0.8
#end_y1=start_x1
#滑动方法*
#driver.swipe(start_x, start_y, end_x, end_y)
#滑动方法*20(左右滑动)
#通过相对定位屏幕坐标的方法,可以适配多种类型
#for i in range(20):#driver.swipe(start_x1,start_y1,end_x1,end_y1)#time.sleep(0.5)#上下滑动
start_x=ele_width*0.5
start_y=ele_height*0.8
end_x=start_x
end_y=ele_height*0.2
for i in range(20):driver.swipe(start_x,start_y,end_x,end_y)time.sleep(0.5)
#打开通知栏调用api
driver.open_notifications()
#关闭通知栏调用api
time.sleep(2)
#通过返回键关闭
driver.long_press_keycode(4)
总结
以上是生活随笔为你收集整理的python/appium实现华为应用商城app界面上下滑动打开关闭通知栏等功能的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 小米应用市场隐私政策
- 下一篇: python定义一个dog类 类属性有名