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();
        }
        //move the screen from element to another.
        public void Swipe(string StartId, params string[] arguments)
        {
            try
            {
                if (arguments != null && 1 == arguments.Length)
                {
                    IWebElement endElement   = GetElement(arguments[0]);
                    IWebElement startElement = GetElement(StartId);

                    int xEnd = endElement.Location.X;
                    int yEnd = endElement.Location.Y;

                    int xStart = startElement.Location.X;
                    int yStart = startElement.Location.Y;

                    TouchAction action = new TouchAction(_driver);
                    action.Press(xStart, yStart).MoveTo(xEnd - xStart, yEnd - yStart).Perform();
                    //_driver.Swipe(xStart, yStart, xEnd, yEnd, 1000);
                }
                else if (arguments != null && arguments.Length > 1)
                {
                    IWebElement   startElement = GetElement(StartId);
                    Point         startPoint   = new Point(startElement.Location.X, startElement.Location.Y);
                    IList <Point> swipePoints  = new List <Point>();
                    //IList<IWebElement> swipeElements = new List<IWebElement>();
                    foreach (string s in arguments)
                    {
                        IWebElement element = GetElement(s);
                        swipePoints.Add(new Point(element.Location.X, element.Location.Y));
                    }
                    TouchAction action = new TouchAction(_driver);
                    action.Press(startPoint.X, startPoint.Y);
                    for (int i = 0; i < swipePoints.Count; i++)
                    {
                        if (i == 0)
                        {
                            action.MoveTo(swipePoints[i].X - startPoint.X, swipePoints[i].Y - startPoint.Y);
                        }
                        else
                        {
                            action.MoveTo(swipePoints[i].X - swipePoints[i - 1].X, swipePoints[i].Y - swipePoints[i - 1].Y);
                        }
                    }
                    action.Perform();
                }
                else
                {
                    throw new Exception("Swipe operator miss some parameters");
                }
            }
            catch
            {
                if (arguments.Contains("-i"))
                {
                    return;
                }
                throw;
            }
        }
Exemplo n.º 3
0
        public void MoveToTest()
        {
            ITouchAction touchAction = new TouchAction(_driver);
            var          element     = _driver.FindElementById("android:id/content");
            Point        point       = element.Coordinates.LocationInDom;

            touchAction.MoveTo(point.X, point.Y).Perform();
        }
Exemplo n.º 4
0
        public static void ScrollMobile(IPerformsTouchActions driver, IWebElement element)
        {
            TouchAction touchAction = new TouchAction(driver);

            touchAction
            .MoveTo(element, 0, 0)
            .Perform();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
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, "");
        }
Exemplo n.º 7
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" } });
        }
Exemplo n.º 8
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();
        }
        public static void MoveTo(this IWebElement element)
        {
            TouchAction touchAction = new TouchAction(mobileDriver);

            touchAction.MoveTo(element).Perform();
        }