当前位置:   article > 正文

Appium报错:org.openqa.selenium.SessionNotCreatedException: A new session could not be created_org.openqa.selenium.sessionnotcreatedexception: co

org.openqa.selenium.sessionnotcreatedexception: could not start a new sessio


代码:

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

问题:

报错: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");




声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/168459
推荐阅读
相关标签
  

闽ICP备14008679号