首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Appium IOS自动化-Error -Appium:获取错误-selenium.WebDriverException:无法解析远程响应:参数不正确

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

Stack Overflow用户
提问于 2017-06-16 09:20:20
回答 1查看 600关注 0票数 0

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

查找我的代码:

代码语言:javascript
运行
复制
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运行了测试。请查找错误日志。我错过什么了吗?

im使用客户端驱动程序1.5.3(appium版本) java client 4.1.2使用模拟器

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

EN

Stack Overflow用户

发布于 2017-06-16 09:28:29

这是我用来在模拟器中运行的代码。

代码语言:javascript
运行
复制
    //CONFIGURING DEVICE CAPABILITIES
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME , "XCUITest");
    capabilities.setCapability("platformName",Constant.appPlatform);
    capabilities.setCapability("deviceName",Constant.device);
    capabilities.setCapability("platformVersion", Constant.version);
    capabilities.setCapability("app", app);

     //Initiate Driver
     driver = new IOSDriver(new URL("http://127.0.0.1:4724/wd/hub"), capabilities);

希望这对你有帮助。谢谢。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44579364

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档