Exemplo n.º 1
0
 public void AddSupportForAll()
 {
     var vals = Enum.GetValues(typeof(TouchAction));
     foreach (TouchAction val in vals)
     {
         actions |= val;
     }
 }
Exemplo n.º 2
0
        //TODO: may need to re-think for more efficient way
        public int GetTouchStateCount(TouchAction actionType)
        {
            int count = (from t in TouchStates
                         where t == actionType.ToTouchActions()
                         select t).Count();

            return count;
        }
Exemplo n.º 3
0
 public IMTContainer AddControl(IMTouchControl control, TouchAction[] touchActions, double left, double top)
 {
     AddToCanvas((UIElement) control);
     var cont = RegisterElement(control, false, touchActions);
     Canvas.SetLeft((UIElement)control, left);
     Canvas.SetTop((UIElement)control, top);
     control.Container.Reset();
     control.Container.StartX = left.ToInt();
     control.Container.StartY = top.ToInt();
     return cont;
 }
Exemplo n.º 4
0
    protected void TouchUpdate(TouchAction action)
    {
        for (int i = 0; i < Input.touchCount; i++)
        {
            RaycastHit hit;
            Ray ray = _camera.ScreenPointToRay(Input.touches[i].position);

            if (Physics.Raycast(ray, out hit))
            {
                Debug.Log(hit.transform.gameObject);
            }

        }
    }
Exemplo n.º 5
0
 public static void RemoveUserFromTeam(string userName)
 {
     try
     {
         AndroidElement dragItem = TeamMemberList.FindElement(userName);
         AndroidElement dropItem = UserList.GetInternalElement();
         TouchAction    action   = new TouchAction(Appium.Instance.Driver);
         action.Press(dragItem).Wait(1500).MoveTo(dragItem).Wait(1500).MoveTo(dropItem).Wait(1500).Release();
         MultiAction multi = new MultiAction(Appium.Instance.Driver);
         multi.Add(action).Perform();
         ConsoleMessage.Pass(String.Format("{0}. Drag user with name: {1} and drop to users list", ActivityName,
                                           userName));
     }
     catch (Exception ex)
     {
         ConsoleMessage.Fail(
             String.Format("{0}. Can't drag user with name: {1} and drop to users list", ActivityName, userName),
             ex);
         throw;
     }
 }
Exemplo n.º 6
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "/html/body/div/div/div[2]/div[2]/div/div[3]/div[1]/div[2]/div[2]/div/div[2]/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div";
            arguments.By.Value     = "xpath";
            var by = arguments.By.Value.ToLower();

            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.FrameLayout / android.widget.FrameLayout / android.widget.FrameLayout / android.widget.FrameLayout[2] / android.widget.FrameLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.EditText";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.search.Value);
            }
        }
Exemplo n.º 7
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.viber.voip:id/bottom_nav_tab_3";
            arguments.By.Value     = "id";
            var by = arguments.By.Value.ToLower();


            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.view.ViewGroup[5]";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }
Exemplo n.º 8
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.viber.voip:id/bottom_nav_tab_3";
            arguments.By.Value     = "id";
            var by = arguments.By.Value.ToLower();


            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                arguments.Search.Value = "com.viber.voip:id / menu_edit";
                arguments.By.Value     = "id";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }
Exemplo n.º 9
0
        public void MultiActionTestCase()
        {
            driver.FindElementById("TextField1").Clear();
            driver.FindElementById("TextField1").SendKeys("2");
            driver.FindElementById("TextField2").Clear();
            driver.FindElementById("TextField2").SendKeys("4");
            IWebElement  el = driver.FindElementByAccessibilityId("ComputeSumButton");
            ITouchAction a1 = new TouchAction(driver);

            a1.Tap(el, 10, 10);
            ITouchAction a2 = new TouchAction(driver);

            a2.Tap(el);
            IMultiAction m = new MultiAction(driver);

            m.Add(a1).Add(a2);
            m.Perform();
            const string str = "6";

            Assert.AreEqual(driver.FindElementByXPath("//*[@name = \"Answer\"]").Text, str);
        }
Exemplo n.º 10
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.tumblr:id / topnav_explore_button_img_active";
            arguments.By.Value     = "id";
            var by = arguments.By.Value.ToLower();

            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(by, arguments.Search.Value).Click();
                arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.view.ViewGroup / androidx.viewpager.widget.ViewPager / android.view.ViewGroup / android.widget.FrameLayout / android.widget.RelativeLayout / android.widget.FrameLayout / android.widget.TextView";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.search.Value);
            }
        }
Exemplo n.º 11
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.rapido.passenger:id / dropText";
            arguments.By.Value     = "id";
            var by = arguments.By.Value.ToLower();

            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.search.Value).SendKeys(arguments.search.Value);
                arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.view.ViewGroup / android.widget.RelativeLayout / android.widget.ScrollView / android.widget.LinearLayout / androidx.recyclerview.widget.RecyclerView / android.view.ViewGroup[1] / android.view.ViewGroup / android.widget.TextView[1]";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }
