• 我加进去了,但是运行只能取到一些内容,很多都取不到,不知为何

  • setUp->Test001->Test002,这个次序的方法,把 setUp 改名为 setUpBeforeClass, tearDown 改为 tearDownAfterClass,我试了一下,还是也报同样的错,能否再详细一下,十分感谢啊
    代码部份

    @Before
       public void setUpBeforeClass() throws InterruptedException,MalformedURLException
       {
           File classpathRoot=new File(System.getProperty("user.dir"));
           File appDir = new File(classpathRoot, "apps");
           File app = new File(appDir, "Baidufinance_vh.apk");  
           DesiredCapabilities capabilities = new DesiredCapabilities(); 
           capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); 
           capabilities.setCapability("platformName", "Android");
           capabilities.setCapability("deviceName",udid); 
           capabilities.setCapability(CapabilityType.VERSION, pver);
           capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
           capabilities.setCapability("app", app.getAbsolutePath());
           capabilities.setCapability("appPackage", "com.baidu.finance");
           capabilities.setCapability("appActivity", "com.baidu.finance.ui.SplashActivity"); 
           capabilities.setCapability("unicodeKeyboard", "True"); //for input Chinese 
           capabilities.setCapability("resetKeyboard", "True");
           driver = new AndroidDriver(new URL("http://127.0.0.1:" + port + "/wd/hub"), capabilities);
           Thread.sleep(sleepBase * 10);
       }
     @After
           public void tearDownAfterClass() throws Exception {  
               ExitAppium(); 
           } 
    

    报错信息

    > info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"E:\\workspace\\btest\\apps\\Baidufinance_vh.apk","appPackage":"com.baidu.finance","appActivity":"com.baidu.finance.ui.SplashActivity","browserName":"","unicodeKeyboard":"True","platformName":"Android","deviceName":"5fed5ba","version":"5.0.2LRX22G","platform":"WINDOWS","resetKeyboard":"True"}}
    > info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_40)
    > info: [debug] Error: Requested a new session but one was in progress
    >     at [object Object].Appium.start (D:\appium\node_modules\appium\lib\appium.js:139:15)
    >     at exports.createSession (D:\appium\node_modules\appium\lib\server\controller.js:188:16)
    >     at Layer.handle [as handle_request] (D:\appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:110:13)
    >     at Route.dispatch (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:91:3)
    >     at Layer.handle [as handle_request] (D:\appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
    >     at D:\appium\node_modules\appium\node_modules\express\lib\router\index.js:267:22
    >     at Function.proto.process_params (D:\appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:100:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    >     at next (D:\appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
    > info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Requested a new session but one was in progress)","origValue":"Requested a new session but one was in progress"},"sessionId":"68776510-3354-4e22-847c-8afa9fa7a51a"}
    

    方法二重新启动 Session 试了是可以,但对于我设的想法就是想执完 1,紧接着执行 2,无需重新启动客户端,还是很给力啊,赞成一下

  • 希望能赶上,QQ:303238263

  • #1 楼 @app_testing
    不行呢,这种方法,代码都过不去