Skip to content

prolificcoder/appium-dotnet-driver

 
 

Repository files navigation

#appium-dotnet-driver

This driver is an extension of the Selenium C# client. It has all the functionalities of the regular driver, but add Appium specific methods on top of this.

Install

NuGet

NuGet Package:

Dependencies:

Downloads

appium-dotnet-driver.tar.gz

Usage

  • You need to add the following namespace line: using OpenQA.Selenium.Appium;.
  • Use the AppiumDriver class to construct the driver. It works the same as the Selenium Webdriver, except that the ports are defaulted to Appium values, and the driver does not know how to start the Appium on its own.
  • To use the Appium methods on Element, you need to cast the object returned by the finder method to AppiumWebElement.
...
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium;

namespace AppiumDriverDemo
{
	[TestFixture ()]
	public class ProgramTest
	{
		private AppiumDriver driver;

		[TestFixtureSetUp]
		public void beforeAll(){
			DesiredCapabilities capabilities = new DesiredCapabilities();

			capabilities.SetCapability("deviceName", "iPhone Retina (4-inch 64-bit)");
			capabilities.SetCapability("platformName", "iOS");
			capabilities.SetCapability("platformVersion", "7.1");
			capabilities.SetCapability("app", "<Path to your app>");
			driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);		
		}

		[TestFixtureTearDown]
		public void afterAll(){
			// shutdown
			driver.Quit();
		}
			
		[Test ()]
		public void AppiumDriverMethodsTestCase ()
		{
			// Using appium extension methods
			AppiumWebElement el = (AppiumWebElement) driver.FindElementByIosUIAutomation(".elements()");
			el.SetImmediateValue ("abc");
			Assert.False (driver.IsAppInstalled("RamdomApp"));
		}
	}

}

Full Project Here

API Doc

TODO: generate API Doc

Dev Build+Test

  • Open with Xamarin
  • Rebuild all
  • Run Unit Tests

Deploy (for maintainers)

Once, if using mono

  • Download Nuget exe.
  • Setup the Api Key (see here).
  • alias NuGet='mono <Nuget Path>/NuGet.exe'

For Nuget:

  • Rebuild All with Release target.
  • Edit the file: appium-dotnet-driver.nuspec. (At least bump version and change release notes.)
  • NuGet pack appium-dotnet-driver.nuspec
  • NuGet push Appium.WebDriver.<version>.nupkg
  • Commit and push changes.

For Downloads:

  • Click on Packages/Linux Binaries in the left handside menu.
  • Commit and push changes.

About

Extension to the official Selenium dotnet webdriver

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%