Exemplo n.º 12
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.snapchat.android:id/avatar_silhouette_3";
            arguments.By.Value     = "id";
            var by = arguments.By.Value.ToLower();


            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                arguments.Search.Value = "com.snapchat.android:id/camera_flip_button";
                arguments.By.Value     = "id";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }
        public LogInPage SwipeToGenerateKey()
        {
            int count = 15;

            while (count-- > 0 && !IsElementDisplayed(btnCancelBackUp))
            {
                var    tAction      = new TouchAction(_driver);
                var    cmp          = WaitForElementDisplayed(cmpDotImagesToSwipe);
                double x            = cmp.Location.X;
                double y            = cmp.Location.Y;
                var    middleHeight = cmp.Size.Height / 2;
                var    middleWidth  = cmp.Size.Width / 2;

                var xLeft  = x;
                var xRight = cmp.Size.Width - x;

                var yMid = y + middleHeight;

                tAction.Press(x + 6 * count, y + 6 * count).Wait(1500).MoveTo(cmp).Release().Perform();
            }
            return(this);
        }
Exemplo n.º 14
0
        //[Test, TestCaseSource(nameof(TestData))]
        public void SearchAndMoveSeekBar(string seekBarId, double percentToMove)
        {
            GoToRotatingButton();
            if (percentToMove > 1)
            {
                throw new Exception("percentToMove variable can be set only in [0,1] range");
            }
            IWebElement seekBar = driver.FindElementById(seekBarId);

            driver.FindElementById(seekBarId).Tap(1, 100);
            //Get start point of seekbar.
            double startX  = seekBar.Location.X;
            double yPos    = seekBar.Location.Y;
            double bound   = seekBar.Size.Width;
            double moveByX = startX + bound * percentToMove;
            //Moving seekbar using TouchAction class.
            TouchAction act = new TouchAction(driver);

            act.LongPress(startX, yPos).MoveTo(startX - bound / 2, yPos).Release().Perform();
            startX = seekBar.Location.X;
            act.LongPress(startX, yPos).MoveTo(moveByX, yPos).Release().Perform();
        }
Exemplo n.º 15
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.viber.voip:id / menu_search";
            arguments.By.Value     = "id";
            var by = arguments.By.Value.ToLower();


            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout/android.view.ViewGroup/androidx.appcompat.widget.LinearLayoutCompat/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.EditText";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.search.Value);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// This method will sign a user IN to google
        /// </summary>
        public void GoogleLogin()
        {
            // Access Menu
            TouchAction    touchAction = new TouchAction(driver);
            AndroidElement element     = driver.FindElementByXPath("//android.widget.ImageView[@content-desc='More options']");
            var            action      = touchAction.Tap(element);

            action.Perform();
            action.Cancel();
            Thread.Sleep(2000);

            // Tap Sign in
            element = driver.FindElementByXPath("//android.widget.TextView[@text='Sign In']");
            action  = touchAction.Tap(element);
            action.Perform();
            action.Cancel();
            Thread.Sleep(2000);

            // Tap Google
            element = driver.FindElementByXPath("//android.widget.Button[@text='GOOGLE']");
            action  = touchAction.Tap(element);
            action.Perform();
            action.Cancel();
            Thread.Sleep(6000);

            // Find all the ListViews On The Page
            var elements = driver.FindElementsByClassName("//android.widget.LinearLayout[@resource-id='com.google.android.gms:id/container']");

            //var elements = driver.FindElementsByClassName("android.widget.ListView");

            // The first List View Element is The Button We Want To Tap
            element = elements.ElementAt(0);
            // So I'm Gonna Tap It.
            action = touchAction.Tap(element);
            action.Perform();
            action.Cancel();
            Thread.Sleep(2000);
        }
        /// <summary>
        /// Convenience method for "zooming in" on an element on the screen.
        /// "zooming in" refers to the action of two appendages Pressing the screen and sliding away from each other.
        /// NOTE:
        /// driver convenience method slides touches away from the element, if driver would happen to place one of them
        /// off the screen, appium will return an outOfBounds error. In driver case, revert to using the MultiAction api
        /// instead of driver method.
        /// <param name="x">x coordinate to terminate the zoom on</param>
        /// <param name="y">y coordinate to terminate the zoom on></param>
        /// </summary>
        public void Zoom(int x, int y)
        {
            MultiAction multiTouch = new MultiAction(this);

            int scrHeight = Manage().Window.Size.Height;
            int yOffset   = 100;

            if (y - 100 < 0)
            {
                yOffset = y;
            }
            else if (y + 100 > scrHeight)
            {
                yOffset = scrHeight - y;
            }

            ITouchAction action0 = new TouchAction(this).Press(x, y).MoveTo(0, -yOffset).Release();
            ITouchAction action1 = new TouchAction(this).Press(x, y).MoveTo(0, yOffset).Release();

            multiTouch.Add(action0).Add(action1);

            multiTouch.Perform();
        }
