Appium configuration

i am new in appium and i want to connect my sasung galaxy note2 device to my computer(usb) and create tests in visual studio that will run on the device
what i did until now
my operation system window server 2008 r2 64 bit

connect my device to the computer
run appium server
create in visual studio the following class:
public class Class1
{
public AppiumDriver driver;
public DesiredCapabilities capabilities;
public Class1()
{
Console.WriteLine(“Connecting to Appium server”);
capabilities = new DesiredCapabilities();

        capabilities = new DesiredCapabilities();
        capabilities.SetCapability(CapabilityType.BrowserName, "Browser");
        capabilities.SetCapability(CapabilityType.Platform, "Android");
        capabilities.SetCapability(CapabilityType.Version, "4.1.2");
        capabilities.SetCapability("platformName", "Android");

        capabilities.SetCapability("deviceName", "Android");

        capabilities.SetCapability("Device", "Android");

        //Application path and configurations

        driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
    }

i install the eclips with sdk manager and install api above 17 as i looked in the forum
try to debug and got exception in the line “driver = new AppiumDriver(new Uri(“http://127.0.0.1:4723/wd/hub”), capabilities);”
the exception is:Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path."},“sessionId”:null}

i go to system property ->advance ->environment variable
in system variable
i added also to path variable the following path:C:\sdk\android-sdk-windows
i create anew variable : ANDROID_HOME with path : C:\sdk\android-sdk-windows\

and still got the same exception
need your help

1 Like

@erezgi1974
You also need to include the following to your system variables (The path to your build tools and platform tools folders):

C:\ANDROIDSDK\SDK\BUILD-TOOLS
C:\ANDROIDSDK\SDK\PLATFORM-TOOLS

Give it a try and let me know how it works

to the ANDROID_HOME variable??

i try to add this path (in my directory:C:\sdkmanager\adt-bundle-windows-x86_64-20140702\sdk\build-tools;C:\sdkmanager\adt-bundle-windows-x86_64-20140702\sdk\platform-tools)

and i got the same exception

ANDROID_HOME should point to this path I guess:

C:\sdkmanager\adt-bundle-windows-x86_64-20140702\sdk

i did its and still got same exception, maby need to restart computer?

Try doing that and let me know how it works

Hi,

Here the step by step to setup android devices to connect appium:

Android:

Step 1: Download Android SDK Bundle

            Download Link for your reference: http://developer.android.com/sdk/index.html?hl=sk

            Screenshot for your reference:

Step 2:
Once download completed , extract the .rar file and open the folder you can see SDK folder . Copy the path of this SDK folder.
Now, open the environmental variables in the windows properties and create user variables in that environment variables window with the exact name of “ANDROID_HOME” and value textfield you enter the SDK folder path.
Screenshot for your referenece:

            Return back to android sdk bundle folder . Open the sdk folder you can see platform-tools folder and tools folder . Just copy these two folder path and add it in your environmental variables path.

            Screenshot for your referenece:

Step 3:Once setup done for android SDK bundle. Connect your android device.

            Note: Android Composite ADB Interface should be installed otherwise it will not work.
                            
            Screenshot for your reference:
             

            Open the command prompt and type "adb devices" you can see the list of devices attached. If you got any error or did not show the devices list that you may mistake or missed  steps to setup andorid SDK bundle or device.

Step 4:Once android device successfully connected. You can enable the USB debugging mode in the settings of android device.

            Screenshot for your reference:

Step 5:

           Once setup done, Go to  http://appium.io/ url and download the appium latest version and extract the .rar file and then open the appium.exe and then launch the appium server.
            Here the screenshot of appium server for your reference:

Appium capabilities in code:
capabilities.setCapability(“platformName”,platForm);
capabilities.setCapability(“deviceName”,platForm);
capabilities.setCapability(“appPackage”,appPackageName);
capabilities.setCapability(“appActivity”, appActivityName);
driver = new AppiumDriver(new URL(“http://”+ip+":"+portNumber+"/wd/hub"), capabilities);
Test Automation

1 Like

i have samsung galaxy note2 and i connect him to my computer
i Open the command prompt and type “adb devices”
and the list is empty
when i open new emulator via the eclips and avd manager and i again open command prompt and type “adb devices”
i see in the list :
C:\Users\w6-qa>adb devices
List of devices attached
emulator-5554 device

why does i cant see my device that i connect to my computer?

ok i fix this problem (the correct adb for samsung)
i run my code and the device open the browser but after 1 minutes i got exception in the line
driver = new AppiumDriver(new Uri(“http://127.0.0.1:4723/wd/hub”), capabilities);
the exception is : The HTTP request to the remote WebDriver server for URL http://127.0.0.1:4723/wd/hub/session timed out after 60 seconds.

i success to open my chrome browser and make some action like login and cetera

now i try to open anative app(calculator) , i look in some forums and add this code :
apabilities = new DesiredCapabilities();
capabilities.SetCapability(CapabilityType.BrowserName, “Android”);
capabilities.SetCapability(CapabilityType.Version, “4.1.2”);
capabilities.SetCapability(CapabilityType.Platform, “Windows”);
capabilities.SetCapability(“appPackage”, “com.android.calculator2”); // This is package name of your app (you can get it from apk info app)
capabilities.SetCapability(“appActivity”, “com.android.calculator2.Calculator”); // This is Launcher activity of your app (you can get it from apk info app)

        capabilities.SetCapability("platformName", "Android");
        capabilities.SetCapability("deviceName", "Android");
        driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);

and i get exception:
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.) (33)

and in the sdk manager i aleready install api 20
my device is samsung note2

my android version is 4.1.2, and when i go to software update ->update i get message that latest update already installed
any idea or walk around???
and another issue that might help the appium version is 1.2.3.1

If your device has version 4.1.2 you need to use Selendroid backend, by sending the desired capability “automationName” as “selendroid”.

hi , i am trying to lunch Appium , but it wont go trough.
i didnt get your post last part “Appium capabilities in code:
capabilities.setCapability(“platformName”,platForm);
capabilities.setCapability(“deviceName”,platForm);
capabilities.setCapability(“appPackage”,appPackageName);
capabilities.setCapability(“appActivity”, appActivityName);
driver = new AppiumDriver(new URL(“http://”+ip+”:“+portNumber+”/wd/hub"), capabilities);"
do i need to run this command trough command prompt?
or i need to configure those fields under settings menu?
I’ve tried different versions , but all these are just stopping in this log event
"> Checking if an update is available

Update not available
Starting Node Server
info: Welcome to Appium v1.2.4 (REV 71584425ecf777349e3215f0f18e71e7782acfb6)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“app”:“C:\Users\mamo\Desktop\temp\com.bigtincan.android.adfree-8060-v0.8.60.apk”,“address”:“127.0.0.1”,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“16”,“automationName”:“Appium”,“locale”:“US”}
info: Console LogLevel: debug
"

hello,
hello i am running appium on ubuntu 12.0.4. when i start appium server.
i got log like “Appium REST http interface listener started on 0.0.0.0:4723”
so use this address a my url.
after running my test i am getting errors for initatiating appium driver.
here is my code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, “com.ignite.ProjectLogin”);
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY, “.MainActivity”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
capabilities.setCapability(MobileCapabilityType.VERSION, “4.4.4”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “ZX1B33N62X”);
capabilities.setCapability(“browserName”, “android”);
URL serverUrl =new URL(“http://0.0.0.0:4723/wd/hub”);
driver = new AndroidDriver(serverUrl, capabilities);

error i got -
java.lang.ExceptionInInitializerError
at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:62)
at org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:54)
at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:98)
at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:81)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at appium.ignite.com.appiumtestproject.AppiumTest.setup(AppiumTest.java:40)
Guys much need help.
thanks in advance