【问题标题】:Coded UI Test checking for an open Windows Media Player file编码的 UI 测试检查打开的 Windows Media Player 文件
【发布时间】:2013-09-06 20:52:36
【问题描述】:

我正在尝试创建一个编码的 UI 属性来检查打开的 WMP 文件。

   public BrowserWindow VideoWindow
    {
        get
        {
            if (this._videoWindow == null || !this._videoWindow.Exists)
            {
                this._videoWindow = new BrowserWindow();
                this._videoWindow.SearchProperties["Name"] = "Windows Media Player";
                this._videoWindow.SearchProperties["ControlType"] = "Window";
            }

            return this._videoWindow;
        }
    }

显然,这行不通。最初,该应用程序打开了一个视频网站的链接。所以这行得通,但由于它与 BrowserWindow 有很大不同,我不知道该怎么做。如何使用 Coded UI 来“抓取”它?

【问题讨论】:

  • 您是否尝试在 proccess.GetProcessByName 或 GetProccesses 中查找它?

标签: c# testing coded-ui-tests windows-media-player


【解决方案1】:

windows media player 与您一直在处理的视频站点的唯一真正区别是 windows media player 将是 WpfWindow 而不是 BrowserWindow -

public WpfWindow VideoWindow
{
    get
    {
        if (this._videoWindow == null || !this._videoWindow.Exists)
        {
            this._videoWindow = new WpfWindow();
            this._videoWindow.SearchProperties["Name"] = "Windows Media Player";
            this._videoWindow.WindowTitles.Add("Windows Media Player");
        }

        return this._videoWindow;
    }
}

之后,您只需获取媒体播放器窗口内的控件(WpfControls 而不是 HtmlControls)即可确定打开了哪个文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-05
    • 2012-09-18
    相关资源
    最近更新 更多