DEV Community

Cover image for Swipe objects in Appium with C#
DelRayo
DelRayo

Posted on

Swipe objects in Appium with C#

Simple function for swiping object 1 to object 2 in Appium using C#

Swipe objects in appium using W3C standards in C#

https://github.com/delrayo/swiping_appium_c-/blob/main/swipe.cs

/// this code works Following the W3C standards

using System.Threading;
using OpenQA.Selenium.Appium.MultiTouch;

float object1CoordinateX = 500;
float object1CoordinateY = 500;
float object2CoordinateX = 500;
float object2CoordinateY = 1000;

TouchAction actionOne = new TouchAction((OpenQA.Selenium.Appium.Interfaces.IPerformsTouchActions)TestData.driver);
actionOne.Press(object1CoordinateX, object1CoordinateY);
actionOne.MoveTo(object2CoordinateX, object2CoordinateY);
actionOne.Release();
actionOne.Perform();
Thread.Sleep(2500);
Enter fullscreen mode Exit fullscreen mode

https://delrayo.tech/blog/post/1634195/swipe-appium-csharp
https://www.DelRayo.tech

Top comments (0)