在Android上启动Appium时出现错误

时间:2019-10-08 03:02:03

标签: java selenium selenium-webdriver appium appium-android

在Android上启动Appium时,出现以下错误:

  

无法创建新的远程会话。请检查服务器日志中是否有   更多细节。原始错误:发生未知的服务器端错误   在处理命令时。原始错误:所需的功能   必须包含app,appPackage或browserName构建信息:   版本:“ 3.141.59”,修订版:“ e82be7d358”,时间:   '2018-11-14T08:25:53'

我的代码:

package SignupUchat;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class Signup_Uchat {

    public static void main(String[] args) throws Exception {
        DesiredCapabilities dc=new DesiredCapabilities();

        dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
        dc.setCapability(MobileCapabilityType.DEVICE_NAME, "HUAWEI");
        dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "8.1.0");
        dc.setCapability("appPakage","com.android.calculator2");
        dc.setCapability("appActivity","com.android.calculator2.Calculator");

        URL url=new URL("http://127.0.0.1:4723/wd/hub");
        AndroidDriver<WebElement> driver=new AndroidDriver<WebElement>(url,dc);
    }
}   

1 个答案:

答案 0 :(得分:1)

这似乎是您的错:

dc.setCapability("appPakage","com.android.calculator2");

它应该:

dc.setCapability("appPackage","com.android.calculator2");

appPackage不是appPakage

Capabilities