selenium.webdriver.common.options

Classes

ArgOptions()
BaseOptions() Base class for individual browser options.
class selenium.webdriver.common.options.ArgOptions[source]
BINARY_LOCATION_ERROR = 'Binary Location Must be a String'
add_argument(argument) → None[source]

Adds an argument to the list.

Args:
  • Sets the arguments
arguments
Returns:A list of arguments needed for the browser.
capabilities
default_capabilities

Return minimal capabilities necessary as a dictionary.

enable_mobile(android_package: Optional[str] = None, android_activity: Optional[str] = None, device_serial: Optional[str] = None) → None

Enables mobile browser use for browsers that support it.

Args:android_activity: The name of the android package to start
ignore_local_proxy_environment_variables() → None[source]

By calling this you will ignore HTTP_PROXY and HTTPS_PROXY from being picked up and used.

set_capability(name, value) → None

Sets a capability.

to_capabilities()[source]

Convert options into capabilities dictionary.

class selenium.webdriver.common.options.BaseOptions[source]

Base class for individual browser options.

accept_insecure_certs

Gets and Set whether the session accepts insecure certificates.

  • Get
    • self.accept_insecure_certs
  • Set
    • self.accept_insecure_certs = value

value: bool

  • Get
    • bool
  • Set
    • None
browser_version

Gets and Sets the version of the browser.

  • Get
    • self.browser_version
  • Set
    • self.browser_version = value

value: str

  • Get
    • str
  • Set
    • None
capabilities
default_capabilities

Return minimal capabilities necessary as a dictionary.

enable_downloads

Gets and Sets whether session can download files.

  • Get
    • self.enable_downloads
  • Set
    • self.enable_downloads = value

value: bool

  • Get
    • bool
  • Set
    • None
enable_mobile(android_package: Optional[str] = None, android_activity: Optional[str] = None, device_serial: Optional[str] = None) → None[source]

Enables mobile browser use for browsers that support it.

Args:android_activity: The name of the android package to start
page_load_strategy

:Gets and Sets page load strategy, the default is “normal”.

  • Get
    • self.page_load_strategy
  • Set
    • self.page_load_strategy = value

value: str

  • Get
    • str
  • Set
    • None
platform_name

Gets and Sets name of the platform.

  • Get
    • self.platform_name
  • Set
    • self.platform_name = value

value: str

  • Get
    • str
  • Set
    • None
proxy

Sets and Gets Proxy.

  • Get
    • self.proxy
  • Set
    • self.proxy = value

value: Proxy

  • Get
    • Proxy
  • Set
    • None
set_capability(name, value) → None[source]

Sets a capability.

set_window_rect

Gets and Sets window size and position.

  • Get
    • self.set_window_rect
  • Set
    • self.set_window_rect = value

value: bool

  • Get
    • bool
  • Set
    • None
strict_file_interactability

Gets and Sets whether session is about file interactability.

  • Get
    • self.strict_file_interactability
  • Set
    • self.strict_file_interactability = value

value: bool

  • Get
    • bool
  • Set
    • None
timeouts

:Gets and Sets implicit timeout, pageLoad timeout and script timeout if set (in milliseconds)

  • Get
    • self.timeouts
  • Set
    • self.timeouts = value

value: dict

  • Get
    • dict
  • Set
    • None
to_capabilities()[source]

Convert options into capabilities dictionary.

unhandled_prompt_behavior

:Gets and Sets unhandled prompt behavior, the default is “dismiss and notify”.

  • Get
    • self.unhandled_prompt_behavior
  • Set
    • self.unhandled_prompt_behavior = value

value: str

  • Get
    • str
  • Set
    • None
class selenium.webdriver.common.options.PageLoadStrategy[source]

Enum of possible page load strategies.

Selenium support following strategies:
  • normal (default) - waits for all resources to download
  • eager - DOM access is ready, but other resources like images may still be loading
  • none - does not block WebDriver at all

Docs: https://www.selenium.dev/documentation/webdriver/drivers/options/#pageloadstrategy.

eager = 'eager'
none = 'none'
normal = 'normal'