Appium报错:org.openqa.selenium.SessionNotCreatedException: A new session could not be created


代码:

public void setUp() throws Exception {  
		DOMConfigurator.configure("log4j.xml");
		DesiredCapabilities capabilities = new DesiredCapabilities();  
		capabilities.setCapability(CapabilityType.BROWSER_NAME, "");  
		capabilities.setCapability("platformName", "Android");  
		//三星Note4
        capabilities.setCapability("deviceName",Constant.DEVICE_ID_SAMSUNG_NOTE4); 
        capabilities.setCapability("platformVersion", "6.0.1");  
        //游戏《极无双-三国无双》
        capabilities.setCapability("appPackage", "com.taiyouxi.qihoo360");  
        capabilities.setCapability("appActivity", "com.taiyouxi.a3k.SplashActivity"); 
        driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    }  

问题:

报错:org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: com.taiyouxi.qihoo360/com.taiyouxi.a3k.SplashActivity never started. Current: com.taiyouxi.qihoo360/com.taiyouxi.a3k.MainActivity) (WARNING: The server did not provide any stacktrace information)

appium控制台日志:

Appium报错:org.openqa.selenium.SessionNotCreatedException: A new session could not be created_第1张图片


分析:

1.看appium 控制台日志信息是一直找不到启动的activity;

2.看客户端脚本日志信息是当前的activity和设置的启动activity不一致;


解决办法:

代码11行和12行之间新增一行代码

capabilities.setCapability("appWaitActivity", "com.taiyouxi.a3k.MainActivity");




你可能感兴趣的:(Appium)