Appium driver on C # error: using generic type Appium.AppiumDriver <W> 'requires 1 type argument
I am using C # for web automation integrated with soucelab and I would also like to use it for mobile web. I am trying to follow some examples from soucelab for appium but give up and go wrong when I try to create AppiumDriver
[TestFixture ()]
public class AndroidWebviewTest
{
private AppiumDriver driver;
private bool allPassed = true;
[TestFixtureSetUp]
public void BeforeAll(){
DesiredCapabilities capabilities = Env.isSauce () ?
Caps.getAndroid18Caps (Apps.get ("selendroidTestApp")) :
Caps.getAndroid19Caps (Apps.get ("selendroidTestApp"));
if (Env.isSauce ()) {
capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
capabilities.SetCapability("name", "android - webview");
capabilities.SetCapability("tags", new string[]{"sample"});
}
Uri serverUri = Env.isSauce () ? AppiumServers.sauceURI : AppiumServers.localURI;
driver = new AndroidDriver(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
and the error:
Error 12 Using the generic type 'OpenQA.Selenium.Appium.Android.AndroidDriver<W>' requires 1 type arguments D:\workspace\appiumDotnet\AppiumDotNetSample\AndroidWebviewTest.cs 32 26 AppiumDotNetSample
Anyone have an idea? Thank!
+3
source to share
1 answer
The test seems to be using an older version of Appium. The error displayed seems to be related to the newer version of the appium dot net network driver. The new version driver is a generic class.
private AppiumDriver driver
it should be
private AppiumDriver<AppiumWebElement> driver
W> is of type IWebElement in class defintion. So it can accept IWebelement or AppiumWebELement
+3
source to share