Table of Contents

Class AndroidDriver

Namespace
OpenQA.Selenium.Android
Assembly
WebDriver.dll

Provides a mechanism to write tests against an Android device

public class AndroidDriver : RemoteWebDriver, IWebDriver, IDisposable, ISearchContext, IJavaScriptExecutor, IFindsById, IFindsByClassName, IFindsByLinkText, IFindsByName, IFindsByTagName, IFindsByXPath, IFindsByPartialLinkText, IFindsByCssSelector, IHasInputDevices, IHasCapabilities, IAllowsFileDetection, ITakesScreenshot, IRotatable, IHasTouchScreen
Inheritance
AndroidDriver
Implements
Inherited Members

Examples

[TestFixture]
public class Testing
{
    private IWebDriver driver;

    [SetUp]
    public void SetUp()
    {
        driver = new AndroidDriver();
    }

    [Test]
    public void TestGoogle()
    {
        driver.Navigate().GoToUrl("http://www.google.co.uk");
        /*
        *   Rest of the test
        */
    }

    [TearDown]
    public void TearDown()
    {
        driver.Quit();
    } 
}

Remarks

Using the Android driver requires the Android device or emulator to be running, and the WebDriver application be active on the device.

Constructors

AndroidDriver()

Initializes a new instance of the AndroidDriver class.

public AndroidDriver()

AndroidDriver(string)

Initializes a new instance of the AndroidDriver class, communicating with the device at a specific URL.

public AndroidDriver(string remoteAddress)

Parameters

remoteAddress string

The URL of the WebDriver application on the Android device.

AndroidDriver(Uri)

Initializes a new instance of the AndroidDriver class, communicating with the device at a specific URL.

public AndroidDriver(Uri remoteAddress)

Parameters

remoteAddress Uri

The URL of the WebDriver application on the Android device.

Properties

Orientation

Gets or sets the screen orientation of the browser on the device.

public ScreenOrientation Orientation { get; set; }

Property Value

ScreenOrientation

TouchScreen

Gets the device representing the touch screen.

public ITouchScreen TouchScreen { get; }

Property Value

ITouchScreen

Methods

GetScreenshot()

Gets a Screenshot object representing the image of the page on the screen.

public Screenshot GetScreenshot()

Returns

Screenshot

A Screenshot object containing the image.