D
D
Dmitry Azimov2018-10-12 11:52:19
Java
Dmitry Azimov, 2018-10-12 11:52:19

How or what to parametrize/initialize TouchAction?

Gives an error at the Touch action initialization stage
All code:

package Default;

import java.awt.Desktop.Action;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.touch.TouchActions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;


public class Samsung_A3
{
  static DesiredCapabilities caps;
  static AndroidDriver<MobileElement> driver;
  static WebElement loader;
  static WebElement test;
  //внимание сюда
        static TouchActions action;
  static void check_point() 
  {
    loader = (new WebDriverWait(driver, 10)).until(ExpectedConditions.
        presenceOfElementLocated(By.id("com.kbl.kbl:id/tv_title")));
  }
  static void low_bar() 
  {
    List<MobileElement> HorizontalScrollView = driver.findElements(By.id("com.kbl.kbl:id/sliding_tabs"));
    MobileElement HSV = HorizontalScrollView.get(0);
    List<MobileElement> Iv = HSV.findElements(By.className("android.widget.ImageView"));
    Iv.get(0).click();
  }
  public static void main(String[] args)
  {
    caps = new DesiredCapabilities();
    caps.setCapability("deviceName", "Samsung_A3");
    caps.setCapability("udid", "c2cfde26");
    caps.setCapability("platformName", "Android");
    caps.setCapability("platformVersion", "5.0.2");
    caps.setCapability("appPackage", "com.kbl.kbl");
    caps.setCapability("appActivity", "com.kbl.kbl.gui.splash.SplashActivity");
    caps.setCapability("noReset", "true");
    try 
    {
      driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"),caps);
    }
    catch(Exception e)
    {
      System.out.println("Ошибка отправки команд на сервер");
    }
    try
    {
                        //сюда
      action = new TouchActions(driver);
    }
    catch (Exception e)
    {
      System.out.println("Ошибка инициализации мультитача");
    }
    try 
    {
      check_point();
    }
    catch (Exception  e) 
    {
      System.out.println("Ошибка на чек поинте");
    }
    try 
    {
      List<MobileElement> HorizontalScrollView = driver.findElements(By.id("com.kbl.kbl:id/sliding_tabs"));
      MobileElement HSV = HorizontalScrollView.get(0);
      List<MobileElement> Iv = HSV.findElements(By.className("android.widget.ImageView"));
      Iv.get(0).click();
    }
    catch(Exception e) 
    {
      System.out.println("Скрол юзаем");
    }
    try
    {
      test = driver.findElement(By.id("com.kbl.kbl:id/et_filter"));
      System.out.println("Шаг 1");
    }
    catch(Exception e) 
    {
      System.out.println("Ошибка инициализации");
    }
    try 
    {
      //и сюда
                        action.down(10, 10);
      action.move(50,50);
      action.perform();
    }
    catch(Exception ex) 
    {
      System.out.println("Все хуйня давай по новой");
    }
    
  }

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question