I am trying to execute following code
public static void main(String[] args) throws MalformedURLException {
AndroidDriver<AndroidElement> driver=Capabilities();
//xPath id className, androidUIautomator //tagname[@attribute='value']
//Registration of the device
//driver.findElementByXPath("//android.widget.EditText[@resource-id='iMSSO_Alert1_Continue_button']").click();
//driver.findElementByXPath("//android.widget.EditText[@resource-id='btnAgree']").click();
driver.findElementByXPath("//android.widget.EditText[@resource-id='USER']").sendKeys("aris");
driver.findElementByXPath("//android.widget.EditText[@resource-id='PASSWORD']").sendKeys("kKL2WBU7ggCeMh4izUY4Kg==");
driver.findElementByXPath("//android.widget.EditText[@resource-id='btnLogin']").click();
}}
package appiumsample1;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class base1 {
public static AndroidDriver<AndroidElement> Capabilities() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My tab");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
return driver;
/*public static void main(String[] args) {
//Set the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My Phone");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
//Instantiate Appium Driver
try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
} */
// UI Automator tool
}
Exception
remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'TFL0074ALKVTMLM', ip: '10.69.131.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:447:37) at process._tickCallback (internal/process/next_tick.js:68:7) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'TFL0074ALKVTMLM', ip: '10.69.131.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181' Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:323) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:86) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:96) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:94) at appiumsample1.base1.Capabilities(base1.java:25) at appiumsample1.base2.main(base2.java:13) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186) ... 15 more Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'TFL0074ALKVTMLM', ip: '10.69.131.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:447:37) at process._tickCallback (internal/process/next_tick.js:68:7) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62) at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
Added code as per answer
public class base1 {
public AndroidDriver<MobileElement> driver;
public WebDriverWait wait;
public Dimension size;
public String destDir;
public DateFormat dateFormat;
public (swipe) {
};
public (takeScreenShot) {
};
@BeforeMethod
public void setup () throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My tab");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("skipUnlock","true");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"),caps);
wait = new WebDriverWait(driver, 10);
}
@Test
public void test () throws Exception {
//Test commands
}
@AfterMethod
public void teardown(){
driver.quit();
}
/*public AndroidDriver<AndroidElement> Capabilities() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My tab");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("skipUnlock","true");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
return driver;
wait = new WebDriverWait(driver, 10);*/
}