/// <summary> /// LongPress over a specific element that will be found using it's classname. /// </summary> /// <param name="className"> classname of the element to be found </param> /// <param name="duration"> time to wait until swipe to position </param> public static void LongPressByClassName(string className, int duration = 1) { ITouchAction action = BuildSingleAction(); try { AppiumWebElement element = GetControl.ByClass(className); action.LongPress(element).Wait(duration).Release().Perform(); } catch (Exception ex) { Assert.Fail("PressByClassName threw an exception: " + ex.Message); } }
/// <summary> /// LongPress over a specific element that will be found using it's classname. /// Can be used when that element shows a toggle or a popUp if press. /// </summary> /// <param name="className1"></param> /// <param name="className2"></param> /// <param name="duration"></param> public static void LongPressByClassName(string className1, string className2, int duration = 0) { ITouchAction action = BuildSingleAction(); try { AppiumWebElement firstElem = GetControl.ByClass(className1); AppiumWebElement secondElem = GetControl.ByClass(className2); action.LongPress(firstElem).Wait(duration).MoveTo(secondElem).Release().Perform(); } catch (Exception ex) { Assert.Fail("LongPressByClassName threw an exception: " + ex.Message); } }