【问题标题】:WinAppDriver:-Reference to type 'IFindsByTagName' claims it is defined in 'WebDriver', 'IFindsByClassName' , 'IFindsById' claims it is defined'WinAppDriver:- 对类型 \'IFindsByTagName\' 的引用声称它在 \'WebDriver\'、\'IFindsByClassName\' 中定义,\'IFindsById\' 声称它已定义\'
【发布时间】:2022-08-05 02:32:19
【问题描述】:

1-开发者模式激活 2-正确安装WinApp 3-安装了 Nuget appium 依赖项 4- 微软视觉工作室 2022


使用 OpenQA.Selenium.Appium; 使用 OpenQA.Selenium.Appium.Windows;

namespace WebAppDriverNUNIT
{
    public class Tests
    {
        public const string DriverUrl = \"http://127.0.0.1:4723/\";
        //private const string CalculatorAppId =\"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App\";
        
        [SetUp]
        public void Setup()
        {
            System.Diagnostics.Process.Start(@\"C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe\");
            AppiumOptions Options = new AppiumOptions();
           // Options.AdditionalCapability(\"app\", \"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App\"); // for Universal Windows Platform apps
            Options.AddAdditionalCapability(\"app\", \"C:\\\\Windows\\\\System32\\\\notepad.exe\");
            Options.AddAdditionalCapability(\"deviceName\", \"WindowsPC\");
            Options.SetLoggingPreference(OpenQA.Selenium.LogType.Server, OpenQA.Selenium.LogLevel.All);
            var driver = new WindowsDriver<WindowsElement>(new Uri(DriverUrl), Options);
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
            Assert.IsNotNull(driver);
            Thread.Sleep(2000);
            driver.CloseApp();


        }

        [Test]
        public void Test1()
        {
            Assert.Pass();
        }

    }
}

  • 您使用 WinAppDriver、Appium、Selenium 的 nuget 和版本是什么?

标签: c# selenium appium winappdriver


【解决方案1】:

将(Selenium.WebDriver 和 Selenium.Support)nuget 包降级到 3.141.0 ....您的问题将得到解决。

【讨论】:

  • 如果您确实对此事有了解,请解释一下,以便提问者理解问题,而不仅仅是给出解决方案,这可能适用也可能不适用,具体取决于其他项目在其参考文献中可能会或可能不会更改,还给出了原因不仅仅是一种解决方法,就像在大多数情况下降级一样。
【解决方案2】:

目前,Selenium 4 不支持 WinAppDriver,因为 WinAppDriver 还不符合 W3C。 @pawansinghncr 您应该为所有 Selenium 库安装 Selenium Pre 4.0(例如 3.4 版)。此外,设置适当的 appium nuget。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-23
    • 2018-09-12
    • 2018-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多