gpt4 book ai didi

java - Appium: Exception: Invalid server instance exception has occurred: 没有安装的节点

转载 作者:搜寻专家 更新时间:2023-10-31 20:25:04 24 4
gpt4 key购买 nike

我尝试以编程方式启动 appium 服务器,但遇到错误。如何解决这个问题?我安装了 nodejs 并安装了 appium 并正确设置了 environemnt 变量。我正在使用 maven appium java 客户端 6.1.0 和 selenium 3.14.0。请帮忙。十亿感谢你的帮助。

代码:

try {
File appDir = new File(System.getProperty("user.dir"));
File app = new File(appDir, "..\\apk\\Flipkart.apk");

// apk Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "Sony Xperia Z2");
caps.setCapability("BROWSER_NAME", "Android");
caps.setCapability("platformVersion", "6.0");
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID);
//caps.setCapability("udid", "WUJ01N4RQ3"); // DeviceId from "adb devices" command
caps.setCapability("platformName", "Android");
caps.setCapability("app", app.getAbsolutePath());
caps.setCapability("appPackage", "com.flipkart.android");
caps.setCapability("appActivity","com.flipkart.android.SplashActivity");

// Appium Capabilities
caps.setCapability("skipUnlock","true");
caps.setCapability("noReset","false");

appiumBuilder = new AppiumServiceBuilder();
appiumBuilder.withIPAddress("127.0.0.1");
appiumBuilder.usingPort(47233);
appiumBuilder.withCapabilities(caps);
appiumBuilder.withStartUpTimeOut(3, TimeUnit.MINUTES);
appiumBuilder.withLogFile(new File(System.getProperty("user.dir") + "\\log\\appium.log"));
appiumBuilder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
appiumBuilder.withArgument(GeneralServerFlag.LOG_LEVEL, "DEBUG");
appiumBuilder.withArgument(GeneralServerFlag.ASYNC_TRACE, "true");

appiumServer = AppiumDriverLocalService.buildService(appiumBuilder);
appiumServer.start();
//new URL("http://127.0.0.1:47233/wd/hub")
driver = new AndroidDriver<MobileElement>(appiumServer, caps);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

} catch (Exception ex) {
LogManager.logger.log(Level.INFO, "Exception: " + ex.getMessage());
}

错误日志:

INFO: Exception: Invalid server instance exception has occured: There is no installed nodes! Please install node via NPM (https://www.npmjs.com/package/appium#using-node-js) or download and install Appium app (http://appium.io/downloads.html) Jan 03, 2019 3:52:12 PM com.peterwkc.testManager.AndroidManager tearDown INFO: Exception: null

编辑:我相信 appium 源代码无法检测到我安装的 nodejs 和 appium。

最佳答案

尝试全局安装 Appium。这为我解决了这个问题。

npm install -g appium

关于java - Appium: Exception: Invalid server instance exception has occurred: 没有安装的节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54017732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com