public static void PressAndSwipe(IWebElement element, double porcent, int loop = 0)
        {
            //String[] args = input.split(ESCAPED_INPUT_PARAMETER_DELIMITER);
            //Point objectCenter = getObjectCenterCoordinate(element.Location.);
            //int loop = Integer.parseInt(args[2]);
            int anchorX = element.Location.X;
            int startY  = element.Location.Y;
            int moveY   = (int)(startY * porcent / 100);
            //if (args[0].toLowerCase().equals("down"))
            //{
            //    moveY = moveY * -1;
            //}
            TouchAction touchAction = new TouchAction(mobileDriver);

            if (loop != 0)
            {
                for (int i = 0; i < loop; i++)
                {
                    touchAction.Press(anchorX, startY).Wait()
                    .MoveTo(anchorX, startY + moveY).Perform();
                }
            }
            else
            {
                touchAction.Press(anchorX, startY).Wait()
                .MoveTo(anchorX, startY + moveY).Perform();
            }
        }
Пример #2
0
        static void ScrollDown(Size screenSize, By targetBy = null)
        {
            var touch = new TouchAction(_driver);

            if (targetBy == null)
            {
                touch.Press(50, screenSize.Height * 0.9)
                .Wait(300)
                .MoveTo(50, screenSize.Height * 0.1)
                .Wait(500)
                .Release()
                .Perform();
            }
            else
            {
                var targetEle = _driver.FindElements(targetBy).Last();

                touch.Press(targetEle, 50, screenSize.Height * 0.9)
                .Wait(300)
                .MoveTo(targetEle, 50, screenSize.Height * 0.1)
                .Wait(500)
                .Release()
                .Perform();
            }
        }
