DEV Community

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

Posted on

3 3

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay