A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.alert.html below:

selenium.webdriver.common.alert — Selenium 4.35.0.202506301117 documentation

selenium.webdriver.common.alert

The Alert implementation.

Classes

Alert(driver)

Allows to work with alerts.

class selenium.webdriver.common.alert.Alert(driver)[source]

Allows to work with alerts.

Use this class to interact with alert prompts. It contains methods for dismissing, accepting, inputting, and getting text from alert prompts.

Accepting / Dismissing alert prompts:

Alert(driver).accept()
Alert(driver).dismiss()

Inputting a value into an alert prompt:

name_prompt = Alert(driver)
name_prompt.send_keys("Willian Shakesphere")
name_prompt.accept()

Reading a the text of a prompt for verification:

alert_text = Alert(driver).text
self.assertEqual("Do you wish to quit?", alert_text)

Creates a new Alert.

Args:
  • driver: The WebDriver instance which performs user actions.

property text: str

Gets the text of the Alert.

dismiss() None[source]

Dismisses the alert available.

accept() None[source]

Accepts the alert available.

Usage:
Alert(driver).accept()  # Confirm a alert dialog.
send_keys(keysToSend: str) None[source]

Send Keys to the Alert.

Args:
  • keysToSend: The text to be sent to Alert.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4