Is it possible to execute Script in Device?

Hi Friends,

Am New to Appium. Executed script in Emulator and now i want to execute the same script through Android Device. Is it possible to run in Device ??

If yes pls explain step by step process.

Thanks in Advance

Hi @Muthu_Pearl ,

When you say you executed a script in the emulator, do you mean you did this through Appium? If so, you just point your appium driver at the device rather than the emulator.

@willosser Answering your question, Ya am run through this Appium and i executed this in Emulator.

    DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "Browser");
        capabilities.setCapability("deviceName", "HT42FWE01991");  ---->HTC Mobile
        capabilities.setCapability("platformVersion", "4.2.2");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage", "");
        capabilities.setCapability("appActivity", "");
        driver = new RemoteWebDriver(new URL(""), capabilities);

This is my code for your reference kindly tell me where to edit/update.

And i got the Error message as like below:

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.64 seconds

Hi Muthu,

The API level of your device is less then 17 So appium will not work as UIAutomator does not support it so some quick solutions are

1 >>> Update Android version on phone to 4.4 /Android KitKAT and then appium will work with u r current capabilities
2 >>> run appium in selendroid mode using additional capability
capabilities.setCapability(“automationName”, “Selendroid”);
But with option 2 inspection will be done through selendroid and not using uiautomatorviewer
for selendroid inspector after running appium server you can use url http://localhost:8080/inspector
as appium run selendroid for API level<17

If it is not requirement of u r prj to check app on device of version less then 17 then its good to take device with kitkat version …

Thanks @amitjaincoer191 now its working. Thanks for this Idea.