嗨运行下面的脚本显示错误,请提供解决方案,如果您遇到类似的问题: - 脚本: -
package com.appium.android;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
public class LaunchApp {
public static void main(String[] args) throws MalformedURLException{
DesiredCapabilities capabilities=new DesiredCapabilities();
capabilities.setCapability("automationName", "Appium");
capabilities.setCapability("platformName", "Android");
//capabilities.setCapability("platformVersion","4.3");
//capabilities.setCapability("deviceName","GT-I9300");
capabilities.setCapability("platformVersion","5.1");
capabilities.setCapability("devic`enter code here`eName","MotoG");
capabilities.setCapability("app","C:\\Users\\ssin22\\Downloads\\selendroid-test-app-0.17.0.apk");
capabilities.setCapability("appPackage","io.selendroid.testapp");
capabilities.setCapability("appActivity","io.selendroid.testapp.HomeScreenActivity");
AndroidDriver driver=new AndroidDriver(new
URL("http://127.0.0.1:4723/wd/hub"),capabilities); } }
错误
线程“main”中的异常 org.openqa.selenium.SessionNotCreatedException:一个新的会话可以 不被创造。 (原始错误:'java -version'失败。错误: 命令失败:C:\ Windows \ system32 \ cmd.exe / s / c“java -version” 错误:无法打开`C:\ Program Files (x86)\ Java \ jre1.5.0_05 \ lib \ i386 \ jvm.cfg')(警告:服务器没做 不提供任何堆栈跟踪信息)
答案 0 :(得分:0)
检查您的JAVA_HOME
环境变量值,然后重试。如果变量是正确的,它应该可以工作。