不能对隐藏的控制“点击” [英] Cannot perform 'Click' on the hidden control

查看:136
本文介绍了不能对隐藏的控制“点击”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经声明ID文本框,如果索赔id是重复的,声称发现链接下方出现索赔ID文本框。当这条链路上点击它显示现有索赔的细节。我需要测试这个click事件,并弹出窗口。

I've claim Id textbox, if claim id is duplicate,claim found link appears below claim id textbox. When clicked on this link it shows existing claim details. I need to test this click event and popup.

 public HtmlHyperlink UIClaimFoundHyperlink
 {
     get
     {
         if ((this.mClaimFoundHyperlink == null))
         {
             this.mClaimFoundHyperlink = new HtmlHyperlink(this);
             #region Search Criteria
             this.mClaimFoundHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Id] = "aClaimLink";
             this.mClaimFoundHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Name] = null;
             this.mClaimFoundHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Target] = null;
             this.mClaimFoundHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Claim Found";
             this.mClaimFoundHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Title] = null;
             this.mClaimFoundHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Class] = "listTblData-hotlink-noalign";
             #endregion
         }
         return this.mClaimFoundHyperlink;
     }
 }

if (claimFound_Hyperlink.Exists)
{
   Mouse.Click(claimFound_Hyperlink);
}

但它扔
 无法在隐藏的控制进行点击。

我试过现有的解决方案,但不是为我工作。
我可以看到的UI控件。

I tried existing solutions but not working for me. I can see the control on UI.

我看到 ALT ''例外键入'' value属性

- > claimFound_Hyperlink.Alt '扔类型'的异常 System.NotSupportedException

ex--> 'claimFound_Hyperlink.Alt' threw an exception of type 'System.NotSupportedException'

会这样的问题?

请帮忙。

推荐答案

在弹出的窗口第二次发生这种情况。到眼睛的两个窗口是相同的,但它们是不同的。第一次出现的窗口和codeD UI访问它,上面套所示的属性code this.mClaimFoundHyperlink 来引用该窗口。当显示第二次窗口 this.mClaimFoundHyperlink 仍然指向的第一个窗口,它不再可用。因此例外。

This can happen when the window is displayed a second time. To the eye the two windows are the same, but they are different. The first time the window appears and Coded UI accesses it, the property code shown above sets this.mClaimFoundHyperlink to refer to that window. When the window is displayed for a second time this.mClaimFoundHyperlink still refers to the first window, which is no longer available. Hence the exception.

有时刷新属性的作品。尝试调用 this.mClaimFoundHyperlink.Find()

Sometimes refreshing the property works. Try calling this.mClaimFoundHyperlink.Find().

又见<一个href=\"http://stackoverflow.com/questions/20418813/$c$cd-ui-uitestcontrolcollection-using-findmatchingcontrols-is-empty-on-cons/20420311\">this问题有关类似问题。

这篇关于不能对隐藏的控制“点击”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