D
D
Dmitry Azimov2019-01-13 17:07:48
Java
Dmitry Azimov, 2019-01-13 17:07:48

How to fill in DesiredCapabilities and IOSdriver for ios (simulator and real device)?

It will also be good if you share information about what it is desirable to install on mac for comfortable automated api testing.
I am using : eclipse + apppium + selenium
In this piece of code I am trying to run the application on the emulator:

static DesiredCapabilities caps;
    static IOSDriver<MobileElement> driver;
    public static void main(String[] args) {
            caps = new DesiredCapabilities();
            try {
            caps.setCapability("platformName", "IOs");
            caps.setCapability("platformVersion", "12.0");
            caps.setCapability("deviseName", "iPhone X");
            caps.setCapability("app", "/Users/7winds_build/Library/Developer/Xcode/DerivedData/In_Action-crbetcxeffidzvgruuixguhzykma/Build/Products/Debug-iphonesimulator/In Action.app");
            caps.setCapability("noReset", "true");
            }
            catch(Exception e) {
                System.out.println("Ошибка на этапе инициализации");
            }
            try {
                driver = new IOSDriver<> (new URL("http://0.0.0.0:4723/wd/hub"),caps);
                System.out.println("Отправка команд на сервер успешно");
            }
            catch(Exception e) {
                System.out.println("Помоги мне аллах");
            }

        }
    }

Compilation error code:
Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.json.JsonOutput.write(Ljava/lang/Object;)Lorg/openqa/selenium/json/JsonOutput;
    at io.appium.java_client.remote.NewAppiumSessionPayload.writeTo(NewAppiumSessionPayload.java:265)
    at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:175)
    at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
    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:219)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
    at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:95)
    at Default.Test_simulator.main(Test_simulator.java:26)
    Suppressed: java.io.IOException: Incomplete document
        at com.google.gson.stream.JsonWriter.close(JsonWriter.java:559)
        at org.openqa.selenium.json.JsonOutput.close(JsonOutput.java:39)
        at io.appium.java_client.remote.NewAppiumSessionPayload.writeTo(NewAppiumSessionPayload.java:288)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question