控制不是VS认为的地方。 [英] Control is not where VS thinks it is.

查看:56
本文介绍了控制不是VS认为的地方。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的编码UI测试在技术上找到了控件,但是当点击发生时,它完全错过了控件。 由于某种原因,系统认为控件是在其他地方。

My coded UI test technically finds the control, but when the click happens, it misses the control entirely.  For some reason, the system thinks the control is someplace else.

与此问题有些相关...当我在同一台PC上运行测试几次并且能够与之交互时控件,当这些控件移动时,系统仍会转到控件所在的最后位置,即使测试代码不使用屏幕位置
来查找控件。 此外,如果我从27英寸的"笔记本电脑"切换到屏幕,测试将无法在笔记本电脑上运行,因为它无法找到任何控件。 如果我在以前的PC上运行,测试将运行正常。

Somewhat related to this issue... When I run a test on the same PC a few times and am able to interact with controls, when those controls move, the system still goes to the last place the control was, even though test code doesn't not use screen location to find controls.  Also, if I switch to a laptop from a 27" screen, the test will not run on the laptop because it can't find any of the controls.  If I run on the previous PC, the test will run fine.

closl

推荐答案

嗨朋友, 

Hi friend, 

如果通过在测试构建器中使用记录生成编码的UI测试,通常会找到控件通过
坐标,这意味着,编码的UI测试构建器会根据您给出的操作记录控件在屏幕上的位置。之后,当它正在播放时,它还会根据录制的位置找到控制权。

If the coded UI test generated by using record in the test builder, normally, the control was found by the coordinate, which means, the coded UI test builder record the control's location on the screen with the action you give. After, when it's playing back it also finds control according to the location that's recorded.

因此,如果想要编码的UI测试成功回放,您需要确保在至少具有相同分辨率和相同大小的屏幕的机器上运行它。 

So, if want to the coded UI test play back successfully, you need make sure you run it on the machine which at least share the same resolution and same size of screen. 

但如果我们使用控制搜索属性,这可以帮助我们精确定位控件(每个控件的搜索属性必须是唯一的),然后我们可以运行编码的UI测试,无论在何处放置控件。

But if we use the control search properties which could help us to target the control precisely(the search property of each control must be unique), then we could run the coded UI test no matter where put the controls.

 

通常,我们首先使用Cross-hair捕获控件,然后添加UIMap,然后我们可以通过手工编码测试方法对其进行一些操作。 

Usually, we make it by using Cross-hair to capture the control first, add it UIMap, then we could do some actions on it by hand coding in test method. 

祝你好运, 

Best regards, 

Fletch

  

  

  

  


这篇关于控制不是VS认为的地方。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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