appium / dotnet-client

Extension to the official Selenium dotnet webdriver
Apache License 2.0
381 stars 188 forks source link

AndroidDriver instanciation #498

Closed tbremard closed 2 years ago

tbremard commented 2 years ago

Description

Hello, on net framework 4.8, after having upgraded to the very last versions of packages:

When instanciating the generic class: AndroidDriver

with the code:

            Driver = new AndroidDriver<IWebElement>(new Uri(appiumnode), capabilities);
            Driver = new AndroidDriver<AndroidElement>(new Uri(appiumnode), capabilities);

Visual studio 2019 indicates:

Severity Code Description Project File Line Suppression State Priority Error CS7069 Reference to type 'ICommandExecutor' claims it is defined in 'WebDriver', but it could not be found WebSelenium C:\Work\AzureRepo\TestAutomationFramework\AutomationLibraryWebSelenium\GeneralSeleniumFunctions.cs 104 Active Normal

as a consequence I cannot instantiate at all AndroidDriver and loses the inheritent functionnality, which is critical

Environment

Code To Reproduce Issue [ Good To Have ]

            var capabilities = new AppiumOptions();
            if (parameterList.ContainsKey(ParameterElements.installfile))
                capabilities.AddAdditionalOption("app", parameterList[ParameterElements.installfile]);
            capabilities.AddAdditionalOption("deviceName", device);
            capabilities.AddAdditionalOption("platformName", platform);
            //capabilities.SetCapability(CapabilityType.BrowserName, browsername);
            capabilities.AddAdditionalOption("appPackage", package);
            capabilities.AddAdditionalOption("appActivity", activity);
            Driver = new AndroidDriver<IWebElement>(new Uri(appiumnode), capabilities);
            Driver = new AndroidDriver<AndroidElement>(new Uri(appiumnode), capabilities);
            Driver = new AndroidDriver(uri, appiumOptions, TimeSpan.FromSeconds(waiTimeOut));
Dor-bl commented 2 years ago

Hi, @tbremard did you try using Appium web driver v5.0.0-beta01? It's the only version that currently supports Selenium 4.0 and above.

tbremard commented 2 years ago

Hello @Dor-bl , indeed, because I use:

<package id="Selenium.WebDriver" version="4.2.0" targetFramework="net48" />

I have upgraded from:

<package id="Appium.WebDriver" version="4.3.1" targetFramework="net48" />

to:

<package id="Appium.WebDriver" version="5.0.0-beta01" targetFramework="net48" />

and now this code compiles:

        var capabilities = new AppiumOptions();
        IWebDriver Driver = new AndroidDriver(new Uri(appiumnode), capabilities);

I am not a fan of upgrading to pre release , but because i had no choice and do not want to rollback Selenium version you convinced me gently to do it.