| external help file | Pup.dll-Help.xml |
|---|---|
| Module Name | Pup |
| online version | |
| schema | 2.0.0 |
Gets an attribute value from an element.
Get-PupElementAttribute -Element <PupElement> -Name <String> [-ProgressAction <ActionPreference>]
[<CommonParameters>]
Retrieves the value of a specific HTML attribute from an element. Useful for extracting data attributes, href values, or other element metadata.
$link = Find-PupElements -Page $page -Selector "a.download" -First
Get-PupElementAttribute -Element $link -Name "href"
Gets the URL from a link element.
$el = Find-PupElements -Page $page -Selector "[data-user-id]" -First
$userId = Get-PupElementAttribute -Element $el -Name "data-user-id"
Extracts custom data attributes.
$links = Find-PupElements -Page $page -Selector "a"
$links | ForEach-Object {
$target = Get-PupElementAttribute -Element $_ -Name "target"
$rel = Get-PupElementAttribute -Element $_ -Name "rel"
if ($target -eq "_blank" -and $rel -notlike "*noopener*") {
"Vulnerable link: $(Get-PupElementAttribute -Element $_ -Name 'href')"
}
}
Finds links vulnerable to reverse tabnabbing.
Element to get attribute from
Type: PupElement
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseName of the attribute to get
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.