Hi,
Thanks for the suggestions but still doesnt work. i look at different tutorials and i used one that has a simple concept so i can make it work first and i realised that I was not using 'TestNG' so i installed that and I run it using TestNG. Here is a new version of the code:
public class androidTest {
WebDriver driver;
@BeforeClass
public void setUp() throws Exception{
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("app-package", "com.appName.shopper");
caps.setCapability("browserName", "Android");
caps.setCapability("platformName", "Android");
caps.setCapability("app-activity", "com.appName.android.ui.LaunchActivity");
// caps.setCapability("takesScreenshot", true);
caps.setCapability("version", "5.0.2");
// caps.setCapability("deviceName","device");
caps.setCapability("deviceName", "BH90KHTBOD");
caps.setCapability("app", "C:\\Program Files\\selenium\\build-tools\`9.1.0\\appName.apk");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
}
@Test
public void testCal() throws Exception {
driver.findElement(By.id("onRegister")).click();
}
@AfterClass
public void teardown(){
driver.quit();
}
}
**this is the error console:
=========================================
[TestNG] Running:
C:\Users\Gaetan\AppData\Local\Temp\testng-eclipse-1969668610\testng-customsuite.xml
FAILED CONFIGURATION: @BeforeClass setUp
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: Exception in thread "main" java.lang.RuntimeException: Unable to rename input apk. C:\Program Files\selenium\build-tools\19.1.0\appName.apk
at s.Sign.sign(Sign.java:421)
at s.Sign.main(Sign.java:532)
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.85 seconds
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:17:10'
System info: host: 'Shopitize001', ip: '192.168.1.155', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_51'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:155)
at appium.androidTest.setUp(androidTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
SKIPPED CONFIGURATION: @AfterClass teardown
SKIPPED: testCal
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================