Это мой класс java, и я попытался запустить Appium с консолью в ubuntu, но он не смог создать новый удаленный сеанс из-за желаемых возможностей (снимок экрана)Невозможно запустить appium в ubuntu для проекта Android в Eclipse
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class FirstTest {
WebDriver driver;
@BeforeClass
public void setUp() throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "SM-G360H");
capabilities.setCapability("version", "4.4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "platform");
capabilities.setCapability("udid", "************");
capabilities.setCapability("appPackage", "com.bulldozer.gaa");
capabilities.setCapability("appActivity", "com.bulldozer.gaa.activities.MainActivity");
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
@Test
public void Test1() throws InterruptedException {
//driver.wait(10000);
System.out.println("GAA");
driver.findElement(By.id("acceptCheckbox")).click();
driver.findElement(By.id("continueBtn")).click();
}
@AfterClass
public void tearDown() {
driver.quit();
}
}
Это код, который я поставил в консоли для запуска Appium на npm. Я использую версию Appium 1.6.3 (последняя).
appium --default-capabilities '{"app":"gaa","appium-version":"1.6.3","platformName":"Android","deviceName":"SM-G360H","nativeInstrumentsLib":true}' --command-timeout "0" --pre-launch
[TestNG] Running:
/tmp/testng-eclipse-1594673304/testng-customsuite.xml
Jan 23, 2017 5:55:43 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Jan 23, 2017 5:55:43 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Jan 23, 2017 5:55:43 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
FAILED CONFIGURATION: @BeforeClass setUp
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{appPackage=com.bulldozer.gaa, appActivity=com.bulldozer.gaa.activities.MainActivity, udid=************}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'tarek-Vostro-3902', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-59-generic', java.version: '1.8.0_91'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
at FirstTest.setUp(FirstTest.java:30)
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 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:140)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1032)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
SKIPPED CONFIGURATION: @AfterClass tearDown
SKIPPED: Test1
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================
[TestNG] Time taken by [email protected]: 6 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 2 ms
[TestNG] Time taken by [email protected]: 8 ms
[TestNG] Time taken by [email protected]: 15 ms
[TestNG] Time taken by [email protected]: 3 ms
[TestNG] Time taken by [email protected]: 3 ms
ok Я попытаюсь изменить это! спасибо за идею – Emna
еще не работает: «org.openqa.selenium.remote.ProtocolHandshake CreateSession INFO: Попытка би-диалекта сессии, предполагая, что закон Постела справедливо на удаленном конце СБОЙ КОНФИГУРАЦИИ: @BeforeClass нАлАдкА org.openqa. selenium.remote.UnreachableBrowserException: Не удалось запустить новый сеанс. Возможными причинами являются неверный адрес удаленного сервера или неудачный запуск браузера. Системная информация: host: 'tarek-Vostro-3902', ip: '127.0.1.1', os.name: 'Linux', Информация о драйвере: driver.version: RemoteWebDriver ' – Emna
hmm .. see my edit? –