【问题标题】:WinAppDriver: Launching of desktop application was working fine, but of late its having issuesWinAppDriver:桌面应用程序的启动工作正常,但最近出现问题
【发布时间】:2020-02-07 17:56:03
【问题描述】:

当我使用winAppDriver 进行自动化时,桌面应用程序的启动工作正常。 最近我发现这些测试都失败了。

它在这一行失败了,

notepadsession = new WindowsDriver(new Uri("http://127.0.0.1:4723"), desiredcapabilities);

我尝试了两种代码,但仍然失败:

     var currentWindowHandle = notepadsession.CurrentWindowHandle;
        Thread.Sleep(TimeSpan.FromSeconds(5));
        var allWindowHandles = notepadsession.WindowHandles;
        notepadsession.SwitchTo().Window(allWindowHandles[0]);



    if (notepadsession.CurrentWindowHandle != notepadsession.WindowHandles.Last())
        {
            notepadsession.SwitchTo().Window(notepadsession.WindowHandles.Last());
        }

注意:加载桌面应用程序大约需要 40-50 秒。

非常感谢您在这方面的任何帮助。

谢谢

【问题讨论】:

    标签: c# winappdriver


    【解决方案1】:

    下面的代码解决了问题

    notepadsession = new WindowsDriver(new Uri("http://127.0.0.1:4723"), desiredcapabilities);
    
    Thread.Sleep(5000);    
    notepadsession.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
    

    【讨论】:

      猜你喜欢
      • 2021-12-26
      • 1970-01-01
      • 2019-01-21
      • 1970-01-01
      • 1970-01-01
      • 2021-05-15
      • 1970-01-01
      • 2012-01-27
      • 2015-01-02
      相关资源
      最近更新 更多