使用Appium selenium工具运行app时,收到错误“org.openqa.selenium.SessionNotCreatedException”

时间:2017-09-15 08:45:21

标签: java selenium-webdriver appium

请帮我这个

public class Test {
    public static void main(String[] args) throws InterruptedException, IOException {
        // TODO Auto-generated method stub
        String Start_Server= "G:\\Appium\\node.exe   G:\\Appium_new\\Appium\\node_modules\\appium\\bin\\appium.js";
        Process process = Runtime.getRuntime().exec(Start_Server);

        if(process!= null)
        {
            System.out.println("Started the Appium Server");
        }
        else
        {
            System.out.println("NOT Started the Server");
        }
        Thread.sleep(12000);
        DesiredCapabilities capablities= new DesiredCapabilities();

                //device details
                capablities.setCapability("deviceName","HKE6J4PS");
                capablities.setCapability("platformName","Android");
                capablities.setCapability("PlatformVersion","6.0");

                //app details
                capablities.setCapability("appPackage","com.test.mobile.apps");
                capablities.setCapability("appActivity","com.test.mobile.apps.ExistingUserDashBoard");

                AndroidDriver driver= new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capablities);

                Thread.sleep(6000);

                driver.findElementById("com.act.mobile.apps:id/action_settings").click();

1 个答案:

答案 0 :(得分:2)

请在command.addArgument(“G:\ Appium_new \ Appium \ node_modules \ appium \ bin \ appium.js”)之后添加下面提到的行;

  

command.addArgument( “ - 会话倍率”);