Exemplo n.º 18
0
    private void handleFirstTouchBegin(Touch touch){
        bool isPlacementCorrecting = activePiece != null && activePiece.GetComponent<PiecePrefabBehaviour>().isPlacementCorrecting();
        if(!resetButtonScript.getResettable() && !isPlacementCorrecting){ // don't want to detect piece touches while the machine is resettable or while placement correction is occurrring
            GameObject hitObject = getSignificant3DObjectHit(touch);
            if(hitObject != null){ // raycast hit a piece
                currTouchAction = TouchAction.MovingPiece;
                hitObject.GetComponent<PiecePrefabBehaviour>().OnPieceTouchBegin();
                return;
            }
        }

        // check if user touched any Canvas objects
        if(hitCanvasElement(touch)){
            return; // user touched something on the canvas, so don't bother with rotation/zooming/panning
        }

        // user didn't touch anything (e.g. buttons, scroll bar) on the canvas. 
        // Since we already know user didn't touch a significant 3D piece either, we'll assume they were either starting to rotate the camera or touching the screen to clear their piece selection. 
        // Either way, clear their piece selection and begin rotation
        ClearActivePiece();
        currTouchAction = TouchAction.RotatingCamera;
        prevFrameFirstTouchPosition = touch.position;
    }
Exemplo n.º 19
0
        private void OnTouch(object sender, SKTouchEventArgs e)
        {
            TouchAction touchAction = TouchAction.None;

            switch (e.ActionType)
            {
            case SKTouchAction.Pressed:
                touchAction = TouchAction.Pressed;
                break;

            case SKTouchAction.Released:
                touchAction = TouchAction.Released;
                break;

            case SKTouchAction.Moved:
                touchAction = TouchAction.Moved;
                break;
            }

            _client.OnTouch(CanvasView.CanvasSize, e.Id, e.Location, touchAction);

            e.Handled = true;
        }
Exemplo n.º 20
0
        public void Execute(Arguments arguments)
        {
            var           driver = OpenCommand._driver;
            TouchAction   action = new TouchAction(driver);
            WebDriverWait wait   = new WebDriverWait(driver, TimeSpan.FromMinutes(1));

            if (arguments.Id.Value != "" || arguments.PartialID.Value != "")
            {
                driver.HideKeyboard();
                SrollToElement(driver, arguments);
            }
            else if (arguments.AmmountToScroll.Value != 0)
            {
                float top          = 0.9f;
                float bottom       = 0.1f;
                float swipeAmmount = arguments.AmmountToScroll.Value / 100f * (top - bottom);
                SwipeVertical(driver, top, top - swipeAmmount, 0.5, 250, arguments.SwipeDir.Value);
            }
            else
            {
                throw new ArgumentException($"The id and text are not defined. You should provide one of them.");
            }
        }
Exemplo n.º 21
0
        public void ConsultaRapidoAtivo(string nomeDoAtivo, string nomeDoAtivo2)
        {
            TouchAction acaoClique = new TouchAction(driver);

            LoginCorreto();

            espera.Until(ExpectedConditions.ElementToBeClickable(iconePesquisaAtivo));
            iconePesquisaAtivo.Click();

            espera.Until(ExpectedConditions.ElementToBeClickable(campoPesquisaAtivo));
            campoPesquisaAtivo.SendKeys(nomeDoAtivo);

            Thread.Sleep(2000);

            acaoClique.Tap(445, 474).Perform();

            Thread.Sleep(4000);

            espera.Until(ExpectedConditions.ElementToBeClickable(btnFechar));
            btnFechar.Click();

            espera.Until(ExpectedConditions.ElementToBeClickable(campoPesquisaAtivo));
            campoPesquisaAtivo.SendKeys(nomeDoAtivo2);

            Thread.Sleep(2000);

            acaoClique = new TouchAction(driver);
            acaoClique.Tap(445, 474).Perform();

            Thread.Sleep(4000);

            espera.Until(ExpectedConditions.ElementToBeClickable(btnFechar));
            btnFechar.Click();

            espera.Until(ExpectedConditions.ElementToBeClickable(btnCancelar));
            btnCancelar.Click();
        }
        public void CheckMasterDetailAndBack()
        {
            var driver = StartApp();
            // tap on second item
            var         el1 = driver.FindElementByName("Second item");
            TouchAction a   = new TouchAction(driver);

            a.Tap(el1);

            el1.Click();
            var el2 = driver.FindElementByAccessibilityId("ItemText");

            Assert.IsTrue(el2.Text == "Second item");

            var backButton = driver.FindElementByAccessibilityId("Back");

            backButton.Click();

            var el3 = driver.FindElementByName("Fourth item");

            Assert.IsTrue(el3 != null);

            driver.CloseApp();
        }
