3

I'm using c# for web automation integrated with soucelab and I would like to use it for mobile web as well. I'm trying to follow some examples from soucelab for appium but is throwing and error once I try to create the 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 is :

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

Has anyone an idea ? Thank you!

teddym6
  • 88
  • 9

1 Answers1

4

The test seems to be using old version of Appium. The error that is displayed, seems to be related to new version of appium dot net driver. The new version driver is a class that takes generic.

private AppiumDriver driver

should be

private AppiumDriver<AppiumWebElement> driver

The < W > is of type of IWebElement in the class defintion. So it can take IWebelement or AppiumWebELement

Shambu
  • 2,612
  • 1
  • 21
  • 16