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
当我为 android 运行我的 appium 测试时,无法在真实设备上启动应用程序,在 appium 日志中出现代理错误,并且在控制台上出现错误,无法创建新会话。
是否需要任何网络设置如果是请指导需要设置什么样的设置..
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("automationName", "UiAutomator2");
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);
}
}
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'
Appium 服务器日志:
[info] [35m[Appium][39m Welcome to Appium v1.9.1 [info] [35m[Appium][39m Non-default server args: [info] [35m[Appium][39m sessionOverride: true [info] [35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723[info] [35m[HTTP][39m [37m-->[39m
删除或移动 META-INF/ 之外的条目。[调试] [35m [ADB] [39m 警告:META-INF/io.netty.versions.properties 不受签名保护。不会检测到对此 JAR 条目的未经授权的修改。删除或移动 META-INF/ 之外的条目。[调试] [35m[ADB][39m [调试] [35m[ADB][39m 'C:\Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2- server\apks\appium-uiautomator2-server-v1.18.0.apk' 已经签名。[调试] [35m[ADB][39m 检查 C:\Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2 的应用程序证书-server-debug-androidTest.apk [debug] [35m[ADB][39m 开始 'C:\Users\Office\AppData\Local\Android\Sdk\build-tools\28.0.3\apksigner. \Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' 已经签名。[debug] [35m[ADB][39m 获取 io.appium.uiautomator2.server 的安装状态 [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform- tools\adb.exe -P 5037 -s 35924c6f0804 shell pm list packages io.appium.uiautomator2.server'[debug] [35m[ADB][39m App is installed [debug] [35m[ADB][39m Getting package info for 'io.appium.uiautomator2.server' [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 shell dumpsys package io.appium.uiautomator2.server'[debug] [35m[ADB][39m 安装的'io.appium. \Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'和/或'io.appium .uiautomator2.server.test' [warn] [35m[ADB][39m 无法读取 'C:\Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium- 的版本名称uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'和/或'io.appium.uiautomator2.server.test'。假设已经安装了正确的应用程序版本 [debug] [35m[UiAutomator2][39m 等待长达 20000 毫秒,仪器 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' 可用 [debug] [35m[ADB][39m 跑步'C:exe -P 5037 -s 35924c6f0804 shell pm list packages io.appium.settings'[debug] [35m[ADB][39m App is not installed [debug] [35m[ADB][39m App 'C:\Users\Office\ AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk' 未安装。安装 [debug] [35m[ADB][39m Device API level: 27 [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 安装 -g C:\Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk- debug.apk'[debug] [35m[ADB][39m 安装命令标准输出:成功 [debug] [35m[ADB][39m Running 'C: \Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 shell ps'[debug] [35m[ADB][39m Device API level: 27 [debug] [35m[ ADB][39m 运行 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 shell am start -W -n io.appium.settings/.Settings - a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'[debug] [35m[ADB][39m Device API level: 27 [debug] [35m[ADB][39m Running 'C: \Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 shell appops set io.appium.settings android:mock_location allow' [warn] [35m[AndroidDriver][39m setDeviceLanguageCountry需要语言或国家。[警告] [35m [AndroidDriver] [39m 得到语言:'未定义'和国家:'未定义' [调试] [35m[Logcat][39m 开始 logcat 捕获[调试] [35m[AndroidDriver][39m 将解锁帮助应用程序推送到设备... [调试] [35m[ADB][39m 获取 io.appium 的安装状态。解锁 [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 shell pm list packages io.appium.unlock '[debug] [35m[ADB][39m App 未安装 [debug] [35m[ADB][39m App 'C:\Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\ node_modules\appium-unlock\bin\unlock_apk-debug.apk' 未安装。安装 [debug] [35m[ADB][39m Device API level: 27 [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 安装 -g C: \Users\Office\AppData\Local\Temp\com.miui.calculator.apk' '(默认)' 配置的资源[调试] [35m[ADB][39m 运行 'C:\Users\Office\AppData\Local\ Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 push C:\Users\Office\AppData\Local\Temp\com.miui.calculator\strings.json /data/local/tmp'[调试] [35m[UiAutomator2][39m 没有应用功能。假设它已经在设备上 [debug] [35m[ADB][39m Getting install status for com.miui.calculator [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android \Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 shell pm list packages com.miui.calculator'[debug] [35m[ADB][39m App已安装[debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.http://localhost:8200/wd/hub/status] with no body [error] [35m[UiAutomator2][39m [UIAutomator2 Error] getaddrinfo ENOENT localhost localhost:5037 [debug] [35m[UiAutomator2][39m 完全错误:错误:getaddrinfo ENOENT localhost localhost:5037 [debug] [35m[UiAutomator2][39m at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:50:26)[debug] [35m[JSONWP Proxy][39m Matched '/status ' 到命令名称 'getStatus' [debug] [35m[JSONWP Proxy][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[ JSONWP 代理][39m 匹配 '/status' 到命令名称 'getStatus' [调试] [35m[JSONWP 代理][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [调试] [35m [JSONWP 代理] [39m 匹配 '/status' 到命令名称 'getStatus' [调试] [35m [JSONWP 代理] [39m 代理 [GET /status] 到 [GET http://localhost :8200/wd/hub/status] with no body[debug] [35m[JSONWP Proxy][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP Proxy][39m 代理 [GET /status ] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP代理][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status' 到命令名称'获取状态'[调试] [35m [JSONWP 代理] [39m 代理 [GET /status] 到 [GEThttp://localhost:8200/wd/hub/status] with no body[debug] [35m[JSONWP Proxy][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP Proxy][39m代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [调试] [35m [JSONWP 代理] [39m 匹配 '/status' 到命令名称 'getStatus' [调试] [35m[JSONWP 代理][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status ' to command name 'getStatus' [debug] [35m[JSONWP Proxy][39m Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status]没有正文 [调试] [35m [JSONWP 代理] [39m 匹配 '/status' 到命令名称 'getStatus' [调试] [35m [JSONWP 代理] [39m 代理 [GET /status] 到 [GET http://localhost :8200/wd/hub/status] with no body[debug] [35m[JSONWP Proxy][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP Proxy][39m 代理 [GET /status ] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP代理][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status' 到命令名称'获取状态'[调试] [35m [JSONWP 代理] [39m 代理 [GET /status] 到 [GEThttp://localhost:8200/wd/hub/status] with no body[debug] [35m[JSONWP Proxy][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP Proxy][39m代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [调试] [35m [JSONWP 代理] [39m 匹配 '/status' 到命令名称 'getStatus' [调试] [35m[JSONWP 代理][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status ' to command name 'getStatus' [debug] [35m[JSONWP Proxy][39m Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status]没有正文 [调试] [35m [JSONWP 代理] [39m 匹配 '/status' 到命令名称 'getStatus' [调试] [35m [JSONWP 代理] [39m 代理 [GET /status] 到 [GET http://localhost :8200/wd/hub/status] with no body[debug] [35m[JSONWP Proxy][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP Proxy][39m 代理 [GET /status ] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[JSONWP 代理][39m 匹配 '/status' 到命令名称 'getStatus' [debug] [35m[JSONWP代理][39m 代理 [GET /status] 到 [GET http://localhost:8200/wd/hub/status]没有正文 [debug] [35m[UiAutomator2][39m 删除 UiAutomator2 会话 [debug] [35m[UiAutomator2][39m 删除 UiAutomator2 服务器会话 [debug] [35m[JSONWP 代理][39m 匹配 '/' 到命令名称 'deleteSession ' [警告] [35m[UiAutomator2][39m 没有得到确认 UiAutomator2 deleteSession 工作;错误是:UnknownError:处理命令时发生未知的服务器端错误。原始错误:尝试代理没有会话 ID 的会话命令 [debug] [35m[ADB][39m Running 'C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 - s 35924c6f0804 shell am force-stop com.miui.calculator'[debug] [35m[Logcat][39m Stopping logcat capture [debug] [35m[ADB][39m 删除转发端口套接字连接:8200 [debug] [35m[ADB ][39m 跑步 ' C:\Users\Office\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 35924c6f0804 forward --remove tcp:8200' [debug] [35m[BaseDriver][39m Event 'newSessionStarted'记录于 1540389906576(19:35:06 GMT+0530(印度标准时间))[debug] [35m[W3C][39m 运行命令时遇到内部错误:UnknownError:处理命令时发生未知的服务器端错误。原始错误:无法将命令代理到远程服务器。原始错误:错误:getaddrinfo ENOENT localhost localhost:8200 [debug] [35m[W3C][39m at JWProxy.command$ (C:\Users\Office\AppData\Local\Programs\Appium\resources\app\node_modules\appium\ node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:238:13) [debug] [35m[W3C][39m at tryCatch (C:
请指导