Appium + selenium webdriver in windows using c# bindings

Hi, I am currently working as automation test analyst and the company i am working for has asked me to implement Mobile automation. I have heard that appium is nice and free source tool.

But i am struggling to find enough information online on how to setup on appium in windows 8 and writing test scripts in c# on android devices.

If anyone can give me step by step process of how to setup the appium on my machine and any sample code including framework and test scripts in c# is much APPRECIATED.

Thanks in Advance.

There’s plenty of docs on the site: http://developer.android.com/tools/debugging/debugging-ui.html
There are docs there for setting up on windows :smile:

Hi Jonahss,

thanks for the link, that dosen’t really help me. Am looking for a sample project that would help me to setup automation on windows using appium and writing automation scripts in c# and selenium webdriver

Just download Appium from appium.io and extract it in your local drive (C drive recommended with no spaces on folder name).

Download selenium for C# at this link: http://selenium-release.storage.googleapis.com/2.44/selenium-dotnet-2.44.0.zip

Add WebDriver.dll in your references (Much easier if you are using Visual Studio).

Then you can start coding…

Hi Mitsram,

Thanks for the responding and it is quite useful. Is there any sample project to look at?

thanks in advance

Thanks for the link, appreciate it.

I have managed to setup dotnet project and started writing a basic login test for a mobile the app i am testing.

When i viewed in UI Automator View the Username and Password field has same class name

I have managed to type the username but i am struggling to find the exact location of the password field to type the password using “sendkeys”.

I have tried different methods like:
IWebElement element = driver.FindElementByXPath(“”);
element.Click();
element.SendKeys(“password”);
pswrd.SendKeys(“password”);

And
Dictionary<String, Double> coords = new Dictionary<string, double>();
coords.Add(“x”, 35384);
coords.Add(“y”, 785429);
driver.ExecuteScript(“mobile: tap”, coords);

Nothings works for me.

Can any one help me please? Thanks

In my experience, finding element by class is not reliable. You should use resouce-id. But it seems your resource-id is blank. What’s your Android version? Higher version should display resource-id. I have an example for finding by id.Try this:
WebDriver driver = null;
List"<“WebElement”>" elements = driver.findElements(By.id(object id));
elements.get(0).sendKeys(“username”);
elements.get(1).sendKeys(“password”);

That code is in Java. You can easily convert that to C#.

HTH

I am using android 4.4(kitkat) on nexus 7.

can we click on using the co-ordinates that are available in UI Automator viewer?

many thanks

yes.

public void tapScreen(int xCoordinate, int yCoordinate) {
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap"<“String, Integer”>" tapObject = new HashMap"<“String, Integer”>"();
tapObject.put(“x”, xCoordinate);
tapObject.put(“y”, yCoordinate);
js.executeScript(“mobile: tap”, tapObject);
}

ignore the double quote “<” or “>” in the code. it will not display in the post without the double quotes

Thanks mitsram,

You are a star, it worked with your below script. ofcourse i have modified it into c#

List"<“WebElement”>" elements = driver.findElements(By.id(object id));
elements.get(0).sendKeys(“username”);
elements.get(1).sendKeys(“password”);

That code is in Java. You can easily convert that to C#.

HI Kumar_v. Can you send me total details of how to use appium in C#(With installation details).I also want to use this for android application automation in C#.
Anybody else Please help me in this …i want to generation android automation test script using only c#

Please send me tutorial for this in my mail id : [email protected] in advance if anybody can help me.

You will get the solution to your query. Please visit here.

Looking for sample project of appium with framework part to.I have to automate one pp.
ANybody have any sample project or material.Please sample me at [email protected]