CodedUI测试-控件上的Mouse.Click()没有给出预期的结果 [英] CodedUI Test- Mouse.Click() on control dose not give expected outcome

查看:52
本文介绍了CodedUI测试-控件上的Mouse.Click()没有给出预期的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2010创建CodedUI脚本。受测试的应用程序是基于Web的贷款起源应用程序。

I am using Visual studio 2010 to create CodedUI Scripts.The application under Test is a web based Loan origination application .

我正在自动化用户输入zip的部分代码,然后点击搜索。
,当我手动输入邮政编码并单击搜索时,会立即收到响应。

I am automating a part where user enter's zip code and clicks on search. when I enter zip code manually and click on search the response is received instantly.

但是,对代码执行相同的操作后,邮政编码便会成功发送并

But when the same is done with code,Zip code is successfully sent and search button is clicked but application dose not respond.

Mouse.Click(ContactInformation.ContactInformationForm.PropertyAddress.ImageZipLookup);

只想了解这是否是播放问题,是否可以使用mouse.click( )

Just wanted to understand if this is a playback issue and is there a alternative for using mouse.click()

推荐答案

在您的记录中,最有可能是提交按钮的定义不正确。打开.uitest文件,在树中找到有问题的控件,然后在控件的属性中打开SearchProperties。对照页面上的来源验证该信息,然后重试。录音可能会标识一个父HtmlDiv对象或正在接收输入的东西,而不是按钮本身(或链接,如果是这种情况)。

Most likely, the definition for the submit button is incorrect in your recording. Open the .uitest file, find the control in question in the tree, and open the SearchProperties in the properties of the control. Verify that against the source on the page, and then try again. It's possible that the recording identified a parent HtmlDiv object or something that's receiving the input rather than the button itself (or link, if that's the case).

我个人而言,在查看SearchProperties时,我将删除所有不必要的属性。如果所讨论对象有一个ID或唯一类,我会坚持使用它,而不是确定每次运行可能都不正确的其他六个或七个特征(.css样式,内部文本等可能会根据您的应用)。

Personally, while I'm looking at the SearchProperties, I'd remove any properties that are unnecessary. If there's an ID or unique class for the object in question, I'd stick with that alone rather than identifying six or seven other traits that may not be correct on each run (.css styles, inner text, etc. can change depending on your app).

只需确保您在UI中而不是文本编辑器中编辑SearchProperties,因为每次运行Test Builder时都会重新创建.designer.cs文件,因此您将会丢失您直接对该文件所做的任何更改。

Just be sure you edit the SearchProperties in the UI rather than the text editor, as the .designer.cs file is recreated each time you run the Test Builder, so you would lose any changes you make directly to that file.

这篇关于CodedUI测试-控件上的Mouse.Click()没有给出预期的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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