参数不正确

时间:2019-07-24 19:22:13

标签: java appium-android

谁可以帮助我解决错误,我有一个类可以测试UI(前端),所以我正在使用appium,语言:java和IDE:inelliJ ...

@Before
public void setUp() throws MalformedURLException {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"866225038187890");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"7");
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,"UiAutomator1");
    //capabilities.setCapability();

    File file = new File("/home/haibu/Documentos", "app-debug.apk");
    capabilities.setCapability("app", file.getAbsolutePath());
    System.setProperty("webdriver.gecko.driver", "/home/haibu/Documentos/geckodriver");


    System.out.println("entra");

    AndroidDriver <AndroidElement> driver = new AndroidDriver <AndroidElement>( new URL("http://localhost:4723/wd/hub"),capabilities);

    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    MobileElement siguiente = (MobileElement) driver.findElementsByAccessibilityId("saltar");
    siguiente.click();

}

例外

org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: Unable to parse remote response: 
  Parameters were incorrect. 
  We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id","sessionId","id","sessionId","id","sessionId","id"]} 
  and you sent ["desiredCapabilities","capabilities"] 
  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'haibu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-25-generic', java.version: '1.8.0_212' Driver info: driver.version: AndroidDriver

0 个答案:

没有答案