Skip to content

Exceptions

This section documents all custom exceptions that can be raised by Pydoll operations.

pydoll.exceptions

Pydoll Exception Classes

This module contains all exception classes used throughout the Pydoll library, organized into logical categories based on their function and usage patterns. Each category uses a base class to provide common functionality for related exceptions.

PydollException

PydollException(message='')

Bases: Exception

Base class for all Pydoll exceptions.

message class-attribute instance-attribute

message = message or message

ConnectionException

ConnectionException(message='')

Bases: PydollException

Base class for exceptions related to browser connection.

message class-attribute instance-attribute

message = 'A connection error occurred'

ConnectionFailed

ConnectionFailed(message='')

Bases: ConnectionException

Raised when connection to the browser cannot be established.

message class-attribute instance-attribute

message = 'Failed to connect to the browser'

ReconnectionFailed

ReconnectionFailed(message='')

Bases: ConnectionException

Raised when an attempt to reconnect to the browser fails.

message class-attribute instance-attribute

message = 'Failed to reconnect to the browser'

WebSocketConnectionClosed

WebSocketConnectionClosed(message='')

Bases: ConnectionException

Raised when the WebSocket connection to the browser is closed unexpectedly.

message class-attribute instance-attribute

message = 'The WebSocket connection is closed'

NetworkError

NetworkError(message='')

Bases: ConnectionException

Raised when a general network error occurs during browser communication.

message class-attribute instance-attribute

message = 'A network error occurred'

BrowserException

BrowserException(message='')

Bases: PydollException

Base class for exceptions related to browser process management.

message class-attribute instance-attribute

message = 'A browser error occurred'

BrowserNotRunning

BrowserNotRunning(message='')

Bases: BrowserException

Raised when attempting to interact with a browser that is not running.

message class-attribute instance-attribute

message = 'The browser is not running'

FailedToStartBrowser

FailedToStartBrowser(message='')

Bases: BrowserException

Raised when the browser process cannot be started.

message class-attribute instance-attribute

message = 'Failed to start the browser'

UnsupportedOS

UnsupportedOS(message='')

Bases: BrowserException

Raised when attempting to run on an unsupported operating system.

message class-attribute instance-attribute

message = 'Unsupported OS'

NoValidTabFound

NoValidTabFound(message='')

Bases: BrowserException

Raised when no valid browser tab can be found or created.

message class-attribute instance-attribute

message = 'No valid attached tab found'

ProtocolException

ProtocolException(message='')

Bases: PydollException

Base class for exceptions related to CDP protocol communication.

message class-attribute instance-attribute

message = 'A protocol error occurred'

InvalidCommand

InvalidCommand(message='')

Bases: ProtocolException

Raised when an invalid command is sent to the browser.

message class-attribute instance-attribute

message = 'The command provided is invalid'

InvalidResponse

InvalidResponse(message='')

Bases: ProtocolException

Raised when an invalid response is received from the browser.

message class-attribute instance-attribute

message = 'The response received is invalid'

ResendCommandFailed

ResendCommandFailed(message='')

Bases: ProtocolException

Raised when an attempt to resend a failed command fails.

message class-attribute instance-attribute

message = 'Failed to resend the command'

CommandExecutionTimeout

CommandExecutionTimeout(message='')

Bases: ProtocolException

Raised when a command execution times out.

message class-attribute instance-attribute

message = 'The command execution timed out'

InvalidCallback

InvalidCallback(message='')

Bases: ProtocolException

Raised when an invalid callback is provided for an event.

message class-attribute instance-attribute

message = 'The callback provided is invalid'

EventNotSupported

EventNotSupported(message='')

Bases: ProtocolException

Raised when an attempt is made to subscribe to an unsupported event.

message class-attribute instance-attribute

message = 'The event is not supported'

ElementException

ElementException(message='')

Bases: PydollException

Base class for exceptions related to element interactions.

message class-attribute instance-attribute

message = 'An element interaction error occurred'

ElementNotFound

ElementNotFound(message='')

Bases: ElementException

