获取CodedUI中单选框的运行时间值 [英] get run time value for radio box in CodedUI

查看:73
本文介绍了获取CodedUI中单选框的运行时间值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图得到一个"变化的价值"对于网页上的单选按钮,并在我运行测试时使用此值



这是< g class =" gr_ gr_42 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 42'; ID = QUOT; 42';> HTML< / g取代;单选按钮的代码



< input aria-label =" Check Domain< g class =" gr_ gr_55 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 55" ID = QUOT; 55"> Factvlog< / g取代;下午4:40:32"类型= QUOT;无线电"
name =" id []" value =" 17">



the value" 17"这里根据数据库中的新条目进行更改,我知道我可以在搜索属性中设置值,但我不想,我希望测试读取新值并在运行时应用它< g class = " gr_ gr_49 gr-alert
gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 49" id =" 49"> everytime< / g>。



这是UIMap.Designer中单选按钮的行



HtmlRadioButton uIIDRadioButton = this.UIDashboardCommonLookCWindow.UICreateNewTaskCommonLDocument.UIIDRadioButton;



我该怎么做才能做到这一点,我尝试了许多技巧但没有解决方案。



我正在使用visual studio enterprise 2017





解决方案

由于它是编码的UI测试,您可以通过单击单选按钮来更改其值来实现它。


如果你想要的只是它的您可以找到属性"已选择",其中包含两个值"True"或"False":




我可以通过使用简单的代码来获取它的价值下面:

 bool a = UIMap.UIHTMLFormsInternetExpWindow.UIHTMLFormsDocument.UIGenderRadioButton.Selected; 

Console.WriteLine(a);

 


问候,


Fletcher







I am trying to get a "changing value" for a radio button on a webpage and use this value when I run my test

this is the <g class="gr_ gr_42 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="42" id="42">html</g> code for the radio button

<input aria-label="Check Domain <g class="gr_ gr_55 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="55" id="55">Factvlog</g> 4:40:32 PM" type="radio" name="id[]" value="17">

the value "17" here changes according to the new entry in the database, I know I can set the value in the search properties but I do not want to, I want the test to read the new value and apply it when I run it <g class="gr_ gr_49 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="49" id="49">everytime</g>.

Here is the line for the radio button in the UIMap.Designer

HtmlRadioButton uIIDRadioButton = this.UIDashboardCommonLookCWindow.UICreateNewTaskCommonLDocument.UIIDRadioButton;

What should I do to accomplish this, I tried many tricks but no solution.

I am using visual studio enterprise 2017

解决方案

As it's Coded UI test, you could just implement it by clicking the radio button to change its value.

If what you want is just its value, you could find the property "selected" which has two values "True" or "False":

and I could get its value by using simple code like below:

bool a =  UIMap.UIHTMLFormsInternetExpWindow.UIHTMLFormsDocument.UIGenderRadioButton.Selected;

Console.WriteLine(a);

 

Regards,

Fletcher


这篇关于获取CodedUI中单选框的运行时间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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