如何我注入纲领性文本到我的codeD UI测试在Visual Studio(而不是记录的文字)? [英] How to I inject programmatic text into my Coded UI test (as opposed to recorded text) in Visual Studio?

查看:119
本文介绍了如何我注入纲领性文本到我的codeD UI测试在Visual Studio(而不是记录的文字)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刻录机工作正常,快速取得抛出了一些措施,但我需要能够存储并设置任意文本。比方说,我产生了新的管理员用户名为Admin001。我希望能够设置控件的文字是Admin001,没有任何记录,当我第一次使用生成器。

The recorder works fine for quickly getting some steps thrown down, but I need to be able to store and set arbitrary text. Let's say I generated a new admin user called Admin001. I want to be able to set the text for the control to be "Admin001", not whatever was recorded when I first used the builder.

我知道你能做的数据绑定到CSV之类的,但是那也太沉重的负担。我希望能够写C#code要更改的文本键入

I know you can do data bindings to CSV and the like, but that's too burdensome. I want to be able to write C# code to change which text is typed.

截图:

code尝试:

            var loginElement = new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit.Text;

所以我能够得到的财产。文本(我认为),但实际上没有设置...

So I'm able to get the property .Text (I think), but not actually set it...

推荐答案

要设置属性只是做:

new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit.Text = 
"Some Text";

var loginControl = new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit;
loginControl.Text = "Some Text";

这篇关于如何我注入纲领性文本到我的codeD UI测试在Visual Studio(而不是记录的文字)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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