当编码ui播放期间父级是HtmlCustom控件时,无法找到SilverlightControl

时间:2012-09-19 21:22:44

标签: silverlight automation coded-ui-tests

我正在为WebApp编写CodedUI测试代码。网络应用程序大约50%silverlight。我有一个HtmlCustom控件,可以在网页中搜索我的父对象。然后,它用于为主页面模板创建SilverlightControl。页面模板也具有与之关联的ID。我在Web应用程序的其他区域有这个代码,它工作正常,但由于某种原因它不在这里。

    /// <summary>
    /// Parent of UIControlViewPlaylistsXAP
    /// </summary>
    private HtmlCustom mUICustomViewPlaylistsXAP;
    private HtmlCustom UICustomViewPlaylistsXAP
    {
        get
        {
            if (this.mUICustomViewPlaylistsXAP == null)
            {
                this.mUICustomViewPlaylistsXAP = new HtmlCustom(this);
                this.mUICustomViewPlaylistsXAP.SearchProperties.Add(HtmlCustom.PropertyNames.Id, "viewPlaylistsObject");
                this.mUICustomViewPlaylistsXAP.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "OBJECT");
                this.mUICustomViewPlaylistsXAP.SearchProperties.Add(HtmlCustom.PropertyNames.ControlDefinition, "data=\"data:application/x-oleobject;base64", PropertyExpressionOperator.Contains);
            }
            return this.mUICustomViewPlaylistsXAP;
        }
    }

    /// <summary>
    /// Parent of all direct Page: View Playlists controls
    /// </summary>
    private SilverlightControl mUIControlViewPlaylistsXAP;
    public SilverlightControl UIControlViewPlaylistsXAP
    {
        get
        {
            if (this.mUIControlViewPlaylistsXAP == null)
            {
                this.mUIControlViewPlaylistsXAP = new SilverlightControl(this.UICustomViewPlaylistsXAP);
                this.mUIControlViewPlaylistsXAP.SearchProperties.Add(SilverlightControl.PropertyNames.AutomationId, "VisiconnPageTemplate");
                ////this.mUIControlViewPlaylistsXAP.SearchProperties.Add(SilverlightControl.PropertyNames.MaxDepth, "-1");
                this.mUICustomViewPlaylistsXAP.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                //// this.mUIControlViewPlaylistsXAP.SearchProperties.Add(SilverlightControl.PropertyNames.ControlType, "VisiconnPageTemplate");

             }
            return this.mUIControlViewPlaylistsXAP;
        }
    }

因此mUIControlViewPlaylists.XAP返回UITestControlNotFoundException,它具有与之关联的AutomationId。如果有更好的方法来解决这个问题,或者总的来说问题,那么他们肯定会受到赞赏。

0 个答案:

没有答案