Error: Failed to start an Appium session, err was: Error: com.infodat.selltis2/.ValidateLoginSession never started. Current: com.infodat.selltis2/.MainActivity

Hello Everyone,

This is my Script:

package SelltisPak;

import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;

import org.testng.annotations.BeforeTest;

import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;

public class SellticLoginScreen {
DesiredCapabilities dc;
AndroidDriver and;
@Test
public void f() throws Exception {
and=new AndroidDriver(new URL(“http://127.0.0.1:4722/wd/hub”), dc);
and.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
and.findElementByAndroidUIAutomator(“UiSelector().text("Site Address(ex:mysite.selltis.com)")”).sendKeys(“dev.selltis.com”);;
}
@BeforeTest
public void beforeTest() {
dc=new DesiredCapabilities();
dc.setCapability(“deviceName”, “Moto G (2nd Generation)”);
dc.setCapability(“platformVersion”, “6.0”);
dc.setCapability(“platformName”, “Android”);
dc.setCapability(“appPackage”, “com.infodat.selltis2”);
dc.setCapability(“appActivity”, “com.infodat.selltis2.ValidateLoginSession”);

I’m getting below error:
nfo: [debug] Error: com.infodat.selltis2/.ValidateLoginSession never started. Current: com.infodat.selltis2/.MainActivity

at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1314:12)
at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1258:7)
at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: com.infodat.selltis2/.ValidateLoginSession never started. Current: com.infodat.selltis2/.MainActivity)”,“origValue”:“com.infodat.selltis2/.ValidateLoginSession never started. Current: com.infodat.selltis2/.MainActivity”},“sessionId”:null}
error: Failed to start an Appium session, err was: Error: com.infodat.selltis2/.ValidateLoginSession never started. Current: com.infodat.selltis2/.MainActivity
info: ← POST /wd/hub/session 500 43170.964 ms - 324

Here app is launched with the above activity (com.infodat.selltis2.ValidateLoginSession) but it will not continue after app is launched and as it says above error. Can anyone help me ?

It looks like you’re application is designed such that the launch activity is not the same as the main activity your users will see. In this case, you want to add the “appWaitActivity” parameter to your capabilities. You want to set the value for this capability to the full name of the activity (com.infodat.selltis2.MainActivity)

Its working i added dc.setcapability(“appWaitActivity”,"com.infodat.selltis2.MainActivity); parameters after dc.setCapability(“appActivity”, “com.infodat.selltis2.ValidateLoginSession”); …

Thank You Alex…