Appium Mobile Test Slide (ii)

Source: Internet
Author: User

In the iOS test, you need to use the swipe, so the Java package a set of sliding methods, not to mention, paste code

/*** Slide up 1/4 screen*/     Public voidslideup1_4 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/2, Y/3 * 2, X/2, Y/3 * 1, 0); }    /*** Slide up 1/2 screen*/     Public voidslideup1_2 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/2, Y/4 * 3, X/2, Y/4 * 1, 0); }    /*** Slide 1/4 screen*/     Public voidslidedown1_4 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/2, Y/3 * 1, X/2, Y/3 * 2, 0); }    /*** Slide 1/2 screen*/     Public voidslidedown1_2 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/2, Y/4 * 1, X/2, Y/4 * 3, 0); }    /*** Left slide 1/2 screen*/     Public voidslideleft1_2 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/4 * 3, Y/2, X/4 * 1, Y/2, 0); }    /*** Left slide 2/3 screen*/     Public voidSlideleft2_3 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/3 * 2, Y/2, 0, Y/2, 0); }    /*** Right Slide 1/2 screen*/     Public voidslideright1_2 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/4 * 1, Y/2, X/4 * 3, Y/2, 0); }    /*** Right Slide 2/3 screen*/     Public voidSlideright2_3 () {intx =driver.manage (). window (). GetSize (). width; inty =driver.manage (). window (). GetSize (). Height; Driver.swipe (x/3 * 1, Y/2, X, Y/2, 0); }    /*** Swipe up in an element to swipe up *@paramIncoming webelement*/     Public voidSlideup (Webelement a) {intx =a.getsize (). width; inty =a.getsize (). Height; Driver.swipe (x/Ten, Y/3 * 2, X/10, Y/3 * 1, 0); }    /*** Swipe down in an element * *@paramIncoming webelement*/     Public voidSlidedown (Webelement a) {intx =a.getsize (). width; inty =a.getsize (). Height; Driver.swipe (x/Ten, Y/3 * 1, X/10, Y/3 * 2, 0); }    /*** Swipe left in an element * *@paramIncoming webelement*/     Public voidSlideleft (Webelement a) {intx =a.getsize (). width; inty =a.getsize (). Height; Driver.swipe (x/4 * 3, Y/10, X/4 * 2, Y/10, 0); }    /*** Swipe right in an element * *@paramIncoming webelement*/     Public voidSlideright (Webelement a) {intx =a.getsize (). width; inty =a.getsize (). Height; Driver.swipe (x/4 * 2, Y/10, X/4 * 3, Y/10, 0); }    /*** Long Press on an element * *@paramIncoming webelement *@paramincoming Time MS **/     Public voidLongpress (Webelement el,intduration) {touchaction Action=Newtouchaction (driver);    Action.longpress (el, duration); }    /*** Drag an element to another element * *@paramIncoming webelement*/     Public voidTouch_webelement_to_other_webelement (webelement E1, webelement E2) {touchaction action=Newtouchaction (driver);    Action.longpress (E1). MoveTo (E2); }

Appium Mobile Test Slide (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.