Exemplo n.º 23
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        public override void Update()
        {
            isTouched = false;
            hasGesture = false;

            SiliconStudio.Xenko.Input.InputManager manager = XenkoInputDevice.NativeInputManager;

            if (manager.PointerEvents.Count > 0)
            {
                var pointerEvent = manager.PointerEvents[0];
                if (pointerEvent.PointerType != PointerType.Touch)
                {
                    isTouched = false;
                    return;
                }

                id = pointerEvent.PointerId;
                isTouched = true;
                normalizedX = pointerEvent.Position.X;
                normalizedY = pointerEvent.Position.Y;
                previousState = pointerEvent.State;
                previousLocation = pointerEvent.Position;
                switch (pointerEvent.State)
                {
                    case PointerState.Cancel:
                        action = TouchAction.None;
                        break;
                    case PointerState.Down:
                        action = TouchAction.Pressed;
                        break;
                    case PointerState.Move:
                        action = TouchAction.Moved;
                        break;
                    case PointerState.Out:
                        action = TouchAction.None;
                        break;
                    case PointerState.Up:
                        action = TouchAction.Released;
                        break;
                    default:
                        break;
                }
            }
            else if (previousState == PointerState.Move)
            {
                previousState = PointerState.Out;
                action = TouchAction.Released;
                normalizedX = previousLocation.X;
                normalizedY = previousLocation.Y;
                isTouched = true;
            }

            if (manager.GestureEvents.Count > 0)
            {
                hasGesture = true;
                var gestureEvent = manager.GestureEvents[0];
                switch (gestureEvent.Type)
                {
                    case GestureType.Composite:
                        gesture = TouchGestures.MoveRotateAndScale;
                        var compositeEvent = gestureEvent as GestureEventComposite;
                        normalizedX = compositeEvent.CenterCurrentPosition.X;
                        normalizedY = compositeEvent.CenterCurrentPosition.Y;
                        moveX = compositeEvent.DeltaTranslation.X;
                        moveY = compositeEvent.DeltaTranslation.Y;
                        break;
                    case GestureType.Drag:
                        gesture = TouchGestures.FreeDrag;
                        var dragGestureEvent = gestureEvent as GestureEventDrag;
                        normalizedX = dragGestureEvent.CurrentPosition.X;
                        normalizedY = dragGestureEvent.CurrentPosition.Y;
                        moveX = dragGestureEvent.DeltaTranslation.X;
                        moveY = dragGestureEvent.DeltaTranslation.Y;
                        break;
                    case GestureType.Flick:
                        gesture = TouchGestures.Flick;
                        var flickEvent = gestureEvent as GestureEventFlick;
                        normalizedX = flickEvent.CurrentPosition.X;
                        normalizedY = flickEvent.CurrentPosition.Y;
                        moveX = flickEvent.DeltaTranslation.X;
                        moveY = flickEvent.DeltaTranslation.Y;
                        break;
                    case GestureType.LongPress:
                        gesture = TouchGestures.Hold;
                        var longPressEvent = gestureEvent as GestureEventLongPress;
                        normalizedX = longPressEvent.Position.X;
                        normalizedY = longPressEvent.Position.Y;
                        moveX = moveY = 0;
                        break;
                    case GestureType.Tap:
                        gesture = TouchGestures.Tap;
                        var tapEvent = gestureEvent as GestureEventTap;
                        normalizedX = tapEvent.TapPosition.X;
                        normalizedY = tapEvent.TapPosition.Y;
                        moveX = moveY = 0;
                        break;
                    default:
                        break;
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        public override void Update()
        {
            normalizedX = 0;
            normalizedY = 0;
            gesture = TouchGestures.None;
            isTouched = false;
            action = TouchAction.None;
            moveX = 0;
            moveY = 0;
            hasGesture = false;
            id = 0;

            /*
            hasGesture = false;
            isTouched = false;
            Rect viewport = Engine.Instance.Renderer.GetViewport();

            ActualState = GetState();
            if (ActualState.Count > 0)
            {
                isTouched = true;
                TouchLocation location = ActualState[0];
                id = location.Id;

                normalizedX = location.Position.X / viewport.Width;
                normalizedY = location.Position.Y / viewport.Height;

                switch (location.State)
                {
                    case TouchLocationState.Invalid:
                        action = TouchAction.None;
                        break;
                    case TouchLocationState.Moved:
                        action = TouchAction.Moved;
                        break;
                    case TouchLocationState.Pressed:
                        action = TouchAction.Pressed;
                        break;
                    case TouchLocationState.Released:
                        action = TouchAction.Released;
                        break;
                    default:
                        break;
                }
            }

            if (TouchPanel.IsGestureAvailable)
            {
                GestureSample gs = TouchPanel.ReadGesture();

                normalizedX = gs.Position.X / viewport.Width;
                normalizedY = gs.Position.Y / viewport.Height;
                moveX = gs.Delta.X;
                moveY = gs.Delta.Y;
                gesture = (TouchGestures)(int)gs.GestureType;
                hasGesture = true;
            }
             */
        }
        public void DrawSmileyTestCase()
        {
            driver.FindElementByName("Graphics").Click();
            var el = FindTouchPaint();

            el.Click();
            Thread.Sleep(5000);
            ITouchAction a1 = new TouchAction();

            a1.Press(140, 100).Release();
            ITouchAction a2 = new TouchAction();

            a2.Press(250, 100).Release();
            ITouchAction smile = new TouchAction();

            smile
            .Press(110, 200)
            .MoveTo(1, 1)
            .MoveTo(1, 1)
            .MoveTo(1, 1)
            .MoveTo(1, 1)
            .MoveTo(1, 1)
            .MoveTo(2, 1)
            .MoveTo(2, 1)
            .MoveTo(2, 1)
            .MoveTo(2, 1)
            .MoveTo(2, 1)
            .MoveTo(3, 1)
            .MoveTo(3, 1)
            .MoveTo(3, 1)
            .MoveTo(3, 1)
            .MoveTo(3, 1)
            .MoveTo(4, 1)
            .MoveTo(4, 1)
            .MoveTo(4, 1)
            .MoveTo(4, 1)
            .MoveTo(4, 1)
            .MoveTo(5, 1)
            .MoveTo(5, 1)
            .MoveTo(5, 1)
            .MoveTo(5, 1)
            .MoveTo(5, 1)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, 0)
            .MoveTo(5, -1)
            .MoveTo(5, -1)
            .MoveTo(5, -1)
            .MoveTo(5, -1)
            .MoveTo(5, -1)
            .MoveTo(4, -1)
            .MoveTo(4, -1)
            .MoveTo(4, -1)
            .MoveTo(4, -1)
            .MoveTo(4, -1)
            .MoveTo(3, -1)
            .MoveTo(3, -1)
            .MoveTo(3, -1)
            .MoveTo(3, -1)
            .MoveTo(3, -1)
            .MoveTo(2, -1)
            .MoveTo(2, -1)
            .MoveTo(2, -1)
            .MoveTo(2, -1)
            .MoveTo(2, -1)
            .MoveTo(1, -1)
            .MoveTo(1, -1)
            .MoveTo(1, -1)
            .MoveTo(1, -1)
            .MoveTo(1, -1)
            .Release();

            IMultiAction m = new MultiAction(driver);

            m.Add(a1).Add(a2).Add(smile);
            m.Perform();
            Thread.Sleep(10000);
            driver.Navigate().Back();
            Thread.Sleep(1000);
            driver.Navigate().Back();
            Thread.Sleep(1000);
            driver.GetScreenshot();
        }
Exemplo n.º 26
0
        /// <summary>
        /// This method will sign a user IN to facebook
        /// </summary>
        public void FacebookLogin()
        {
            // Access Menu
            TouchAction    touchAction = new TouchAction(driver);
            AndroidElement element     = driver.FindElementByXPath("//android.widget.ImageView[@content-desc='More options']");
            var            action      = touchAction.Tap(element);

            action.Perform();
            action.Cancel();
            Thread.Sleep(1000);

            // Tap Sign in
            element = driver.FindElementByXPath("//android.widget.TextView[@text='Sign In']");
            action  = touchAction.Tap(element);
            action.Perform();
            action.Cancel();
            Thread.Sleep(1000);

            // Tap Facebook
            element = driver.FindElementByXPath("//android.widget.Button[@text='FACEBOOK']");
            action  = touchAction.Tap(element);
            action.Perform();
            action.Cancel();
            Thread.Sleep(1000);

            // Complete Sign In
            //Container for the web element inside Facebook's webview
            IWebElement webElement;

            Thread.Sleep(4000);

            // Find Email field
            try
            {
                //androidElement = driver.FindElementByXPath("//android.widget.EditText[@resource-id='m_login_email']");
                webElement = driver.FindElementByXPath("//android.widget.EditText[@resource-id='m_login_email']");

                // If email field exists,
                if (webElement.Displayed)
                {
                    //Enter text into email field
                    webElement.SendKeys("*****@*****.**");

                    //Find the password field
                    webElement = driver.FindElementByXPath("//android.widget.EditText[@resource-id='m_login_password']");

                    //Enter password into password field
                    webElement.SendKeys("Prj3beer##");
                    Thread.Sleep(2000);

                    //Find and tap the Log In button
                    webElement = driver.FindElementByClassName("android.widget.Button");
                    action     = touchAction.Tap(webElement);
                    action.Perform();
                    action.Cancel();
                    Thread.Sleep(3000);
                }
            }
            catch (Exception) { }

            Thread.Sleep(2000);
            // If Continue Exists?
            webElement = driver.FindElementByClassName("android.widget.Button");
            action     = touchAction.Tap(webElement);
            action.Perform();
            action.Cancel();

            Thread.Sleep(6000);
        }
Exemplo n.º 27
0
 public bool CheckSupported(TouchAction action)
 {
     return (actions & action) == action;
 }
Exemplo n.º 28
0
 private void OnTouch(MouseEventArgs e, TouchAction touchAction)
 {
     _client.OnTouch(SkElement.CanvasSize, _touchId.Value, e.GetPosition(SkElement).ToSKPoint(), touchAction);
 }
Exemplo n.º 29
0
 public IMTContainer RegisterElement(IMTouchControl control, bool supportAllTouches, TouchAction[] touchActions)
 {
     control.Container = RegisterElement((FrameworkElement)control, supportAllTouches, touchActions);
     return control.Container;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Tells you whether or not this container supports a specific feature or multiple features if supplied with Or'd enum
 /// </summary>
 /// <param name="action">Or'd enum of features to check for</param>
 /// <returns>Bool whether or not this container supports all featured passed</returns>
 public bool Supports(TouchAction action)
 {
     return(this.ElementDef.ElementSupport.CheckSupported(action));
 }
Exemplo n.º 31
0
        public IMTContainer RegisterElement(FrameworkElement control, bool supportAllTouches, TouchAction[] touchActions)
        {
            var prop = new ElementProperties();
            if (!supportAllTouches)
            {
                foreach (var touchAction in touchActions)
                {
                    prop.ElementSupport.AddSupport(touchAction);
                }
            }
            else
            {
                prop.ElementSupport.AddSupportForAll();
            }

            var cont = new MTSmoothContainerRev(control, Canvas, prop);
            Framework.RegisterElement(cont);
            return cont;
        }
 private static PointerUpdateKind GetTouchUpdateKind(TouchAction touchAction)
 {
     switch (touchAction)
     {
         case TouchAction.Down:
             return PointerUpdateKind.LeftButtonPressed;
         case TouchAction.Move:
             return PointerUpdateKind.Other;
         case TouchAction.Up:
             return PointerUpdateKind.LeftButtonReleased;
         default:
             throw new ArgumentOutOfRangeException("touchAction");
     }
 }
Exemplo n.º 33
0
 public void ReRegisterControl(IMTouchControl control, bool supportAllTouchAction, TouchAction[] touchActions)
 {
     UnRegisterElement(control);
     RegisterElement(control, supportAllTouchAction, touchActions);
 }
Exemplo n.º 34
0
 public TouchPointWrapper(Point position, TouchAction action, int id)
 {
     _position = position;
     _action = action;
     _device = new TouchDeviceWrapper(id);
 }
Exemplo n.º 35
0
 public TouchPoint(TouchDevice device, System.Windows.Point position, System.Windows.Rect bounds, TouchAction action)
 {
 }
Exemplo n.º 36
0
        public IWebElement CapturaNoticiaDaLista(AppiumDriver <AndroidElement> driver, string tagDaNoticia, string seletorIdDoElemento = null, string seletorClassDoElemento = null, bool loop = false)
        {
            int contador          = 0;
            int breakLoopNoticias = 20;

            //Nesse else o método captura o elemento da lista pela seletor Id
            if (seletorIdDoElemento != null)
            {
                IWebElement   elementoCapturado = null;
                WebDriverWait espera            = new WebDriverWait(driver, TimeSpan.FromSeconds(20));

                while (elementoCapturado == null)
                {
                    Thread.Sleep(2000);
                    var lista           = driver.FindElementsById(seletorIdDoElemento);
                    var elementOrigem   = lista.LastOrDefault();
                    var elementoDestino = lista.FirstOrDefault();

                    var nomeElementoOrigem  = elementOrigem.Text;
                    var nomeElementoDestino = elementoDestino.Text;

                    elementoCapturado = lista.FirstOrDefault(e => e.Text.ToUpperInvariant().Contains(tagDaNoticia.ToUpperInvariant()));

                    if (elementoCapturado != null)
                    {
                        break;
                    }

                    Thread.Sleep(1000);
                    TouchAction touchAction = new TouchAction(driver);

                    touchAction
                    .Press(elementOrigem.Location.X, elementOrigem.Location.Y)
                    .Wait(1000)
                    .MoveTo(elementoDestino.Location.X, elementoDestino.Location.Y)
                    .Release()
                    .Perform();

                    lista           = driver.FindElementsById(seletorIdDoElemento);
                    elementOrigem   = lista.LastOrDefault();
                    elementoDestino = lista.FirstOrDefault();

                    var nomeNovoElementoOrigem  = elementOrigem.Text;
                    var nomeNovoElementoDestino = elementoDestino.Text;

                    if (nomeElementoOrigem == nomeNovoElementoOrigem && nomeElementoDestino == nomeNovoElementoDestino)
                    {
                        break;
                    }

                    if (contador == breakLoopNoticias && loop == true)
                    {
                        break;
                    }

                    contador++;
                }
                return(elementoCapturado);
            }

            //Nesse else o método captura o elemento da lista pela seletor Class
            else if (seletorClassDoElemento != null)
            {
                IWebElement   elementoCapturado = null;
                WebDriverWait espera            = new WebDriverWait(driver, TimeSpan.FromSeconds(20));

                while (seletorClassDoElemento == null)
                {
                    Thread.Sleep(2000);
                    var lista           = driver.FindElementsByClassName(seletorIdDoElemento);
                    var elementOrigem   = lista.LastOrDefault();
                    var elementoDestino = lista.FirstOrDefault();

                    var nomeElementoOrigem  = elementOrigem.Text;
                    var nomeElementoDestino = elementoDestino.Text;

                    elementoCapturado = lista.FirstOrDefault(e => e.Text.ToUpperInvariant() == tagDaNoticia.ToUpperInvariant());

                    if (elementoCapturado != null)
                    {
                        break;
                    }

                    Thread.Sleep(1000);
                    TouchAction touchAction = new TouchAction(driver);

                    touchAction
                    .Press(elementOrigem.Location.X, elementOrigem.Location.Y)
                    .Wait(1000)
                    .MoveTo(elementoDestino.Location.X, elementoDestino.Location.Y)
                    .Release()
                    .Perform();

                    lista           = driver.FindElementsById(seletorIdDoElemento);
                    elementOrigem   = lista.LastOrDefault();
                    elementoDestino = lista.FirstOrDefault();

                    var nomeNovoElementoOrigem  = elementOrigem.Text;
                    var nomeNovoElementoDestino = elementoDestino.Text;

                    if (nomeElementoOrigem == nomeNovoElementoOrigem && nomeElementoDestino == nomeNovoElementoDestino)
                    {
                        break;
                    }

                    if (contador == breakLoopNoticias && loop == true)
                    {
                        break;
                    }

                    contador++;
                }
                return(elementoCapturado);
            }

            else
            {
                return(null);
            }
        }
Exemplo n.º 37
0
 /// <summary>
 /// Creates a tap on x-y-coordinates for a given time
 /// </summary>
 private ITouchAction CreateTap(int x, int y, int duration)
 {
     TouchAction tap = new TouchAction(this);
     return tap.Press(x, y).Wait(duration).Release();
 }
Exemplo n.º 38
0
 public void AddSupport(TouchAction action)
 {
     actions |= action;
 }
Exemplo n.º 39
0
 /// <summary>
 /// Tells you whether or not this container supports a specific feature or multiple features if supplied with Or'd enum
 /// </summary>
 /// <param name="action">Or'd enum of features to check for</param>
 /// <returns>Bool whether or not this container supports all featured passed</returns>
 public bool Supports(TouchAction action)
 {
     return this.ElementDef.ElementSupport.CheckSupported(action);
 }
Exemplo n.º 40
0
        // Verify Weekly Transfer - End after # of transfers -success.
        // **************valid hash transfers
        public void Case106371()
        {
            this.test = this.extent.StartTest("CASE_106371");
            this.Login();

            var touchTransfer = new TouchAction(this.Driver);

            touchTransfer.Tap(85, 680).Perform();

            var wait = new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1));

            wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Name("Transfer Between My Eastern Bank Accounts")));

            var betweenEasternAccountsButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Transfer Between My Eastern Bank Accounts')]")));

            betweenEasternAccountsButton.Click();

            wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Name("Choose From Account")));

            var chooseFromAccountButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Choose From Account")));

            chooseFromAccountButton.Click();

            var fromAccount = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'ACCT *7927')]")));

            fromAccount.Click();

            var amountInput = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Enter Amount $0.00")));

            amountInput.SendKeys("100");

            var chooseToAccountButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Choose To Account")));

            chooseToAccountButton.Click();

            var toAccount = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'FREE CHECKING *5921')]")));

            toAccount.Click();

            var frequency = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Frequency One Time Now')]")));

            frequency.Click();

            var oneTimeScheduled = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Weekly')]")));

            oneTimeScheduled.Click();

            var startOn = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Start On')]")));

            startOn.Click();

            var nextMonth = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Next Month')]")));

            nextMonth.Click();

            var selectAvailableDate = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Available')]")));

            selectAvailableDate.Click();

            var endTransfer = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'End Transfer Never')]")));

            endTransfer.Click();

            var afterTransfers = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'After # Transfers')]")));

            afterTransfers.Click();

            var enterNoOfTransfers = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeStaticText[contains(@name,'Enter # Transfers')]//parent::XCUIElementTypeOther//following-sibling::XCUIElementTypeTextField")));

            enterNoOfTransfers.SendKeys("3");

            // driver.HideKeyboard();
            var continueButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Continue")));

            continueButton.Click();

            wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Name("Schedule Transfer")));

            var scheduleTransfer = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Schedule Transfer")));

            scheduleTransfer.Click();

            // transfer-successful
            var doneButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Done")));

            this.test.Log(LogStatus.Pass, "End of # Transfers is scheduled");
            doneButton.Click();
        }
