【发布时间】:2016-10-03 14:02:19
【问题描述】:
我正在尝试运行将 apk 启动到设备中的基本 appium 测试。但我收到错误。我很困惑如何在 Android Studio 中运行 appium 测试。[在此处输入图像描述][1]
环境
Appium version (or git revision) that exhibits the issue:Appium v1.4.16
Last Appium version that did not exhibit the issue (if applicable):NA
Desktop OS/version used to run Appium: Windows 10 64 bit
Node.js version (unless using Appium.app|exe):v4.4.7
Mobile platform/version under test: Android 5.1
Real device or emulator/simulator: Real Device
Appium CLI or Appium.app|exe: Appium.exe
enter image description here enter image description here
[TestNG] 运行:
C:\Users\prabu\AppData\Local\Temp\testng-eclipse--1847523077\testng-customsuite.xml[Utils] 尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\Default 套件\Default test.xml [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\Default 套件存在: 真正失败:开始 org.openqa.selenium.remote.UnreachableBrowserException:不能 开始一个新的会话。可能的原因是远程地址无效 服务器或浏览器启动失败。构建信息:版本:'未知', 修订:'2aa21c1',时间:'2016-08-02 14:59:43 -0700' 系统信息: 主机:'Vaibhav-PC',ip:'192.168.0.114',os.name:'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101' 驱动 信息:driver.version:RemoteWebDriver 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670) 在 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247) 在 org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) 在 org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157) 在 demo.StartAppium.start(StartAppium.java:36) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)在 java.lang.reflect.Method.invoke(未知来源)在 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100) 在 org.testng.internal.Invoker.invokeMethod(Invoker.java:646) 在 org.testng.internal.Invoker.invokeTestMethod(Invoker.java:811) 在 org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1129) 在 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) 在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) 在 org.testng.TestRunner.privateRun(TestRunner.java:746) 在 org.testng.TestRunner.run(TestRunner.java:600) 在 org.testng.SuiteRunner.runTest(SuiteRunner.java:366) 在 org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) 在 org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) 在 org.testng.SuiteRunner.run(SuiteRunner.java:268) 在 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 在 org.testng.TestNG.runSuitesSequentially(TestNG.java:1264) 在 org.testng.TestNG.runSuitesLocally(TestNG.java:1189) 在 org.testng.TestNG.runSuites(TestNG.java:1104) 在 org.testng.TestNG.run(TestNG.java:1076) 在 org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126) 在 org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152) 在 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57) 引起 通过:org.apache.http.conn.HttpHostConnectException:连接到 127.0.0.1:4723 [/127.0.0.1] 失败:连接被拒绝:在 org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect 处连接(DefaultHttpClientConnectionOperator.java:158) 在 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) 在 org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) 在 org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) 在 org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) 在 org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) 在 org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) 在 org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) 在 org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) 在 org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) 在 org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142) 在 org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88) 在 org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:649) ... 29 更多原因:java.net.ConnectException:连接被拒绝: 在 java.net.DualStackPlainSocketImpl.waitForConnect(Native 方法)在 java.net.DualStackPlainSocketImpl.socketConnect(Unknown 来源)在 java.net.AbstractPlainSocketImpl.doConnect(未知来源) 在 java.net.AbstractPlainSocketImpl.connectToAddress(未知来源) 在 java.net.AbstractPlainSocketImpl.connect(Unknown Source) 在 java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) 在 java.net.Socket.connect(Unknown Source) 在 org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74) 在 org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) ... 42 更多
================================================ 默认测试
测试运行:1,失败:1,跳过:0
================================================默认套件总测试运行:1,失败:1,跳过:0
[TestNG] org.testng.reporters.jq.Main@1b0375b3 花费的时间:38 毫秒 [Utils] 尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\testng-failed.xml [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\Default suite\testng-failed.xml [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\Default 套件存在: true [TestNG] [FailedReporter pass=0 failed=0 花费的时间 skipped=0]: 21 ms [TestNG] 所用时间 org.testng.reporters.XMLReporter@48140564:13 毫秒 [Utils] 正在尝试 创造 C:\AndroidDemoworkspace\StartAppium\test-output\junitreports\TEST-demo.StartAppium.xml [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\junitreports 存在: true [TestNG] 所用时间 org.testng.reporters.JUnitReportReporter@3b6eb2ec:12 毫秒 [Utils] 试图创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\toc.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\Default test.properties [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\index.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\main.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\groups.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\classes.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\reporter-output.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\methods-not-run.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default suite\testng.xml.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old\Default 套件 存在:true [Utils] 正在尝试创建 C:\AndroidDemoworkspace\StartAppium\test-output\old\index.html [Utils] 目录 C:\AndroidDemoworkspace\StartAppium\test-output\old 存在: true [TestNG] 所用时间 org.testng.reporters.SuiteHTMLReporter@1134affc:49 毫秒 [TestNG] 时间 由 org.testng.reporters.EmailableReporter2@3ac3fd8b 拍摄:7 毫秒
【问题讨论】:
-
共享您在代码中指定的 DesiredCapibilities
-
由于连接被拒绝错误即将到来,所以我认为所需的功能可能存在问题
-
Appium 现在工作正常...实际上我犯了一些错误,例如添加错误的 jar 文件,错误的环境变量.. 感谢大家回复我。但我想更多地探索它。建议我演示示例