WebDriverException:无法创建新会话,因为未找到需要HttpClient,InputStream和long的'createSession'

时间:2018-07-30 14:14:15

标签: java appium appium-android

我正在尝试我的第一个appium示例(API演示)

下面是我正在运行的示例代码,

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return self.data.count
  }
  //endregion

  //region cellForItemAt
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let item = self.data[indexPath.item]
    return (self.cv.dequeueReusableCell(
        withReuseIdentifier: reuseIdentifierItem,
        for: indexPath) as! AboutCellItem)
        .setImage(URL(string: item.images?.first?.thumbImageUrl ?? "")!)
        .setTitle(item.aboutTitle ?? "-")

  }
  //endregion

  //region size
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
    if self.data.count == 1 {
      return CGSize(width: self.bounds.width, height: 70)
    } else if self.data.count == 2 {
      return CGSize(width: self.bounds.width / 2, height: 70)
    } else {
      return CGSize(width: ( self.bounds.width / 2.5 ) - Theme.Paddings.mainHorizontal * 1.5 , height: 70)
    }

  }
  //endregion

  //region space
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
    return Theme.Paddings.mainHorizontal
  }

  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
    return Theme.Paddings.mainHorizontal
  }

当我尝试在真实设备上运行以上代码时,我正在跟踪异常。

File f = new File("src");
File fs = new File(f,"ApiDemos-debug.apk");

//Set the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();

caps.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());

caps.setCapability("udid", "712KPYR0867800");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel 2 XL"); 
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");

//Instantiate Appium Driver
try {
    AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);

} catch (MalformedURLException e) {
    System.out.println(e.getMessage());

}

任何帮助表示赞赏。

0 个答案:

没有答案