Есть отличная удаленная работа для php+codeception+jenkins+allure+docker спецов. 100% remote! Присоединиться к проекту

Какие capabilities нужно указать для iOS и android для Appium 1.6.3. Appium пишет -> Bad parameters

java
android
ios
appium
Теги: #<Tag:0x00007f7b68f027e8> #<Tag:0x00007f7b68f025e0> #<Tag:0x00007f7b68f02450> #<Tag:0x00007f7b68f02310>

(kooro) #1

Всем привет. Пытаюсь подружить Idea и апиум сервер 1.6.3, но пока безрезультатно. Раньше пользовался Appium GUI и настраивалось легко. Сейчас нужно запускать апиум сервер через маковский терминал и в коде указывать параметры. Если я правильно понял, то после запуска апиум сервера и потом запуска Идеи идея пишет, что не может подключиться и указывает на:

driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

Что можете сказать? Помогите, пожалуйста

Смотрел доклад Dan Cuellar про Appium 1.6 и он писал про эти параметры, но у меня почему то не работает

java client 4.1.2
selenium server 3.3.0
private static AndroidDriver<MobileElement> driver;

public static void main(String[] args) throws MalformedURLException {

File app = new File("/Users/anatoliym/onedrive/builds/myapp.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
сapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "MEIZU MX5");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,"uiautomator2");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.1");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.my.app”); capabilities.setCapability("appActivity", ".HomeScreenActivity");
driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
[Appium] Welcome to Appium v1.6.3
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/anatoliym/onedrive/builds/PressReaderUI-main_hc-5.2.17.0307.apk","appPackage":"com.newspaperdirect.pressreader.android.hc","appActivity":".HomeScreenActivity","platformVersion":"5.1","automationName":"uiautomator2","platformName":"Android","deviceName":"MEIZU MX5"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"app":"/Users/anatoliym/onedrive/builds/myapp.apk","appPackage":"com.my.app","appActivity":".HomeScreenActivity","platformVersion":"5.1","automationName":"uiautomator2","platformName":"Android","deviceName":"MEIZU MX5"},"requiredCapabilities":{}},"alwaysMatch":{"app":"/Users/anatoliym/onedrive/builds/myapp.apk","appPackage":"com.my.app","appActivity":".HomeScreenActivity","platformVersion":"5.1","automationName":"uiautomator2","platformName":"Android","deviceName":"MEIZU MX5"},"firstMatch":[]}
[debug] [MJSONWP] **Bad parameters: BadParametersError: Parameters were incorrect.** We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","capabilities","sessionId","id"]} and you sent ["desiredCapabilities","requiredCapabilities","capabilities","alwaysMatch","firstMatch"]
[HTTP] <-- POST /wd/hub/session 400 10 ms - 243
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=/Users/anatoliym/onedrive/builds/myapp.apk, appPackage=com.my.app, appActivity=.HomeScreenActivity, platformVersion=5.1, automationName=uiautomator2, platformName=Android, deviceName=MEIZU MX5}], required capabilities = Capabilities [{}]
Build info: version: '3.3.0', revision: 'b526bd5', time: '2017-03-07 11:21:31 -0800'
System info: host: 'Azy-mac-mini.local', ip: 'fe80:0:0:0:426c:8fff:fe27:e246%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_91'
Driver info: driver.version: AndroidDriver
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
	at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:36)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:114)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:132)
	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:92)
	at androidTestNewApium.main(androidTestNewApium.java:40)
	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:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Process finished with exit code 1

(Dmitry Andrianov) #2

Присоединяюсь к вопросу, у меня тоже самое. Пишет, что не те capabilities ему шлю


(cactus) #3

Использовать либо java-client версии v5.0.0-BETA6 , либо selenium-server версий ниже 3.3.0


(Dmitry Andrianov) #4

Все верно говоришь.
В общем я поставил appium 1.6.4 beta и понизил версию selenium java до 3.1.0 и всё заработало


(kooro) #5

Спасибо, работает!
java client 4.1.2
selenium server 3.3.0 -> 3.0.1


(Dmitry Andrianov) #6

Вот так будет работать на последних версиях)

        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>5.0.0-BETA6</version>

        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.1</version>