简体   繁体   中英

Appium IOS automation -Error -Appium: Getting error -selenium.WebDriverException: Unable to parse remote response: Parameters were incorrect

I just try to set up IOS with appium with the IOS provided sample application.

Find my code :

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

    }

}

i up the appium server and ran test with junit. Please find the error log. Anything i missed?

im using client driver 1.5.3(appium version ) java client 4.1.2 using simulator

org.openqa.selenium.WebDriverException: Unable to parse remote response: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]} and you sent ["desiredCapabilities","requiredCapabilities","capabilities"] Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: '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 info: driver.version: IOSDriver at 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.execute(RemoteWebDriver.java:637) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40) at io.appiu m.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.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.NativeMethodAccessorImpl.invoke0(Native Method) at 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.Fram eworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at 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: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.JUnit4TestRef erence.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.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)

This is the code that i used to run in Simulator.

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

Hope this helps you. Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM