Перейти к содержимому

Фотография

Ошибка

appium testing selenium touch

  • Авторизуйтесь для ответа в теме
Сообщений в теме: 4

#1 leraleschenko

leraleschenko

    Новый участник

  • Members
  • Pip
  • 9 сообщений

Отправлено 18 мая 2016 - 08:00

Проверьте пожалуйста тест. Не поддается TouchAction - подчеркивает красным MobileDriver

package com.test;
import com.sun.org.apache.xml.internal.utils.URI;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileDriver;
import io.appium.java_client.android.AndroidDriver;
import org.junit.After;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.internal.TouchAction;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.MalformedInputException;
import java.sql.DriverAction;
import java.util.concurrent.TimeUnit;

public class DragAndDropAction {
    AndroidDriver driver;
    @BeforeTest
    public void setUp() throws MalformedInputException, MalformedURLException {
        File classpathRoot = new File(System.getProperty("user.dir"));
        File appDir=new File (classpathRoot, "/App");
        File app = new File(appDir, "com.mobeta.android.demodslv-0.5.0-3_APKdot.com.apk");
        DesiredCapabilities capabilities=new DesiredCapabilities();
        capabilities.setCapability("deviceName", "GT-S7270");
        capabilities.setCapability("browserName", "Android");
        capabilities.setCapability("platformVersion","4.2.2");
        capabilities.setCapability("platformeName","Android ");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage", "com.mobeta.android.demodslv");
        capabilities.setCapability("appActivity","com.mobeta.android.demodslv.Launcher");

        try {
            driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        }
        catch (MalformedURLException e)
        {
            e.printStackTrace();
        }
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);}

@Test
public void dragDrop() {
        driver.findElementByName("Basic usage playground").click();
        WebElement ele1=(WebElement) driver.findElementsById ("com.mobeta.android.demodslv:id/drag_handle").get(2);
        WebElement ele2=(WebElement) driver.findElementsById("com.mobeta.android.demodslv:id/drag_handle").get(5);
        TouchAction action = new TouchAction((MobileDriver) driver););
        System.out.println("Elements has been at destination successfully");
        }
@AfterTest
public void End(){
        driver.quit();}
        }

  • 0

#2 Little_CJIOH

Little_CJIOH

    Профессионал

  • Members
  • PipPipPipPipPipPip
  • 1 515 сообщений
  • ФИО:Власкин Павел
  • Город:Санкт-Петербург


Отправлено 18 мая 2016 - 08:14

Вопрос дилетанта: TouchAction точно должен импортироваться из селениума а не из аппиума?


  • 0

#3 user12

user12

    Специалист

  • Members
  • PipPipPipPipPip
  • 894 сообщений
  • ФИО:Виктор
  • Город:Минск


Отправлено 18 мая 2016 - 08:15

TouchAction action = new TouchAction((MobileDriver) driver););

 

 

Как минимум не нужна ";"


  • 0

#4 leraleschenko

leraleschenko

    Новый участник

  • Members
  • Pip
  • 9 сообщений

Отправлено 18 мая 2016 - 09:04

Вопрос дилетанта: TouchAction точно должен импортироваться из селениума а не из аппиума

Спасибо исправила)) а что значит?

 java.lang.IndexOutOfBoundsException: Index: 2, Size: 0

at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.test.DragAndDropAction.dragDrop(DragAndDropAction.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:74)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

  • 0

#5 Little_CJIOH

Little_CJIOH

    Профессионал

  • Members
  • PipPipPipPipPipPip
  • 1 515 сообщений
  • ФИО:Власкин Павел
  • Город:Санкт-Петербург


Отправлено 18 мая 2016 - 09:25

java.lang.IndexOutOfBoundsException: Index: 2, Size: 0

где-то попытались взять 3-й (Index: 2) элемент массива имеющего размер 0 (Size: 0)

 

Вероятно тут at com.test.DragAndDropAction.dragDrop(DragAndDropAction.java:55)


  • 0



Темы с аналогичным тегами appium, testing, selenium, touch

Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных