| external help file | Pup.dll-Help.xml |
|---|---|
| Module Name | Pup |
| online version | |
| schema | 2.0.0 |
Converts recorded events to a PowerShell automation script.
ConvertTo-PupScript -RecordingEvents <PupRecordingEvent[]> [-PageVariable <String>] [-BrowserVariable <String>]
[-IncludeSetup] [-IncludeTeardown] [-Url <String>] [-OutputFile <String>] [-DelayMin <Int32>]
[-DelayMax <Int32>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Converts an array of recorded events into a PowerShell script that can replay the interactions. Supports adding setup/teardown code, custom variable names, and delays between actions for human-like behavior.
$events = Get-PupRecording -Page $page
$script = $events | ConvertTo-PupScript
$script
Converts recorded events to a PowerShell script and displays it.
$events = Get-PupRecording -Page $page
$script = $events | ConvertTo-PupScript -IncludeSetup -IncludeTeardown
Generates a complete script including browser startup and cleanup code. The URL is automatically captured from when recording started.
$events | ConvertTo-PupScript -IncludeSetup -PageVariable '$myPage' -BrowserVariable '$myBrowser' -OutputFile "automation.ps1"
Saves the script to a file using custom variable names.
$events | ConvertTo-PupScript -DelayMin 100 -DelayMax 500
Adds random delays between 100-500ms between each action for more human-like behavior.
$events = Get-PupRecording -Page $page -IncludeWaits
$script = $events | ConvertTo-PupScript
Using -IncludeWaits with Get-PupRecording adds wait events that preserve the actual timing from the recording session.
Variable name for browser in generated script
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseMaximum delay between actions in milliseconds (randomizes between min and max)
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseMinimum delay between actions in milliseconds
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseInclude setup code in generated script
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseInclude teardown code in generated script
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSave output to file
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseVariable name for page in generated script
Type: String
Parameter Sets: (All)
Aliases:
Required: False
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: FalseRecording events to convert
Type: PupRecordingEvent[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseOverride URL for setup code (by default uses URL from recording start)
Type: String
Parameter Sets: (All)
Aliases:
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.