ValidationRuleRequiredAttributeValue.MatchAttributeName 属性
获取或设置其他特性名称,该名称必须能够在包含待验证的特性值的 HTML 标记中找到。 与 MatchAttributeValue 结合使用。
命名空间: Microsoft.VisualStudio.TestTools.WebTesting.Rules
程序集: Microsoft.VisualStudio.QualityTools.WebTestFramework(在 Microsoft.VisualStudio.QualityTools.WebTestFramework.dll 中)
语法
声明
Public Property MatchAttributeName As String
public string MatchAttributeName { get; set; }
public:
property String^ MatchAttributeName {
String^ get ();
void set (String^ value);
}
member MatchAttributeName : string with get, set
function get MatchAttributeName () : String
function set MatchAttributeName (value : String)
属性值
类型:String
特性名。
备注
此属性与 MatchAttributeValue 结合使用,提供有关指定要验证的特性的更多信息。
请看下面的 HTML:
<input name="Name" type="text" id="TextBox1" size="25" />
<input name="Email" type="text" id="TextBox2" size="25" />
<input name="Password" type="password" id="TextBox3" size="25" />
您希望验证是否存在一个供用户输入密码的输入框,出于安全方面的考虑,还需要验证输入类型是否为密码。
备注
当用户键入的是文本时,会显示相应的文字;当用户键入的是密码,则会显示为 *。
为此,请将 TagName 属性设置为 input,将 AttributeName 属性设置为 type,将 ExpectedValue 属性设置为 password。
请注意,HTML 中的三个标记均为 input 标记,而且都包含 type 属性。 若要在正确的标记中验证属性,则必须提供其他信息。将 MatchAttributeName 属性设置为 name,将 MatchAttributeValue 属性设置为 Password。 现在,只有一个标记符合指定的条件,系统会向该标记应用属性验证规则。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。