在移動應用程序自動化中,Eclipse顯示錯誤「無法創建新的遠程會話」。在移動應用程序自動化中,Eclipse顯示錯誤「無法創建新的遠程會話」。
這裏是我的代碼:
public class MyFirstAppiumClass {
AppiumDriver<WebElement> driver;
@BeforeClass
public void setup() throws MalformedURLException
{
DesiredCapabilities cap = new DesiredCapabilities();
//cap.setCapability("BROWSER_NAME", "Android");
cap.setCapability("platformVersion","6.0.1");
cap.setCapability("deviceName","Nexus 5");
cap.setCapability("platformName","Android");
cap.setCapability("appPackage", "com.android.calculator2");
cap.setCapability("appActivity", "com.android.calculator2.Calculator");
driver = new AndroidDriver<WebElement> (new URL("http://0.0.0.0:4723/wd/hub"),cap);
}
@Test
public void testCal() throws Exception
{
WebElement two = driver.findElement(By.name("4"));
two.click();
WebElement plus = driver.findElement(By.name("+"));
plus.click();
WebElement four = driver.findElement(By.name("4"));
four.click();
WebElement equalto = driver.findElement(By.name("="));
equalto.click();
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
WebElement results = driver.findElement(By.tagName("EditText"));
assert results.getText().equals("8"):"Actual Value is : "+results.getText()+" did not match with expected value: 8";
}
}
這裏是錯誤:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session.
desired capabilities = Capabilities [{appPackage=com.android.calculator2, appActivity=com.android.calculator2.Calculator, platformVersion=6.0.1, platformName=Android, deviceName=Nexus 5}], required capabilities = Capabilities [{}]
您是否在開始運行代碼之前手動啓動appium服務器? – Vinod