Appium: useful codes

Long press/Tap and hold

TouchAction action = new TouchAction();


Swipe to element[7]

[Test ()]
public void ComplexTouchActionTestCase ()
    IList<AppiumWebElement> els = driver.FindElementsByClassName ("android.widget.TextView");
    var loc1 = els [7].Location;
    AppiumWebElement target = els[1];
    var loc2 = target.Location;
    driver.Swipe (loc1.X, loc1.Y, loc2.X, loc2.Y, 800); //this action includes almost all touch actions
    Assert.AreNotEqual(loc2.Y, target.Location.Y);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s