Unable to create AppiumDriver object in C#

I’m writing tests for a Unity app in C# and want to integrate the Appium .NET driver. The AppiumDriver object needs to be instantiated with a parameter, so I’m using the following code:

private static AppiumDriver<AppiumWebElement> appiumDriver;

However, this gives me the following errors:

  • The type 'OpenQA.Selenium.Appium.AppiumWebElement' cannot be used as type parameter 'W' in the generic type or method 'AppiumDriver<W>'. There is no implicit reference conversion from 'OpenQA.Selenium.Appium.AppiumWebElement' to 'OpenQA.Selenium.IWebElement'.

  • The type 'IWebElement' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=3.141.0.0, Culture=neutral, PublicKeyToken=null'.

  • The type 'RemoteWebDriver' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=3.141.0.0, Culture=neutral, PublicKeyToken=null'.

Visual Studio gives me an option to automatically add the reference, but that didn’t make a difference.

Using AppiumDriver<IWebElement> instead gives me this error:

  • The type or namespace name 'IWebElement' could not be found (are you missing a using directive or an assembly reference?)

Any advice would be appreciated.