Select-HtmlAttributeValue
August 3, 2026 ยท View on GitHub
SYNOPSIS
Returns an HTML attribute value from AngleSharp or HtmlAgilityPack elements, attributes, and matching object properties.
SYNTAX
__AllParameterSets
Select-HtmlAttributeValue [-InputObject] <Object> [[-AttributeName] <string>] [-DefaultValue <string>] [-TreatEmptyAsMissing] [<CommonParameters>]
DESCRIPTION
Returns an HTML attribute value from AngleSharp or HtmlAgilityPack elements, attributes, and matching object properties.
EXAMPLES
EXAMPLE 1
ConvertFrom-Html -Content $html | Select-HtmlNode -XPath '//a' | Select-HtmlAttributeValue -AttributeName href
PARAMETERS
-AttributeName
Attribute or property name to read.
Type: String
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-DefaultValue
Value returned when the requested attribute is missing.
Type: String
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InputObject
AngleSharp or HtmlAgilityPack element, attribute, document, or an object with a matching property.
Type: Object
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-TreatEmptyAsMissing
Returns DefaultValue when the attribute exists but its value is empty.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.Object
OUTPUTS
System.String
RELATED LINKS
- None