Raised when an element cannot be found in the DOM.

message class-attribute instance-attribute

message = 'The specified element was not found'

ElementNotVisible

ElementNotVisible(message='')

Bases: ElementException

Raised when attempting to interact with an element that is not visible.

message class-attribute instance-attribute

message = 'The element is not visible'

ElementNotInteractable

ElementNotInteractable(message='')

Bases: ElementException

Raised when attempting to interact with an element that cannot receive interaction.

message class-attribute instance-attribute

message = 'The element is not interactable'

ClickIntercepted

ClickIntercepted(message='')

Bases: ElementException

Raised when a click operation is intercepted by another element.

message class-attribute instance-attribute

message = 'The click was intercepted'

ElementNotAFileInput

ElementNotAFileInput(message='')

Bases: ElementException

Raised when attempting to use file input methods on a non-file input element.

message class-attribute instance-attribute

message = 'The element is not a file input'

TimeoutException

TimeoutException(message='')

Bases: PydollException

Base class for exceptions related to timeouts.

message class-attribute instance-attribute

message = 'A timeout occurred'

PageLoadTimeout

PageLoadTimeout(message='')

Bases: TimeoutException

Raised when a page load operation times out.

message class-attribute instance-attribute

message = 'Page load timed out'

WaitElementTimeout

WaitElementTimeout(message='')

Bases: TimeoutException

Raised when waiting for an element times out.

message class-attribute instance-attribute

message = 'Timed out waiting for element to appear'

ConfigurationException

ConfigurationException(message='')

Bases: PydollException

Base class for exceptions related to configuration and options.

message class-attribute instance-attribute

message = 'A configuration error occurred'

InvalidOptionsObject

InvalidOptionsObject(message='')

Bases: ConfigurationException

Raised when an invalid options object is provided.

message class-attribute instance-attribute

message = 'The options object provided is invalid'

InvalidBrowserPath

InvalidBrowserPath(message='')

Bases: ConfigurationException

Raised when an invalid browser executable path is provided.

message class-attribute instance-attribute

message = 'The browser path provided is invalid'

ArgumentAlreadyExistsInOptions

ArgumentAlreadyExistsInOptions(message='')

Bases: ConfigurationException

Raised when attempting to add a duplicate argument to browser options.

message class-attribute instance-attribute

message = 'The argument already exists in the options'

InvalidFileExtension

InvalidFileExtension(message='')

Bases: ConfigurationException

Raised when an unsupported file extension is provided.

message class-attribute instance-attribute

message = 'The file extension provided is not supported'

DialogException

DialogException(message='')

Bases: PydollException

Base class for exceptions related to browser dialogs.

message class-attribute instance-attribute

message = 'A dialog error occurred'

NoDialogPresent

NoDialogPresent(message='')

Bases: DialogException

Raised when attempting to interact with a dialog that doesn't exist.

message class-attribute instance-attribute

message = 'No dialog present on the page'

NotAnIFrame

NotAnIFrame(message='')

Bases: PydollException

Raised when an element is not an iframe.

message class-attribute instance-attribute

message = 'The element is not an iframe'

InvalidIFrame

InvalidIFrame(message='')

Bases: PydollException

Raised when an iframe is not valid.

message class-attribute instance-attribute

message = 'The iframe is not valid'

IFrameNotFound

IFrameNotFound(message='')

Bases: PydollException

Raised when an iframe is not found.

message class-attribute instance-attribute

message = 'The iframe was not found'

NetworkEventsNotEnabled

NetworkEventsNotEnabled(message='')

Bases: PydollException

Raised when network events are not enabled.

message class-attribute instance-attribute

message = 'Network events not enabled'

ScriptException

ScriptException(message='')

Bases: PydollException

Base class for exceptions related to JavaScript execution.

message class-attribute instance-attribute

message = 'A script execution error occurred'

InvalidScriptWithElement

InvalidScriptWithElement(message='')

Bases: ScriptException

Raised when a script contains 'argument' but no element is provided.

message class-attribute instance-attribute

message = 'Script contains "argument" but no element was provided'