ValidationRuleRequiredAttributeValue.MatchAttributeValue 属性

获取或设置其他特性的值,该值必须能够在包含待验证的特性值的 HTML 标记中找到。 与 MatchAttributeName 结合使用。

命名空间:  Microsoft.VisualStudio.TestTools.WebTesting.Rules
程序集:  Microsoft.VisualStudio.QualityTools.WebTestFramework(在 Microsoft.VisualStudio.QualityTools.WebTestFramework.dll 中)

语法

声明
Public Property MatchAttributeValue As String
public string MatchAttributeValue { get; set; }
public:
property String^ MatchAttributeValue {
    String^ get ();
    void set (String^ value);
}
member MatchAttributeValue : string with get, set
function get MatchAttributeValue () : String 
function set MatchAttributeValue (value : String)

属性值

类型:String
特性值。

备注

此属性与 MatchAttributeName 结合使用,提供有关要验证的属性的更多信息。

请看下面的 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 安全性

请参阅

参考

ValidationRuleRequiredAttributeValue 类

Microsoft.VisualStudio.TestTools.WebTesting.Rules 命名空间