编码的 UI 错误:以下元素不再可用 [英] Coded UI error: The following element is not longer availabe

查看:14
本文介绍了编码的 UI 错误:以下元素不再可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2010中用CUIT记录了一些测试用例.前一天一切正常.所以,今天我再次运行,所有测试都失败了,警告:以下元素不再可用......我得到了异常:无法在隐藏控件上执行单击",这是不正确的,因为所有控件没有隐藏.我在另一台机器上试过,他们也失败了.

I recorded some test cases with CUIT in VS2010. Everything worked fine the day before. So, today I run again, all the test failed, with the warning: The following element is no longer available ... and I got the exception : Can't perform "Click" on the hidden control, which is not true because all the controls are not hidden. I tried on the other machine, and they failed as well.

有人知道为什么会这样吗?是因为 Web 应用程序有别的原因吗?请帮忙,谢谢.

Does anyone know why it happens? Is it because of the web application for something else? Please help, thanks.

PS:所以我尝试使用与隐藏控件"相同的控件录制新测试,并且新测试有效!?我不明白为什么.

PS: So I tried to record a new test with the same controls that said "hidden controls", and the new test worked!? I don't understand why.

编辑

当我在录制时尝试捕获元素或控件时,会出现警告以下元素等等……".按钮的源代码被称为隐藏"

The warning "The following element blah blah ..." appears when I tried to capture an element or a control while recording. The source code of the button is said 'hidden'

public HtmlImage UIAbmeldenImage
    {
        get
        {
            if ((this.mUIAbmeldenImage == null))
            {
                this.mUIAbmeldenImage = new HtmlImage(this);
                #region Search Criteria
                this.mUIAbmeldenImage.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                this.mUIAbmeldenImage.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                this.mUIAbmeldenImage.SearchProperties[HtmlImage.PropertyNames.Alt] = "abmelden";
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.AbsolutePath] = "/webakte-vnext/content/apps/Ordner/images/logOut.png";
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.Src] = "http://localhost/webakte-vnext/content/apps/Ordner/images/logOut.png";
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.LinkAbsolutePath] = "/webakte-vnext/e.consult.9999/webakte/logout/index";
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.Href] = "http://localhost/webakte-vnext/e.consult.9999/webakte/logout/index";
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.ControlDefinition] = "alt="abmelden" src="http://localhost/web";
                this.mUIAbmeldenImage.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                this.mUIAbmeldenImage.WindowTitles.Add("Akte - Test Akte Coded UI VS2010");
                #endregion
            }
            return this.mUIAbmeldenImage;
        }
    }

推荐答案

虽然我运行的是 Visual Studio 2012,但我觉得奇怪的是我们在同一天开始遇到同样的问题,我看不出 DOM 有什么不同对于我为我的网页进行的编码 UI 测试,但由于某种原因,VS 说控件已隐藏并指定了它正在寻找的元素的正确 ID(我验证了 ID 仍然是同一个).我什至尝试重新录制动作,因为我认为一定有什么改变了,但我得到了同样的错误.

Although I am running Visual Studio 2012, I find it odd that we started experiencing the same problem on the same day, I can not see any difference in the DOM for the Coded UI Tests I have for my web page, but for some reason VS is saying the control is hidden and specifies the correct ID of the element it is looking for (I verified that the ID is still the same one). I even tried to re-record the action, because I assumed that something must have changed, but I get the same error.

既然这听起来像同一个问题,同时发生我认为这可能与某些自动更新有关?这是我目前最好的猜测,我会调查一下,如果我有任何发现,我会更新我的帖子.

Since this sounds like the same problem, occurring at the same time I am thinking this might be related to some automatic update? That's my best guess at the moment, I am going to look into it, I will update my post if I figure anything out.

编辑

我删除了更新 KB2870699,它删除了 IE 中的一些漏洞,这解决了我在测试中遇到的问题.此更新是在 9 月 12 日添加的,因此很合适.希望这对您有所帮助.:)

I removed update KB2870699, which removes some voulnerability in IE, this fixed the problems I was having with my tests. This update was added on the 12. september, so it fits. Hope this helps you. :)

https://connect.microsoft.com/VisualStudio/feedback/details/800953/security-update-kb2870699-for-ie-breaks-existing-coded-ui-tests#tabs

这篇关于编码的 UI 错误:以下元素不再可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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