Exemplo n.º 41
0
 public void OnTouchAction(Element element, TouchActionEventArgs args)
 {
     TouchAction?.Invoke(element, args);
 }
Exemplo n.º 42
0
        // Verify Weekly Transfer- End on Date Error Then Success W/Valid Recurring Date
        // ***************************************************************************
        public void Case106372()
        {
            this.test = this.extent.StartTest("CASE_106372");
            this.Login();

            var touchTransfer = new TouchAction(this.Driver);

            touchTransfer.Tap(85, 680).Perform();

            // TouchAction touchTransfer = new TouchAction(driver);
            // touchTransfer.Tap(85, 680).Perform();
            var wait = new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1));

            wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Name("Transfer Between My Eastern Bank Accounts")));

            // WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1));
            // wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Name("Transfer Between My Eastern Bank Accounts")));
            var betweenEasternAccountsButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Transfer Between My Eastern Bank Accounts')]")));

            betweenEasternAccountsButton.Click();

            wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Name("Choose From Account")));

            var chooseFromAccountButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Choose From Account")));

            chooseFromAccountButton.Click();

            var fromAccount = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'ACCT *7927')]")));

            fromAccount.Click();

            var amountInput = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Enter Amount $0.00")));

            amountInput.SendKeys("100");

            var chooseToAccountButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Choose To Account")));

            chooseToAccountButton.Click();

            var toAccount = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'FREE CHECKING *5921')]")));

            toAccount.Click();

            var frequency = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Frequency One Time Now')]")));

            frequency.Click();

            var every2Weeks = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Every 2 Weeks')]")));

            every2Weeks.Click();

            var startOn = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Start On')]")));

            startOn.Click();

            var nextMonth = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Next Month')]")));

            nextMonth.Click();

            var selectAvailableStartDate = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Available')]")));

            selectAvailableStartDate.Click();

            var endTransfer = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'End Transfer Never')]")));

            endTransfer.Click();

            var onDate = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'On Date')]")));

            Assert.AreEqual(true, onDate.Displayed);
            onDate.Click();

            var nextMonth1 = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Next Month')]")));

            nextMonth1.Click();

            var selectAvailableStartDate1 = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.XPath("//XCUIElementTypeButton[contains(@name,'Available')]")));

            selectAvailableStartDate1.Click();

            var continueButton = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Continue")));

            continueButton.Click();

            var alertTitle = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Alert")));

            Assert.AreEqual(true, alertTitle.Displayed);

            var alertMessage = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("Please enter a valid recurring date")));

            Assert.AreEqual("Please enter a valid recurring date", alertMessage.Text);

            var alertOk = (RemoteWebElement) new WebDriverWait(this.Driver, TimeSpan.FromMinutes(1)).Until(
                ExpectedConditions.ElementExists(By.Name("OK")));

            alertOk.Click();
        }
