test students in the application of automated testing, often use to find elements, positioning elements, send data, long press, point
Swipe, slide, slide, Zoli, right, and so on. The following is how to implement the swipe method with Appium to achieve the slip,
Slide, Zoli and right.
Pre-condition:appium is turned on, and the phone is linked.
Locate the element by using The uiautomator that comes with the SDK .
Python by Appium modules can be linked to the phone normally
A. open uiautomator to familiarize yourself with the XandY coordinates. Concept
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9C/E2/wKioL1l3M1SxzjlSAAlzP_s-ovo941.png-wh_500x0-wm_ 3-wmp_4-s_3286417707.png "title=" appium coordinates. png "alt=" wkiol1l3m1sxzjlsaalzp_s-ovo941.png-wh_50 "/>
Each element has a start and end coordinates. (that is, this element is positioned in the screen)
The last element in the display area on the right begins with the coordinates [772.1872] , ending with coordinates of [817,1905]
So we're going to slide the screen, that is, click on a coordinate and slide it to another coordinate.
, the screen will slide accordingly.
two. using the swipe method
Top slip:
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/9C/E2/wKioL1l3M3ThpEbSAABVKBx-bi8548.png-wh_500x0-wm_ 3-wmp_4-s_2978371697.png "title=" gets the screen size up slide. png "alt=" wkiol1l3m3thpebsaabvkbx-bi8548.png-wh_50 "/>
get the size of the screen first, each phone size is different, so through the get_window_size function to get the size.
the top slide operation is to click a coordinate from the lower end of the screen and swipe up,and the X- coordinate will be the same. the start and end coordinates of Y are improved.
Decline:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/9C/E2/wKioL1l3M37AqK41AAAmLHNLpMQ664.png-wh_500x0-wm_ 3-wmp_4-s_1363649067.png "title=" slipped. png "alt=" wkiol1l3m37aqk41aaamlhnlpmq664.png-wh_50 "/>
The downside is to click a coordinate from the top of the screen and slide down to another coordinate, thex- coordinate can be the same. the start and end coordinates of Y can be changed.
Left Slide:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/9C/E2/wKiom1l3M4fy_BRvAAAlmdP7axY898.png-wh_500x0-wm_ 3-wmp_4-s_3007632295.png "title=" left slide. png "alt=" wkiom1l3m4fy_brvaaalmdp7axy898.png-wh_50 "/>
left slide is from the right end of the screen click a coordinate point to the left to another coordinate point. the Y -coordinate can not be changed. the start and end coordinates of X can be changed.
Right slide:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/9C/E2/wKiom1l3M5Gzv7UsAAAmZk_PkJc363.png-wh_500x0-wm_ 3-wmp_4-s_2194492208.png "title=" right slide. png "alt=" wkiom1l3m5gzv7usaaamzk_pkjc363.png-wh_50 "/>
Right-click a coordinate point from the left side of the screen and slide back to another coordinate point . The Y -coordinate can be the same. the start and end coordinates of X can be changed.
If you have a problem, you can communicate. QQ Group: 610845268
This article is from the "It Bug" blog, so be sure to keep this source http://laomomo.blog.51cto.com/6595318/1950921
Appium_swipe simulation up and down slide operation