当我在 IntelliJ Idea 中通过testNG
运行我的任何测试时,一切正常。但是如果我想使用maven
命令运行测试,例如mvn clean test
,1)会话重启2-3次。我的意思是“重新安排”
this
2)然后在我第一次尝试使用驱动程序后出现以下错误:
org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)
以下是我的能力
capabilities.setCapability(CapabilityType.DEVICE_NAME.toString(), "Nexus 5");
capabilities.setCapability(CapabilityType.PLATFORM_VERSION.toString(), "8.0.0");
capabilities.setCapability(CapabilityType.PLATFORM_NAME.toString(), "Android");
capabilities.setCapability(CapabilityType.NEW_COMMAND_TIMEOUT.toString(), "1000000");
capabilities.setCapability(CapabilityType.APP.toString(), new File(config.getTestedAppPath()).getAbsolutePath());`
创建Appium驱动程序:
driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);