selenium - Appium- Getting app configuration error while running the code -
failed configuration: @beforetest setup org.openqa.selenium.sessionnotcreatedexception: new session not created. (original error: no app set; either start appium --app or pass in 'app' value in desired capabilities, or set androidpackage launch pre-existing app on device) (warning: server did not provide stacktrace information) command duration or timeout: 98 milliseconds build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52' system info: host: 'god23342', ip: '10.244.46.14', os.name: 'windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_92' driver info: org.openqa.selenium.remote.remotewebdriver @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:423) @ org.openqa.selenium.remote.errorhandler.createthrowable(errorhandler.java:206) @ org.openqa.selenium.remote.errorhandler.throwifresponsefailed(errorhandler.java:158) @ org.openqa.selenium.remote.remotewebdriver.execute(remotewebdriver.java:647) @ org.openqa.selenium.remote.remotewebdriver.startsession(remotewebdriver.java:247) @ org.openqa.selenium.remote.remotewebdriver.(remotewebdriver.java:129) @ org.openqa.selenium.remote.remotewebdriver.(remotewebdriver.java:156) @ android.firsttest.setup(firsttest.java:39) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ org.testng.internal.methodinvocationhelper.invokemethod(methodinvocationhelper.java:85) @ org.testng.internal.invoker.invokeconfigurationmethod(invoker.java:510) @ org.testng.internal.invoker.invokeconfigurations(invoker.java:211) @ org.testng.internal.invoker.invokeconfigurations(invoker.java:138) @ org.testng.testrunner.beforerun(testrunner.java:647) @ org.testng.testrunner.run(testrunner.java:615) @ org.testng.suiterunner.runtest(suiterunner.java:357) @ org.testng.suiterunner.runsequentially(suiterunner.java:352) @ org.testng.suiterunner.privaterun(suiterunner.java:310) @ org.testng.suiterunner.run(suiterunner.java:259) @ org.testng.suiterunnerworker.runsuite(suiterunnerworker.java:52) @ org.testng.suiterunnerworker.run(suiterunnerworker.java:86) @ org.testng.testng.runsuitessequentially(testng.java:1185) @ org.testng.testng.runsuiteslocally(testng.java:1110) @ org.testng.testng.run(testng.java:1018) @ org.testng.remote.remotetestng.run(remotetestng.java:111) @ org.testng.remote.remotetestng.initandrun(remotetestng.java:204) @ org.testng.remote.remotetestng.main(remotetestng.java:175)
package android; import java.net.malformedurlexception; import java.net.url; import java.util.concurrent.timeunit; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.remote.capabilitytype; import org.openqa.selenium.remote.desiredcapabilities; import org.openqa.selenium.remote.remotewebdriver; import org.testng.annotations.aftertest; import org.testng.annotations.beforetest; import org.testng.annotations.test; public class firsttest { webdriver driver; @beforetest public void setup() throws malformedurlexception { desiredcapabilities capabilities = new desiredcapabilities().android(); capabilities.setcapability("no", true); capabilities.setcapability("newcommandtimeout", 100000); capabilities.setcapability("noreset", true); capabilities.setcapability("devicename", "medfield9c8687da"); capabilities.setcapability(capabilitytype.browser_name, ""); capabilities.setcapability(capabilitytype.version, "4.4.4"); capabilities.setcapability("devicename", "venue7 3740 lte"); // capabilities.setcapability("app", application.getabsolutepath()); capabilities.setcapability("norest", true); capabilities.setcapability("platformname", "android"); capabilities.setcapability("appactivity", "com.android.calculator2.calculator"); driver = new remotewebdriver(new url("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlywait(15, timeunit.seconds); } @test public void sum() { driver.findelements(by.xpath("//android.widget.button")).get(0).click(); driver.findelement(by.name("2")).click(); driver.findelement(by.name("+")).click(); driver.findelement(by.name("5")).click(); driver.findelement(by.name("=")).click(); string result = driver.findelement( by.classname("android.widget.edittext")).gettext(); system.out.println("number sum result : " + result); } @aftertest public void end() { driver.quit(); } }