Hi All,
When I start Appium server with Application Path, Package, and Launch Activity selected the server starts with my application and I can run my test. When my test is done I quit the driver.
Next I try to run the same test again with the server already running. I have capabilities written in the TestFixtureSetUp (see below). However, I get the following error:
SetUp : System.InvalidOperationException : A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity) (33)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Appium.AppiumDriver…ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at MobileAutomationSample.AndroidSimpleTest.BeforeAll() in AndroidSimpleTest.cs: line 42
=======================================================================
My code:
[TestFixture()]
public class AndroidSimpleTest
{
private AppiumDriver driver;
[TestFixtureSetUp]
public void BeforeAll()
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("appium-version", "1.2.4.1");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("platformVersion", "5.0");
capabilities.SetCapability("deviceName", "emulator-5554");
capabilities.SetCapability("browserName", "");
capabilities.SetCapability("app", "app-debug.apk");
capabilities.SetCapability("appPackage", "com.company.app");
capabilities.SetCapability("appActivity", "com.company.app.MainActivity");
Uri androidUri = new Uri("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver(androidUri, capabilities, TimeSpan.FromSeconds(180));
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
}
[TestFixtureTearDown]
public void AfterAll()
{
driver.Quit();
}