ExtractAttributeValue.MatchAttributeName 属性

更新:2007 年 11 月

获取或设置另一个属性名,该属性名必须能够在包含待提取的属性值的 HTML 标记中找到。与 MatchAttributeValue 结合使用。

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

语法

声明
Public Property MatchAttributeName As String
用法
Dim instance As ExtractAttributeValue
Dim value As String

value = instance.MatchAttributeName

instance.MatchAttributeName = value
public string MatchAttributeName { get; set; }
public:
property String^ MatchAttributeName {
    String^ get ();
    void set (String^ value);
}
public function get MatchAttributeName () : String
public function set MatchAttributeName (value : String)

属性值

类型:System.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" />

您希望提取 Email 输入框的 id。为此,请将 TagName 属性设置为 input,将 AttributeName 属性设置为 id。

请注意,HTML 中的三个标记均为 input 标记,而且都包含 id 属性。要从正确的标记中提取属性,必须提供更多信息。将 MatchAttributeName 属性设置为 name,将 MatchAttributeValue 属性设置为 Email。现在,只有一个标记符合指定的条件,系统将从该标记中提取属性。

权限

另请参见

参考

ExtractAttributeValue 类

ExtractAttributeValue 成员

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