【问题标题】:Appium IOS automation -Error -Appium: Getting error -selenium.WebDriverException: Unable to parse remote response: Parameters were incorrectAppium IOS自动化-错误-Appium:出现错误-selenium.WebDriverException:无法解析远程响应:参数不正确
【发布时间】:2017-11-18 15:32:44
【问题描述】:

我只是尝试使用 IOS 提供的示例应用程序设置带有 appium 的 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:无法解析远程响应:参数不正确。我们想要 {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]} 并且您发送了 ["desiredCapabilities","re​​quiredCapabilities","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' 驱动信息: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) 在 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) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 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)

【问题讨论】:

  • 模拟器还是真机?您还需要在所需功能中提及平台名称。

标签: ios selenium


【解决方案1】:

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

    //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);

希望这对您有所帮助。谢谢。

【讨论】:

    猜你喜欢
    • 2017-09-26
    • 2017-07-15
    • 1970-01-01
    • 2017-10-27
    • 2015-04-23
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 2014-06-05
    相关资源
    最近更新 更多