public static void DrawRectagle(Point upperLeft, int height, int width)
        {
            // Using Touch Action Classes
            TouchAction tAction1 = new TouchAction(AppiumDriver.Instance);

            //TouchAction tAction2 = new TouchAction(AppiumDriver.Instance);
            //TouchAction tAction3 = new TouchAction(AppiumDriver.Instance);
            //TouchAction tAction4 = new TouchAction(AppiumDriver.Instance);
            //TouchAction tAction5 = new TouchAction(AppiumDriver.Instance);
            //TouchAction tAction6 = new TouchAction(AppiumDriver.Instance);

            // perform the swipe
            tAction1.Press(upperLeft.X, upperLeft.Y);
            tAction1.MoveTo(upperLeft.X, upperLeft.Y + height);
            tAction1.MoveTo(upperLeft.X + width, upperLeft.Y + height);
            tAction1.MoveTo(upperLeft.X + width, upperLeft.Y);
            tAction1.MoveTo(upperLeft.X, upperLeft.Y);
            tAction1.Release();

            //MultiAction mAction = new MultiAction(AppiumDriver.Instance);
            //mAction.Add(tAction1).Add(tAction2).Add(tAction3).Add(tAction4).Add(tAction5).Add(tAction6);
            tAction1.Perform();

            // perform the swipe
            //tAction1.Press(upperLeft.X, upperLeft.Y).MoveTo(upperLeft.X, upperLeft.Y + height).MoveTo(upperLeft.X + width, upperLeft.Y + height).MoveTo(upperLeft.X + width, upperLeft.Y).MoveTo(upperLeft.X, upperLeft.Y).Release().Perform();
        }
        public override void PerformStep()
        {
            TouchAction touch = new TouchAction(TestAppMain.Instance.Connector.Driver);

            touch.Press(_swipeStartCordinates.X, _swipeStartCordinates.Y);
            touch.MoveTo(_swipeStopCordinates.X, _swipeStopCordinates.Y);
            touch.Release();
            touch.Perform();
        }
        public void Click(int x, int y, int delay)
        {
            var touchAction = new TouchAction(_driver);

            touchAction.Press(x, y);
            touchAction.Wait(500);
            touchAction.Release();
            touchAction.Perform();
            System.Threading.Thread.Sleep(delay);
        }
Exemple #4
0
        public void ScrollUsingTouchActions(int xStart, int yStart, int xFinal, int yFinal)
        {
            TouchAction action = new TouchAction(DriverFactory.GetDriver());

            action.Press(xStart, yStart);
            action.MoveTo(xFinal, yFinal);
            action.Wait(100);
            action.Perform();
            action.Release();
            ExtentReportHelpers.AddTestInfo(3, "");
        }
Exemple #5
0
        protected void ZZZZScrollUsingTouchActions(string direcao)
        {
            TouchAction action = new TouchAction(DriverFactory.GetDriver());

            action.Press(100, 300);
            action.MoveTo(300, 300);
            action.Perform();
            action.Release();
            ExtentReportHelpers.AddTestInfo(3, "");

            // driver.ExecuteScript("mobile:scroll", new Dictionary<string, string> { { "direction", "left" } });
        }
Exemple #6
0
        public virtual void SwipeToDelete(string automationId, int index)
        {
            var item  = Driver.FindElement(ByAutomationId(automationId));
            var width = Driver.Manage().Window.Size.Width;

            var act   = new TouchAction(Driver);
            var press = act.Press(item, width, item.Location.Y);
            var move  = act.MoveTo(item, 0, item.Location.Y);
            var lift  = act.Release();

            var action = new MultiAction(Driver);

            action.Add(press);
            action.Add(move);
            action.Add(lift);
            action.Perform();
        }
        protected void Click(IWebElement element)
        {
            AguardarLoading();
            WebDriverException possibleWebDriverException = null;
            Stopwatch          timeOut = new Stopwatch();

            timeOut.Start();
            while ((((int)timeOut.Elapsed.TotalSeconds) / 1000) <= GlobalParameters.CONFIG_DEFAULT_TIMEOUT_IN_SECONDS)
            {
                try
                {
                    TouchAction action = new TouchAction(DriverFactory.INSTANCE);
                    action.Tap(element);
                    // action.SingleTap(element);
                    action.Perform();
                    action.Release();
                    ExtentReportHelpers.AddTestInfo(3, "");
                    timeOut.Stop();
                    return;
                }
                catch (StaleElementReferenceException e)
                {
                    continue;
                }
                catch (WebDriverException e)
                {
                    possibleWebDriverException = e;
                    if (e.Message.Contains("Other element would receive the click"))
                    {
                        continue;
                    }
                    throw e;
                }
            }
            try
            {
                throw new Exception(possibleWebDriverException.Message);
            }
            catch (Exception e)
            {
                e.StackTrace.ToString();
            }
        }