simond
simond

Reputation: 764

Getting error for appiumDriver initilisation [Using the generic type 'OpenQA.Selenium.Appium.AppiumDriver<W>' requires 1 type arguments]

I am trying below code with AppiumDriver but getting error. I am using beloe code and using appium.dotnet driver version 1.5.1.1

using NUnit.Framework;
using System;
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.Interfaces;
using OpenQA.Selenium.Appium.MultiTouch;
using OpenQA.Selenium.Interactions;



namespace TestAutomation_AppiumFramework
{


    [TestFixture()]
    public class TestAppium
    {
        private AppiumDriver<AppiumWebElement> driver;
        private static Uri testServerAddress = new Uri("http:127.0.01:4723/wd/hub"); // If Appium is running locally
        private static TimeSpan INIT_TIMEOUT_SEC = TimeSpan.FromSeconds(180); /* Change this to a more reasonable value */
        private static TimeSpan IMPLICIT_TIMEOUT_SEC = TimeSpan.FromSeconds(10); /* Change this to a more reasonable value */

        [TestInitialize]
        public void BeforeAll()
        {

            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability("device", "Android");
            capabilities.SetCapability(CapabilityType.Platform, "Windows");
            capabilities.SetCapability("deviceName", "H30-U10");
            capabilities.SetCapability("platformName", "Android");
            capabilities.SetCapability("platformVersion", "4.3");
            capabilities.SetCapability("appPackage", "com.android.calculator2");
            capabilities.SetCapability("appActivity", "com.android.calculator2.Calculator");

            driver = new AppiumDriver(testServerAddress,capabilities, INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitlyWait(IMPLICIT_TIMEOUT_SEC);


        }

Getting error -on this line - driver = new AppiumDriver(testServerAddress,capabilities, INIT_TIMEOUT_SEC);

Saying Using the generic type 'OpenQA.Selenium.Appium.AppiumDriver' requires 1 type arguments]

Upvotes: 0

Views: 1093

Answers (1)

sparrow
sparrow

Reputation: 980

AppiumDriver is an Abstract class. You have to initialize one of the concrete classes such as AndroidDriver or IOSDriver and define the argument type associated with it.

Upvotes: 1

Related Questions