编码的用户界面-仅在调试器中停止时** [英] Coded UI - Finds the correct control *only* if I stop in debugger *and* click in source tab before stepping over DrawHighlight()

查看:71
本文介绍了编码的用户界面-仅在调试器中停止时**的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很奇怪.使用VS 2015 Update 2.

This is quite strange. Using VS 2015 update 2.

我使用Test Builder来模拟我在手工编码测试中看到的内容,并且看到的是相同的东西.我需要的控件是HtmlTextArea.录制后,播放失败并显示:此处无法执行'具有值的文本的SetProperty" 我们去...''在控制上. "

I used Test Builder to simulate what I'm seeing in my hand coded tests and I'm seeing the same thing. The control I'm after is an HtmlTextArea. After recording the playback was failing with: "Cannot perform 'SetProperty of Text with value "here we go..."' on the control. "

要调试,我手工编码了一些DrawHighlight()调用,发现它找到了错误的控件.奇怪的是,如果我在DrawHighlight()上设置了一个断点,然后在源代码窗口中单击,那么我可以使其仅在调试模式下工作. 停在Drawhighligt()上.如果我没有在源代码窗口中单击,它将继续查找/突出显示错误的控件.这是非常可重复的.

To debug I hand coded some DrawHighlight() calls and found it was locating the wrong control. The strange thing is that I can get it to work in debug mode *only* if I set a breakpoint on the DrawHighlight(), click in the source code window, and only then stop over the Drawhighligt(). If I don't click in the source window, it will continue to find/highlight the wrong control. This is very repeatable.

HTML< textarea>控件在页面上具有页面唯一ID属性,因此应该不会发生冲突.接下来我可以尝试些什么来帮助解决此问题?谢谢.

The Html <textarea> for the control has a page unique id attribute on the page so there should be no collisions. What might I try next to help resolve this? Thanks.

            UITestControlCollection controls = uIIncDesc4Edit.FindMatchingControls();
            // returns '1'
            int c = controls.Count;
            // with breakpoint on this line and then stepping over -  it highlights 
            // the wrong html control in upper left corner of browser
            uIIncDesc4Edit.DrawHighlight();
            // However, if I click in the source tab before stepping over the second 
            // DrawHighligh() it will highlight the correct control
            // otherwise it will again highlight the same wrong control!!!
            uIIncDesc4Edit.DrawHighlight();
            // Type 'here we go...' in 'incDesc-4' text box
            uIIncDesc4Edit.Text = this.RecordedMethod1Params.UIIncDesc4EditText;

Mark Brodhun

Mark Brodhun

推荐答案

Mark_Brodn

Hi Mark_Brodn,

>>奇怪的是,如果我在DrawHighlight()上设置了一个断点,然后在源代码窗口中单击,然后只能停下来,我就可以使其仅在调试模式下工作. Drawhighligt().如果我没有在源代码窗口中单击,它将继续 查找/突出显示错误的控件.

>>The strange thing is that I can get it to work in debug mode *only* if I set a breakpoint on the DrawHighlight(), click in the source code window, and only then stop over the Drawhighligt(). If I don't click in the source window, it will continue to find/highlight the wrong control.

我想控件没有完全加载,请尝试使用

I suppose that the control is not loaded totally, please try use the WaitForControlEnabled method to wait for a control to be enabled .

根据错误消息,找不到正确的控件.请在控件上拖动十字准线检查其ControlType是否为Edit及其Technology属性.如果是,请为 添加更多唯一属性作为searchproperties HTML< textarea>编码的UI测试编辑器中的控件.

Based on the error message, the correct control is not found. Please drag the crosshair on the control  to check whether its ControlType is Edit and its Technology property . If yes, please add more unique properties as searchproperties for the  Html <textarea> control in Coded UI Test Editor.

是  HTML< textarea>控制第三方控件?

Is the  Html <textarea> control a third-party control?

请尝试使用文本框控件创建一个新的简单项目并进行测试,然后检查结果.确保问题是否与控件本身有关.

Please try to create a new simple project with textbox control and do the test, then check the result. Make sure whether the problem is associated with the control itself.

该链接介绍了如何为WPF自定义控件编写编码的UI扩展.

The link introduce how to write Coded UI extension for WPF custom control.

https://blogs.msdn. microsoft.com/gautamg/2010/03/23/writing-extension-for-wpf-custom-control/

如果这不起作用,您能给我们更多有关您的测试的详细信息吗?

If this does not work, can you give us more details about your test?

最好的问候,
威威

Best Regards,
Weiwei


这篇关于编码的用户界面-仅在调试器中停止时**的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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