Exemplo n.º 43
0
        //Esse método efetual um scrool no final de uma lista disponível
        public void ScrollParaListasPlanilhas(AppiumDriver <AndroidElement> driver, string seletorIdDoElemento = null, string seletorClassDoElemento = null)
        {
            //Nesse else o método captura o elemento da lista pela seletor Id
            if (seletorIdDoElemento != null)
            {
                var validador = true;

                while (validador)
                {
                    var lista           = driver.FindElementsById(seletorIdDoElemento);
                    var elementOrigem   = lista.LastOrDefault();
                    var elementoDestino = lista.FirstOrDefault();

                    var nomeElementoOrigem  = elementOrigem.Text;
                    var nomeElementoDestino = elementoDestino.Text;

                    TouchAction touchAction = new TouchAction(driver);

                    Thread.Sleep(1000);

                    touchAction
                    .Press(elementOrigem.Location.X, elementOrigem.Location.Y)
                    .Wait(1000)
                    .MoveTo(elementoDestino.Location.X, elementoDestino.Location.Y)
                    .Release()
                    .Perform();

                    lista           = driver.FindElementsById(seletorIdDoElemento);
                    elementOrigem   = lista.LastOrDefault();
                    elementoDestino = lista.FirstOrDefault();

                    var nomeNovoElementoOrigem  = elementOrigem.Text;
                    var nomeNovoElementoDestino = elementoDestino.Text;

                    if (nomeElementoOrigem == nomeNovoElementoOrigem && nomeElementoDestino == nomeNovoElementoDestino)
                    {
                        break;
                        validador = false;
                    }
                }
            }

            //Nesse else o método captura o elemento da lista pela seletor Class
            else if (seletorClassDoElemento != null)
            {
                var validador = true;

                while (validador)
                {
                    var lista           = driver.FindElementsByClassName(seletorClassDoElemento);
                    var elementOrigem   = lista.LastOrDefault();
                    var elementoDestino = lista.FirstOrDefault();

                    var nomeElementoOrigem  = elementOrigem.Text;
                    var nomeElementoDestino = elementoDestino.Text;

                    TouchAction touchAction = new TouchAction(driver);

                    Thread.Sleep(1000);

                    touchAction
                    .Press(elementOrigem.Location.X, elementOrigem.Location.Y)
                    .Wait(1000)
                    .MoveTo(elementoDestino.Location.X, elementoDestino.Location.Y)
                    .Release()
                    .Perform();

                    lista           = driver.FindElementsById(seletorIdDoElemento);
                    elementOrigem   = lista.LastOrDefault();
                    elementoDestino = lista.FirstOrDefault();

                    var nomeNovoElementoOrigem  = elementOrigem.Text;
                    var nomeNovoElementoDestino = elementoDestino.Text;

                    if (nomeElementoOrigem == nomeNovoElementoOrigem && nomeElementoDestino == nomeNovoElementoDestino)
                    {
                        break;
                        validador = false;
                    }
                }
            }
        }
Exemplo n.º 44
0
 /// <summary>
 /// Creates a tap on an element for a given time
 /// </summary>
 private ITouchAction CreateTap(W element, int duration)
 {
     TouchAction tap = new TouchAction(this);
     return tap.Press(element).Wait(duration).Release();
 }