/// <summary> /// Performs a long tap on the element of the specified driver. /// </summary> /// <param name="driver">The driver to use.</param> /// <param name="element">The element to long tap.</param> public static void Longtap(IWebDriver driver, IWebElement element) { if (driver is IHasTouchScreen) { TouchActions longtap = new TouchActions(driver); Point center = GetCenter(element); longtap.Down(center.X, center.Y); longtap.Perform(); try { Thread.Sleep(750); } catch (ThreadInterruptedException) { } longtap.Up(center.X, center.Y); longtap.Perform(); } else { ILocatable locatable = (ILocatable)element; ICoordinates coords = locatable.Coordinates; IMouse mouse = ((IHasInputDevices)driver).Mouse; mouse.MouseDown(coords); try { Thread.Sleep(750); } catch (ThreadInterruptedException) { } mouse.MouseUp(coords); } }
public void tapElement(AppiumWebElement element) { TouchActions actions = new TouchActions(driver); actions.SingleTap(element); actions.Perform(); }
protected void DoubleTap(IWebElement element) { WaitForElement(element); TouchActions action = new TouchActions(DriverFactory.INSTANCE); action.DoubleTap(element); action.Perform(); }
protected void doubleTap(IWebElement element) { WaitForElement(element); //IWebElement iElement = driver.FindElement(element); TouchActions action = new TouchActions(DriverFactory.GetDriver()); action.DoubleTap(element); action.Perform(); }
protected void LongPress(IWebElement element) { WaitForElement(element); TouchActions action = new TouchActions(DriverFactory.INSTANCE); action.LongPress(element); action.Release(); action.Perform(); }
protected void longPress(IWebElement element) { WaitForElement(element); //IWebElement iElement = driver.FindElement(element); TouchActions action = new TouchActions(DriverFactory.GetDriver()); action.LongPress(element); action.Perform(); }
/// <summary> /// Performs a single tap on the element of the specified driver. /// </summary> /// <param name="driver">The driver to use.</param> /// <param name="element">The element.</param> public static void Tap(IWebDriver driver, IWebElement element) { if (driver is IHasTouchScreen) { TouchActions tap = (new TouchActions(driver)).SingleTap(element); tap.Perform(); } else { element.Click(); } }
protected void Tap(IWebElement element) { //waitForElement(element); //TouchActions action = new TouchActions(driver); //action.singleTap(element); //action.perform(); WaitForElement(element); //IWebElement iElement = driver.FindElement(element); TouchActions action = new TouchActions(DriverFactory.GetDriver()); action.SingleTap(element); action.Perform(); }
public void TouchEvent_CanTrigger() { Browser.MountTestComponent <TouchEventComponent>(); var input = Browser.Exists(By.Id("touch_input")); var output = Browser.Exists(By.Id("output")); Assert.Equal(string.Empty, output.Text); var actions = new TouchActions(Browser).SingleTap(input); actions.Perform(); Browser.Equal("touchstart,touchend,", () => output.Text); }