我正在尝试使用以下功能连接到Android模拟器:
public class SimpleAndroidCalcTest {
WebDriver driver;
@Before public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "7.1.1");
capabilities.setCapability("deviceName", "android-7");
capabilities.setCapability("appPackage", "com.android.calculator2");
capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
并继续关注错误参数错误:
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.android.calculator2","appActivity":"com.android.calculator2.Calculator","platformVersion":"7.1.1","platformName":"Android","deviceName":"android-7"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"appPackage":"com.android.calculator2","appActivity":"com.android.calculator2.Calculator","platformVersion":"7.1.1","platformName":"Android","deviceName":"android-7"},"requiredCapabilities":{}},"alwaysMatch":{"appPackage":"com.android.calculator2","appActivity":"com.android.calculator2.Calculator","platformVersion":"7.1.1","platformName":"Android","deviceName":"android-7"},"firstMatch":[]}
[MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","capabilities","sessionId","id"]} and you sent ["desiredCapabilities","requiredCapabilities","capabilities","alwaysMatch","firstMatch"]
[HTTP] <-- POST /wd/hub/session 400 4 ms - 243
我已多次检查输入功能,它们似乎是有效的,据我所知,或者我应该使用其他东西?
Appium服务器:v1.6.4 selenium-java:v3.3.1
答案 0 :(得分:0)
发生此错误是因为您使用的是selenium-java:v3.3.1而没有正确的Appium Java客户端
请参阅:https://github.com/appium/java-client
仅从最新的appium java客户端5.0.0-BETA7中可以使用selenium-java:v3.3.1。
或者您可以将selenium-java恢复为2.53.1