Table of Contents

Class UserPromptHandler.PerPromptType

Namespace
OpenQA.Selenium
Assembly
Selenium.WebDriver.dll

Represents a user prompt handler that specifies distinct UnhandledPromptBehavior values for individual prompt types (alert, confirm, prompt, beforeunload, file), with a fallback default.

public sealed record UserPromptHandler.PerPromptType : UserPromptHandler, IEquatable<UserPromptHandler>, IEquatable<UserPromptHandler.PerPromptType>
Inheritance
UserPromptHandler.PerPromptType
Implements
Inherited Members

Remarks

Use this variant to configure distinct behaviors for alert, confirm, prompt, beforeunload, and file selection dialogs encountered during browser automation. Each property allows you to control the response to a specific type of unhandled prompt, enabling fine-grained handling beyond a single global setting.

Properties

Alert

Gets the behavior to use when an unexpected alert is encountered during automation, or null to leave it unset.

public UnhandledPromptBehavior? Alert { get; init; }

Property Value

UnhandledPromptBehavior?

BeforeUnload

Gets the behavior to use when an unexpected beforeunload dialog is encountered, or null to leave it unset.

public UnhandledPromptBehavior? BeforeUnload { get; init; }

Property Value

UnhandledPromptBehavior?

Confirm

Gets the behavior to use when a confirmation prompt is encountered, or null to leave it unset.

public UnhandledPromptBehavior? Confirm { get; init; }

Property Value

UnhandledPromptBehavior?

Default

Gets the fallback behavior to use when no specific handler is defined for a given prompt type, or null to leave it unset.

public UnhandledPromptBehavior? Default { get; init; }

Property Value

UnhandledPromptBehavior?

File

Gets the behavior to use when an unexpected file selection dialog is encountered, or null to leave it unset.

public UnhandledPromptBehavior? File { get; init; }

Property Value

UnhandledPromptBehavior?

Remarks

The "file" prompt type is respected only in WebDriver BiDi sessions.

Prompt

Gets the behavior to use when an unexpected prompt is encountered during automation, or null to leave it unset.

public UnhandledPromptBehavior? Prompt { get; init; }

Property Value

UnhandledPromptBehavior?