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界面上下滑动打开关闭通知栏等功能的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小米应用市场隐私政策
- 下一篇: Web滚动字幕(MARQUEE示例)