0

I use Appium server running on Mac machine and AppiumDriver with c# bindings to execute tests from Windows machine. The issue is that when I create an instance of AndroidDriver its ctor rises a NullReferenceException. When I create an instance of RemoteWebDriver, it works smoothly. This is my code:

var caps = new DesiredCapabilities();
caps.SetCapability(MobileCapabilityType.DeviceName, "Nexus_4");
caps.SetCapability("udid", "<valid-device-id>");
caps.SetCapability(MobileCapabilityType.App, "https://valid/path/to/my.apk");
caps.SetCapability(MobileCapabilityType.PlatformName, MobilePlatform.Android);

using (var drv = new AndroidDriver(ServerUri, caps)) // rises exception
//using (var drv = new RemoteWebDriver(ServerUri, caps)) // works smoothly
{
    drv.GetScreenshot().SaveAsFile("Android.png", ImageFormat.Png);
}

Exception:

System.NullReferenceException : Object reference not set to an instance of an object.
Result StackTrace:  
at OpenQA.Selenium.Appium.AppiumDriver._AddAppiumCommands()
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Appium.Android.AndroidDriver..ctor(Uri remoteAddress, DesiredCapabilities desiredCapabilities)

Where am I wrong? Why the constructor of AndroidDriver rises this execption and doesn't specify the reason?

al0
  • 374
  • 1
  • 7
  • 20
  • [What is a `NullReferenceException` and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Soner Gönül Jun 18 '15 at 09:12
  • @SonerGönül, AndroidDriver has two parameters, and both of them are not null. Furthermore, RemoteWebDriver accepts the same params and works fine. – al0 Jun 18 '15 at 09:14

1 Answers1

0

The bug resolved in most recent Appium.Webdriver version.

al0
  • 374
  • 1
  • 7
  • 20
  • Hi, currently I am going through same issue and I found this post. I am working on Appium Desktop version and struggling with AppiumDriver. Let me know if it can be resolved – Ashish Jul 31 '18 at 07:42