Пример #3
0
        //For Scrolling down directly to the button
        //public void PressEnter(string locator)
        //{
        //    waitDriver.Until(ExpectedConditions.ElementExists(By.Id(locator)));
        //    {
        //        IWebElement elementbutton = waitDriver.Until(ExpectedConditions.ElementExists(By.Id(locator)));
        //        IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
        //        js.ExecuteScript("arguments[0].scrollIntoView();", elementbutton);
        //        // var elmnt = document.getElementById("content");
        //        //  elmnt.scrollIntoView();
        //        IWebElement button = waitDriver.Until(ExpectedConditions.ElementToBeClickable(By.Id(locator)));
        //        {
        //            //button.SendKeys(OpenQA.Selenium.Keys.Enter);
        //            button.Click();
        //        }
        //        // js.executeScript("arguments[0].scrollIntoView();", locator);

        //    }
        //}

        //public void ScrollToElement(string locator)
        //{
        //    waitDriver.Until(ExpectedConditions.ElementExists(By.Id(locator)));
        //    {
        //        IWebElement elementbutton = waitDriver.Until(ExpectedConditions.ElementExists(By.Id(locator)));
        //        IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
        //        js.ExecuteScript("arguments[0].scrollIntoView();", elementbutton);
        //        // var elmnt = document.getElementById("content");
        //        //  elmnt.scrollIntoView();
        //        //IWebElement button = waitDriver.Until(ExpectedConditions.ElementToBeClickable(By.Id(locator)));
        //        //{
        //        //    //button.SendKeys(OpenQA.Selenium.Keys.Enter);
        //        //    button.Click();
        //        //}
        //        // js.executeScript("arguments[0].scrollIntoView();", locator);

        //    }
        //}

        //public void verification(string message, string locator)
        //{
        //    try
        //    {
        //        IWebElement Control = waitDriver.Until(ExpectedConditions.ElementIsVisible(By.Id(locator)));
        //        Assert.AreEqual(message, Control.Text);
        //    }
        //    catch (ElementNotVisibleException ex)
        //    {
        //        throw new AssertFailedException(string.Format("The element provided {0} is invalid", locator));

        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message);
        //    }
        //}


        //For returning the value from the web page of the keyword given using xpath

        public void date_wheel(string year, string month)
        {
            try
            {
                month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(month)).Substring(0, 3);
                scroll_to_element_text(month);
                var    pickerChildren = driver.FindElements(By.Id("android:id/numberpicker_input"));
                string check          = pickerChildren[0].GetAttribute("text");
                if (check != month)
                {
                    ITouchAction tc      = new TouchAction(driver);
                    var          element = driver.FindElements(By.ClassName("android.widget.Button"));
                    string       value   = element[0].GetAttribute("text");
                    string       value2  = element[1].GetAttribute("text");
                    if (value == month)
                    {
                        Thread.Sleep(2000);
                        tc.Press(pickerChildren[0]).Wait(1000).MoveTo(element[1]).Release().Perform();
                    }
                    else if (value2 == month)
                    {
                        Thread.Sleep(2000);
                        tc.Press(pickerChildren[0]).Wait(1000).MoveTo(element[0]).Release().Perform();
                    }
                }

                scroll_to_element_text_instance(year, "2");
                check = pickerChildren[1].GetAttribute("text");
                if (check != month)
                {
                    ITouchAction tc      = new TouchAction(driver);
                    var          element = driver.FindElements(By.ClassName("android.widget.Button"));
                    string       value   = element[2].GetAttribute("text");
                    string       value2  = element[3].GetAttribute("text");
                    if (value == year)
                    {
                        Thread.Sleep(2000);
                        tc.Press(pickerChildren[1]).Wait(1000).MoveTo(element[3]).Release().Perform();
                    }
                    else if (value2 == year)
                    {
                        Thread.Sleep(2000);
                        tc.Press(pickerChildren[1]).Wait(1000).MoveTo(element[2]).Release().Perform();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #4
0
        public void DeletePost()
        {
            //swipe to profile
            _driver.Swipe(100, _size.Height / 2, _size.Width - 100, _size.Height / 2, 1000);

            var wall = _driver.FindElementByAndroidUIAutomator($"new UiSelector().textContains(\"Wall\")");

            wall.Click();

            var openMenu = new TouchAction(_driver);

            openMenu.Press(_size.Width / 2, 300).Wait(3000).Release().Perform();

            var delete = _driver.FindElementByAndroidUIAutomator($"new UiSelector().textContains(\"Delete\")");

            delete.Click();

            var yes = _driver.FindElementByAndroidUIAutomator($"new UiSelector().textContains(\"Yes\")");

            yes.Click();

            try
            {
                _driver.FindElementByAndroidUIAutomator($"new UiSelector().textContains(\"Cool video\")");
            }
            catch (Exception e)
            {
                Assert.True(true);
                return;
            }

            Assert.True(false);
        }
        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 void SequentalMultiActionTestCase()
        {
            string originalActivity      = driver.CurrentActivity;
            IList <AppiumWebElement> els = driver.FindElementsByClassName("android.widget.TextView");
            MultiAction multiTouch       = new MultiAction(driver);

            TouchAction tap1 = new TouchAction(driver);

            tap1.Press(els[5]).Wait(1500).Release();

            multiTouch.Add(tap1).Add(tap1).Perform();

            Thread.Sleep(2500);
            els = driver.FindElementsByClassName("android.widget.TextView");

            TouchAction tap2 = new TouchAction(driver);

            tap2.Press(els[1]).Wait(1500).Release();

            MultiAction multiTouch2 = new MultiAction(driver);

            multiTouch2.Add(tap2).Add(tap2).Perform();

            Thread.Sleep(2500);
            Assert.AreNotEqual(originalActivity, driver.CurrentActivity);
        }
Пример #7
0
        public static void MoveFromNotInGroupToGroup(int pickRow, int toGroup, int dropRow)
        {
            try
            {
                AndroidElement dragItem = null;
                AndroidElement dropItem = null;
                //get drag item
                var root      = Appium.Instance.Driver.FindElementById("groups_grid");
                var groupList = root.FindElementsById("table");
                dropItem =
                    (AndroidElement)groupList[toGroup].FindElementsByClassName("android.widget.TableRow")[dropRow];
                //get drop item
                dragItem = (AndroidElement)NotInGroupList.GetInternalElement().FindElementsById("row_layout")[pickRow];
                //drag n drop
                TouchAction action = new TouchAction(Appium.Instance.Driver);
                action.Press(dragItem).Wait(1500).MoveTo(dragItem).MoveTo(dropItem).Release().Perform();

                ConsoleMessage.Pass(
                    String.Format(
                        "{0}. Take row at position: {1} from group not in group and drop to group at position: {2} at row: {3}",
                        ActivityName, pickRow, toGroup, dropRow));
            }
            catch (Exception ex)
            {
                ConsoleMessage.Fail(
                    String.Format(
                        String.Format(
                            "{0}. Can't take row at position: {1} from group not in group and drop to group at position: {2} at row: {3}",
                            ActivityName, pickRow, toGroup, dropRow)), ex);
                throw;
            }
        }
Пример #8
0
        public void Click(Point point)
        {
            TouchAction action = new TouchAction(Driver);

            action.Press(point.X, point.Y).Release();
            action.Perform();
        }
Пример #9
0
        public void SwipeDisplayElements(Point fromPoint,
                                         Point toPoint,
                                         int duration,
                                         int waitingInterval,
                                         PageCustomProcess processPageFunction)
        {
            List <AndroidElement> allElements    = new List <AndroidElement>();
            List <string>         allElementKeys = new List <string>();
            int pageIndex = 0;

            while (1 == 1)
            {
                Thread.Sleep(waitingInterval);
                bool goon = processPageFunction(pageIndex);
                if (goon)
                {
                    try
                    {
                        TouchAction action = new TouchAction(Driver);
                        action.Press(fromPoint.X, fromPoint.Y).Wait(duration).MoveTo(toPoint.X, toPoint.Y).Release();
                        action.Perform();
                    }
                    catch (Exception ex)
                    {
                        //此处经常运行出错,但是实际操作并没出现什么异常,比较奇怪
                    }
                }
                else
                {
                    break;
                }
                pageIndex++;
            }
        }
        public void DragAndDrop(string StartId, params string[] arguments)
        {
            try
            {
                IWebElement startElement = GetElement(StartId);
                if (arguments != null && 1 == arguments.Length)
                {
                    IWebElement endElement = GetElement(arguments[0]);

                    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();
                }
                else
                {
                    double      xOffset = double.Parse(arguments[0]);
                    double      yOffset = double.Parse(arguments[1]);
                    TouchAction action  = new TouchAction(_driver);
                    action.Press(startElement).MoveTo(startElement, xOffset, yOffset).Perform();
                }
            }
            catch
            {
                if (arguments.Contains("-i"))
                {
                    return;
                }
                throw;
            }
        }
Пример #11
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability(MobileCapabilityType.BrowserName, "");
            capabilities.SetCapability(MobileCapabilityType.PlatformName, App.AndroidDeviceName());
            capabilities.SetCapability(MobileCapabilityType.PlatformVersion, App.AndroidPlatformVersion());
            capabilities.SetCapability(MobileCapabilityType.AutomationName, "UIAutomator2");
            capabilities.SetCapability(MobileCapabilityType.DeviceName, "Nokia");
            capabilities.SetCapability(MobileCapabilityType.App, App.AndroidApp());

            driver = new AndroidDriver <AndroidElement>(Env.ServerUri(), capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;
            wait = new WebDriverWait(driver, Env.IMPLICIT_TIMEOUT_SEC);

            AndroidElement menuButton = driver.FindElementById("com.alibaba.aliexpresshd:id/left_action");

            menuButton.Click();

            AndroidElement authorizationMenuButton = driver.FindElementById("com.alibaba.aliexpresshd:id/chosen_account_content_view");

            authorizationMenuButton.Click();

            AndroidElement loginMenuButton = driver.FindElementById("com.alibaba.aliexpresshd:id/btn_sign_in");

            loginMenuButton.Click();

            AndroidElement list   = driver.FindElementById("android:id/autofill_dataset_list");
            TouchAction    action = new TouchAction(driver);

            action.Press(300, 100).Release().Perform();
        }
Пример #12
0
        public void MultiActionTestCase()
        {
            IOSDriver <IWebElement> driver  = new IOSDriver <IWebElement>(defaultUri, capabilities);
            RequestProcessor        re      = setupMultiAction();
            IWebElement             element = driver.FindElementByIosUIAutomation(".elements()");

            MultiAction m = new MultiAction(driver);

            m.Perform();
            Assert.AreEqual(re.inputData, "");

            TouchAction a1 = new TouchAction(driver);

            a1
            .Press(element, 100, 100)
            .Wait(1000)
            .Release();
            m.Add(a1);
            m.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[[{\"action\":\"press\",\"options\":{\"element\":\"5\",\"x\":100,\"y\":100}},{\"action\":\"wait\",\"options\":{\"ms\":1000}},{\"action\":\"release\"}]]}");

            TouchAction a2 = new TouchAction(driver);

            a2
            .Tap(100, 100)
            .MoveTo(element);
            m.Add(a2);
            m.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[[{\"action\":\"press\",\"options\":{\"element\":\"5\",\"x\":100,\"y\":100}},{\"action\":\"wait\",\"options\":{\"ms\":1000}},{\"action\":\"release\"}],[{\"action\":\"tap\",\"options\":{\"x\":100,\"y\":100}},{\"action\":\"moveTo\",\"options\":{\"element\":\"5\"}}]]}");
        }
        public void MakePayment()
        {
            androidDataSetList = _commonFunctions.ReadAndroidDataList();

            phone.SendKeys(androidDataSetList[1][9]);
            name.SendKeys(androidDataSetList[1][10]);

            //Get start point of seekbar.
            double startX = amountSeekBar.Location.X;

            Console.WriteLine(startX);

            //Get end point of seekbar.
            double endX = amountSeekBar.Size.Width;

            Console.WriteLine(endX);

            //Get vertical location of seekbar.
            double yAxis = amountSeekBar.Location.Y;

            //Set sllebar move to position.
            //endX * 0.1 means at 10% of seek bar width.
            double moveToXDirectionAt = endX * 0.61;

            //TouchAction act = new TouchAction(AndroidTestInitialiser.driver);
            _act.Press(startX, yAxis).MoveTo(moveToXDirectionAt, yAxis).Release().Perform();

            selectCountryButton.Click();
            selectedCountry.Click();
            sendPaymentButton.Click();
            confirmPaymentButton.Click();
        }
        //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;
            }
        }
        public static void TouchActions(int scrollX, int scrollY)
        //TouchActions(int scrollX, int scrollY)
        {
            TouchAction touchAction4 = new TouchAction(AppiumDriver.Instance);

            touchAction4.Press(0, 900).MoveTo(scrollX, scrollY).Release();
            AppiumDriver.Instance.PerformTouchAction(touchAction4);
        }
Пример #16
0
        public void SimpleActionTestCase()
        {
            IWebElement  el     = driver.FindElementByAccessibilityId("ComputeSumButton");
            ITouchAction action = new TouchAction(driver);

            action.Press(el, 10, 10).Release();
            action.Perform();
        }
Пример #17
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();
        }
Пример #18
0
        /// <summary>
        /// Swipes "up" the given number of pixels.
        /// </summary>
        /// <param name="pixels">The number of pixels to swipe "Up".</param>
        /// <param name="duration">The time (in miliseconds) to take performing the action.</param>
        /// <param name="swipes">The number of times to perform the action.</param>
        public static void SwipeUp(int pixels, int duration = 1000, int swipes = 1)
        {
            // Log Before Action
            Log.BeforeAction(new OrderedDictionary()
            {
                { "Pixels", pixels },
                { "Duration", duration },
                { "Swipes", swipes }
            });

            // Perform the action
            try
            {
                // Get the window's size
                Size windowSize = Driver.Manage().Window.Size;
                // Find the center X coordinate of the window
                int windowCenterX = windowSize.Width / 2;
                // Find the center Y coordinate of the window
                int windowCenterY = windowSize.Height / 2;
                // Account for the OS platform
                if (ConfigurationManager.AppSettings["platformName"] == "iOS")
                {
                    pixels = pixels * -1;
                }
                // Perform the swipe the given number of times
                for (int i = 0; i < swipes; i++)
                {
                    // Perform the action
                    TouchAction touchAction = new TouchAction(Driver);
                    touchAction.Press(windowCenterX, windowCenterY).Wait(duration).MoveTo(windowCenterX, pixels).Release().Perform();

                    // Wait a moment
                    System.Threading.Thread.Sleep(500);
                }
                // Logging - After action success
                Log.Success();
            }
            catch (Exception e)
            {
                // Logging - After action exception
                Log.Failure(e.Message);
                // Fail current test
                Assert.Fail(e.Message
                            + Environment.NewLine
                            + "Pixels : " + pixels
                            + Environment.NewLine
                            + "Duration : " + duration
                            + Environment.NewLine
                            + "Swipes : " + swipes
                            );
            }
            finally
            {
                // Logging - After action
                Log.Finally();
            }
        }
        protected void DoSwipe(int startx, int starty, int endx, int endy, int duration)
        {
            TouchAction touchAction = new TouchAction(this);

            // appium converts Press-wait-MoveTo-Release to a swipe action
            touchAction.Press(startx, starty).Wait(duration)
            .MoveTo(endx, endy).Release();

            touchAction.Perform();
        }
        public static void PullDown(this AppiumDriver <AppiumWebElement> driver)
        {
            var touch = new TouchAction(driver);

            touch.Press(500, 1000)
            .Wait(500)
            .MoveTo(500, 1500)
            .Release()
            .Perform();
        }
Пример #21
0
        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);
        }
        public void Swipe(IPerformsTouchActions touchActionsPerformer, int startx, int starty, int endx, int endy, int duration)
        {
            TouchAction touchAction = new TouchAction(touchActionsPerformer);

            // appium converts Press-wait-MoveTo-Release to a swipe action
            touchAction.Press(startx, starty).Wait(duration)
            .MoveTo(endx, endy).Release();

            touchAction.Perform();
        }
Пример #23
0
        public void HabilitaExclusaoAtivosDaPlanilha(AppiumDriver <AndroidElement> driver, IWebElement elemento)
        {
            TouchAction touchAction = new TouchAction(driver);

            touchAction
            .Press(elemento.Location.X + 400, elemento.Location.Y)
            .Wait(2000)
            .MoveTo(elemento.Location.X, elemento.Location.Y)
            .Release()
            .Perform();
        }
Пример #24
0
        //Esse método clica em uma posição de origem da tela e arrasta para a posição destino
        public void LongPressPosicoesFixas(AppiumDriver <AndroidElement> driver, int posicaoOrigemX = 0, int posicaoOrigemY = 0, int posicaoDestinoX = 0, int posicaoDestinoY = 0)
        {
            TouchAction touchAction = new TouchAction(driver);

            touchAction
            .Press(posicaoOrigemX, posicaoOrigemY)
            .Wait(2000)
            .MoveTo(posicaoDestinoX, posicaoDestinoY)
            .Release()
            .Perform();
        }
Пример #25
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, "");
        }
 public static void ScrollByCoOrdinates(int x, int y)
 {
     try
     {
         ts.Press(207, 710).MoveTo(x, y).Release().Perform();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
        public static void MarketActivitySlide(int xPos, int yPos)
        {
            // Using Touch Action Classes
            TouchAction tAction = new TouchAction(AppiumDriver.Instance);

            // perform the swipe
            int moveTo = (int)(xPos + 500);

            tAction.Press(xPos, yPos).MoveTo(moveTo, yPos).Release();
            AppiumDriver.Instance.PerformTouchAction(tAction);
        }
Пример #28
0
        public void HabilitaRenomearExcluirPlanilha(AppiumDriver <AndroidElement> driver, IWebElement elemento)
        {
            TouchAction touchAction = new TouchAction(driver);

            touchAction
            .Press(elemento.Location.X + 300, elemento.Location.Y)
            .Wait(2000)
            .MoveTo(100, elemento.Location.Y)
            .Release()
            .Perform();
        }
Пример #29
0
        private void LongPress(AndroidElement element)
        {
            var topCorner = element.Location;
            var centerX   = topCorner.X + element.Size.Width / 2;
            var centerY   = topCorner.Y + element.Size.Height / 2;

            var touch = new TouchAction(driver);

            touch.Press(centerX, centerY).Wait(2000).MoveTo(centerX, centerY).Release();
            touch.Perform();
        }
        public static void TravelTimeWalkTimePin(int xPos, int yPos)
        {
            // Using Touch Action Classes
            TouchAction tAction = new TouchAction(AppiumDriver.Instance);

            // perform the swipe
            int moveTo = (int)(xPos + 1);

            tAction.Press(xPos, yPos).Wait(1).MoveTo(moveTo, yPos).Release().Perform();
            AppiumDriver.Instance.PerformTouchAction(tAction);
        }