我正在尝试在Android手机上自动化移动网络自动化测试用例,但我收到以下错误: -
org.openqa.selenium.remote.SessionNotFoundException: no such session
(Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.16.0-77-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 12 milliseconds
请参阅以下代码段:
ChromeOptions c=new ChromeOptions();
DesiredCapabilities dc = DesiredCapabilities.chrome();
dc.setCapability("browserName", "chrome");
dc.setCapability("appium-version", "1.6.0");
dc.setCapability("deviceName", "4d00b83ed4f7426f");
dc.setCapability(CapabilityType.VERSION, "5.0.1");
dc.setCapability("platformName", "Android");
dc.setCapability(ChromeOptions.CAPABILITY, c);
dc.setCapability("appPackage", "com.android.chrome");
dc.setCapability("appActivity", "com.google.android.apps.chrome.document.ChromeLauncherActivity");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), dc);
driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
在Appium服务器日志中,我收到以下错误:
[ADB] Error: Unable to get pids for uiautomator. Orginial error: this.shell(...).trim is not a function at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13) at ADB.callee$0$0$ (lib/tools/adb-commands.js:441:9) at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
答案 0 :(得分:0)
通常在以下时出现此错误:
确保打开Appium GUI应用程序,并在执行开始时查看其控制台。您应该看到服务器至少已启动并收到您的请求。从日志中,尝试查看它失败的原因。如果Appium控制台中没有响应,它只是保持不变,这意味着您的配置错误。也许您使用的端口不正确。