Appium IOS自动化-Error -Appium:获取错误-selenium.WebDriverException:无法解析远程响应:参数不正确

时间:2017-06-16 01:20:20

标签: ios selenium

我只是尝试使用IOS提供的示例应用程序来设置IOS。

找到我的代码:

package test2;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;


import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;

public class AppiumTestB {

    private AppiumDriver<IOSElement> driver;

    @Test
    public void setup() throws MalformedURLException
    {

        DesiredCapabilities capabilities = new DesiredCapabilities();

           capabilities.setCapability("platformVersion", "9.0");
            capabilities.setCapability("deviceName", "iPhone 6");
            File app =new File("/Users/uwickdi/Desktop/UICatalog.app");
            capabilities.setCapability("app", app.getAbsolutePath());
            driver = new IOSDriver<>(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);

    }

}

我在appium服务器上运行并使用junit运行测试。 请找到错误日志。 我错过了什么?

即时通讯使用客户端驱动程序1.5.3(appium版本) java客户端4.1.2 使用模拟器

org.openqa.selenium.WebDriverException:无法解析远程响应:参数不正确。我们想要{&#34; required&#34;:[&#34; desiredCapabilities&#34;],&#34; optional&#34;:[&#34; requiredCapabilities&#34;,&#34; sessionId&#34; ,&#34; id&#34;]},您发送了[&#34; desiredCapabilities&#34;,&#34; requiredCapabilities&#34;,&#34;功能&#34;] 构建信息:版本:&#39;未知&#39;,修订版:&#39;未知&#39;,时间:&#39;未知&#39; 系统信息:主持人:&#39; SRILAML-N2K0G8W&#39;,ip:&#39; 2402:4000:bbfd:c4b:c4f0:811d:c8a6:2&#39;,os.name:&#39; Mac OS X&#39;,os.arch:&#39; x86_64&#39;,os.version:&#39; 10.12.4&#39;,java.version:&#39; 1.8.0_25&#39; 驱动程序信息:driver.version:IOSDriver     在org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:353)     在org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)     在org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)     在io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)     在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)     在io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)     at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)     在io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)     在org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)     在org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)     在org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:137)     在io.appium.java_client.DefaultGenericMobileDriver。(DefaultGenericMobileDriver.java:36)     在io.appium.java_client.AppiumDriver。(AppiumDriver.java:114)     在io.appium.java_client.AppiumDriver。(AppiumDriver.java:132)     在io.appium.java_client.ios.IOSDriver。(IOSDriver.java:82)     在test2.AppiumTestB.setup(AppiumTestB.java:29)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:483)     在org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:50)     在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)     在org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)     在org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)     在org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)     在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)     在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)     在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290)     在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:71)     在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)     在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:58)     在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268)     在org.junit.runners.ParentRunner.run(ParentRunner.java:363)     在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)     在org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

1 个答案:

答案 0 :(得分:0)

这是我以前在模拟器中运行的代码。

function terminate(arr) {
var args =[];
for(i=1;i<arguments.length;i++){
}


return arr.filter(e => e!=args[0]&& e!=args[1]&&e!=args[2]);
}

terminate([3, 5, 1, 2, 2], 2, 3, 5);

希望这会对你有所帮助。感谢。