Пример #1
0
        public void cliqueLongo(By by)
        {
            // TouchAction action = new TouchAction(DriverFactory.getDriver());
            //action.Press(DriverFactory.getDriver().FindElement(by)).Release().Perform();

            AppiumWebElement teste = DriverFactory.getDriver().FindElement(by);

            // AppiumWebElement fim = DriverFactory.getDriver().FindElement(By.XPath("//*[@text='" + destino + "']"));

            //var appiumDriver; //you've instantiated it somehow
            if (teste != null)
            {
                new TouchAction(DriverFactory.getDriver())
                .LongPress(teste) //i've tried using coordinates as well
                .Release();       //.Perform();
                Thread.Sleep(2000);
                return;
            }


            // new TouchAction(DriverFactory.getDriver()).LongPress(DriverFactory.getDriver().FindElement(by), 0.5, 0.5 ).Perform();

            /*
             *          new TouchAction(DriverFactory.getDriver())
             *         .Press(DriverFactory.getDriver().FindElement(by))
             *         .Wait(TimeSpan.FromMilliseconds(3000).Milliseconds)
             *         .Release()
             *         .Perform();
             *
             */

            //new TouchAction(getDriver()).longPress(getDriver().FindElement(by)).perform();
            //TouchActions action =
            //               new TouchActions(DriverFactory.getDriver())
            //         .LongPress(DriverFactory.getDriver().FindElement(by)).Release().Perform();

            //          ITouchAction touchAction = new TouchAction(DriverFactory.getDriver())
            //        .LongPress(DriverFactory.getDriver().FindElement(by))
            //.Wait(TimeSpan.FromMilliseconds(2000).Milliseconds)
            //.MoveTo(endX, endY)
            //       .Release();

            //     touchAction.Perform();

            /*
             *          ITouchAction touchAction = new TouchAction(DriverFactory.getDriver())
             * .Press(startX, startY)
             * .Wait(duration)
             * .MoveTo(endX, endY)
             * .Release();
             *
             *          touchAction.Perform();
             */

            // new TouchAction(DriverFactory.getDriver())
            //   .LongPress(DriverFindElement(by))
            // .Perform();
        }
Пример #2
0
        public void swipeElement(AppiumWebElement elemento, double inicio, double fim)
        {
            int y = elemento.Location.Y + (elemento.Size.Height / 2);

            int start_x = (int)(elemento.Size.Width * inicio);
            int end_x   = (int)(elemento.Size.Width * fim);

            new TouchAction(DriverFactory.getDriver())
            .Press(start_x, y)
            .Wait(TimeSpan.FromMilliseconds(500).Milliseconds)
            .MoveTo(end_x, y)
            .Release()
            .Perform();
        }
Пример #3
0
        public void scroll(double inicio, double fim)
        {
            System.Drawing.Size size = DriverFactory.getDriver().Manage().Window.Size;

            int x = size.Width / 2;

            int start_y = (int)(size.Height * inicio);
            int end_y   = (int)(size.Height * fim);

            new TouchAction(DriverFactory.getDriver())
            .Press(x, start_y)
            .Wait(TimeSpan.FromMilliseconds(500).Milliseconds)
            .MoveTo(x, end_y)
            .Release()
            .Perform();
        }
Пример #4
0
        public bool existeElementoPorTexto(String texto)
        {
            IList <AppiumWebElement> elementos = DriverFactory.getDriver().FindElements(By.XPath("//*[@text='" + texto + "']"));

            return(elementos.Count() > 0);


            /*
             * IList<AppiumWebElement> elements = DriverFactory.getDriver().FindElementsByClassName("android.widget.TextView");
             * String[] retorno = new String[elements.Count()];
             *
             * for (int i = 0; i < elements.Count(); i++)
             * {
             *  retorno[i] = elements.ElementAt(i).ToString();
             *  //System.out.print("\""+retorno[i]+"\", ");
             * }
             *
             */


            //return true;
        }
Пример #5
0
 public void tearDown()
 {
     //gerarScreenShot();
     DriverFactory.getDriver().ResetApp();
 }
Пример #6
0
 public void tap(int x, int y)
 {
     new TouchAction(DriverFactory.getDriver()).Tap(x, y).Perform();
 }
Пример #7
0
 public bool isCheckMarcado(By by)
 {
     return(DriverFactory.getDriver().FindElement(by).GetAttribute("checked").Equals("true"));
 }
Пример #8
0
 public void selecionarCombo(By by, String valor)
 {
     DriverFactory.getDriver().FindElement(by).Click();
     clicarTexto(valor);
 }
Пример #9
0
 public void clicar(By by)
 {
     DriverFactory.getDriver().FindElement(by).Click();
 }
Пример #10
0
 public String obterTexto(By by)
 {
     return(DriverFactory.getDriver().FindElement(by).Text);
 }
Пример #11
0
 public void escrever(By by, String texto)
 {
     DriverFactory.getDriver().FindElement(by).SendKeys(texto);
 }