赞
踩
代码:
- 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控制台日志:
分析:
1.看appium 控制台日志信息是一直找不到启动的activity;
2.看客户端脚本日志信息是当前的activity和设置的启动activity不一致;
解决办法:
代码11行和12行之间新增一行代码
capabilities.setCapability("appWaitActivity", "com.taiyouxi.a3k.MainActivity");
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。