无法在Android Real设备上启动应用,Appium服务器自动关闭

时间:2018-10-17 11:01:22

标签: java selenium selenium-webdriver appium appium-android

**Environment** 
- java client build version : 6.1.0 
- Appium server version : 1.7.1 
- Desktop OS/version used to run Appium if necessary: Windows 7 
- Node.js version : 6.4.1 
- Mobile platform/version under test: Android/ 8.1.0 
- Real device or emulator/simulator: Real device 
- Selenium Version: 3.12.0
- TestNg Version : 6.14.3 

在设置以下所需功能后,仍然无法启动应用程序,仍在控制台“线程“ main”中的异常”中收到错误org.openqa.selenium.WebDriverException:无法创建新会话,因为需要使用“ createSession”找不到HttpClient,InputStream和long或无法访问它” 但是由于出现此错误,导致appium服务器自动关闭,因此无法获取appium服务器日志: 我已在执行过程中捕获了appium服务器日志的视频,请查找以下视频的截屏视频:{https://www.screencast.com/t/4f8j8cEveZ

 Code To Reproduce Issue [ Good To Have ] 
public class launchApp {
AndroidDriver<WebElement> driver;

@BeforeClass
public void beforeClass() throws MalformedURLException, InterruptedException {
    DesiredCapabilities capab = new DesiredCapabilities();

    capab.setCapability("deviceName", "Redmi Note 5");
    capab.setCapability("udid", "35924c6f0804");
    capab.setCapability("platformName", "Android");
    capab.setCapability("platformVersion", "8.1.0");
    capab.setCapability("appPackage", "com.miui.calculator");
    capab.setCapability("appActivity", "com.miui.calculator.cal.CalculatorActivity");
    driver = new AndroidDriver<WebElement>(new URL("http://0.0.0.0:4723/wd/hub"), capab);
   
     Thread.sleep(5000);
}

@Test
public void m1() throws InterruptedException {
    System.out.println("kfd");
    Thread.sleep(2000);
   
}
}




Ecxeption stacktraces 
Console Exception:
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'OFFICE-PC', ip: '---.---,---', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_152-release'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
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:548)
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.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
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.android.AndroidDriver.<init>(AndroidDriver.java:93)
at com.example.office.appium_project.launchApp.beforeClass(launchApp.java:38)
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:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648) 

0 个答案:

没有答案